// SPDX-License-Identifier: Apache-2.0
import { BaseCommandTest } from './base-command-test.js';
import { InjectTokens } from '../../../../src/core/dependency-injection/inject-tokens.js';
import { container } from 'tsyringe-neo';
import { accountCreationShouldSucceed } from '../../../test-utility.js';
import { it } from 'mocha';
import { main } from '../../../../src/index.js';
import { Flags } from '../../../../src/commands/flags.js';
import { LedgerCommandDefinition } from '../../../../src/commands/command-definitions/ledger-command-definition.js';
export class AccountTest extends BaseCommandTest {
    static accountCreationShouldSucceed(options) {
        const { testName, namespace, testLogger: logger, contexts } = options;
        it(`${testName}: account creation should succeed`, async () => {
            const accountManager = container.resolve(InjectTokens.AccountManager);
            const remoteConfig = container.resolve(InjectTokens.RemoteConfigRuntimeState);
            await remoteConfig.load(namespace, contexts ? contexts[0] : undefined);
            accountCreationShouldSucceed(accountManager, namespace, remoteConfig, logger);
        });
    }
    static predefinedAccountCreationShouldSucceed(options) {
        const { testName, deployment } = options;
        const { newArgv, argvPushGlobalFlags, optionFromFlag } = AccountTest;
        it(`${testName}: ledger account predefined should succeed`, async () => {
            const argv = newArgv();
            argv.push(LedgerCommandDefinition.COMMAND_NAME, LedgerCommandDefinition.ACCOUNT_SUBCOMMAND_NAME, LedgerCommandDefinition.ACCOUNT_PREDEFINED, optionFromFlag(Flags.deployment), deployment);
            argvPushGlobalFlags(argv, testName, true);
            await main(argv);
        });
    }
}
//# sourceMappingURL=account-test.js.map