Formatting
This commit is contained in:
@@ -55,7 +55,7 @@ describe("shell completions", () => {
|
||||
test("uses shell-native mnemonic completion in fish", () => {
|
||||
const completions = generateFishCompletions("xo-cli");
|
||||
|
||||
expect(completions).toContain("set -l config_dir \"$XO_CONFIG_DIR\"");
|
||||
expect(completions).toContain('set -l config_dir "$XO_CONFIG_DIR"');
|
||||
expect(completions).toContain("(__xo_cli_complete_mnemonics)");
|
||||
expect(completions).not.toContain("(__xo_cli_complete_dynamic mnemonics)");
|
||||
});
|
||||
@@ -68,9 +68,9 @@ describe("shell completions", () => {
|
||||
|
||||
const contents = readFileSync(configFile, "utf8");
|
||||
expect(contents.match(/XO_CONFIG_DIR/g)).toHaveLength(2);
|
||||
expect(contents.match(/eval "\$\(xo-cli completions bash\)"/g)).toHaveLength(
|
||||
1,
|
||||
);
|
||||
expect(
|
||||
contents.match(/eval "\$\(xo-cli completions bash\)"/g),
|
||||
).toHaveLength(1);
|
||||
});
|
||||
|
||||
test("adds a missing default without duplicating an existing loader", () => {
|
||||
@@ -79,16 +79,18 @@ describe("shell completions", () => {
|
||||
expect(installCompletions("bash", "xo-cli", configFile)).toBe(true);
|
||||
|
||||
const contents = readFileSync(configFile, "utf8");
|
||||
expect(contents.match(/eval "\$\(xo-cli completions bash\)"/g)).toHaveLength(
|
||||
1,
|
||||
);
|
||||
expect(
|
||||
contents.match(/eval "\$\(xo-cli completions bash\)"/g),
|
||||
).toHaveLength(1);
|
||||
expect(contents).toContain(
|
||||
'export XO_CONFIG_DIR="${XO_CONFIG_DIR:-$HOME/.config/xo-cli}"',
|
||||
);
|
||||
});
|
||||
|
||||
test("preserves an existing custom config directory assignment", () => {
|
||||
const configFile = createConfigFile("export XO_CONFIG_DIR=/tmp/custom-xo\n");
|
||||
const configFile = createConfigFile(
|
||||
"export XO_CONFIG_DIR=/tmp/custom-xo\n",
|
||||
);
|
||||
|
||||
expect(installCompletions("zsh", "xo-cli", configFile)).toBe(true);
|
||||
|
||||
|
||||
@@ -57,7 +57,9 @@ describe("settings command", () => {
|
||||
{},
|
||||
);
|
||||
|
||||
const persisted = JSON.parse(readFileSync(paths.walletConfigPath, "utf8")) as {
|
||||
const persisted = JSON.parse(
|
||||
readFileSync(paths.walletConfigPath, "utf8"),
|
||||
) as {
|
||||
currency: string;
|
||||
"default-mnemonic"?: string;
|
||||
};
|
||||
|
||||
@@ -103,7 +103,7 @@ const testCases: TestCase[] = [
|
||||
inputs: ["export", p2pkhTemplateIdentifier],
|
||||
shouldThrow: false,
|
||||
expectedData: {},
|
||||
logs: [{ out: "\"name\":\"Wallet (P2PKH)\"" }],
|
||||
logs: [{ out: '"name":"Wallet (P2PKH)"' }],
|
||||
},
|
||||
// Error cases - subcommand
|
||||
{
|
||||
|
||||
@@ -113,7 +113,9 @@ describe("mnemonic utilities", () => {
|
||||
|
||||
// Due to some weird MacOS behavior we need to use realpathSync to get the correct path
|
||||
// Basically, tmpDir() returns a symlink, but moving to that path puts us at `/private/${tmpDir()}`
|
||||
const expectedPath = realpathSync(path.join(tempDir, "mnemonic-relative"));
|
||||
const expectedPath = realpathSync(
|
||||
path.join(tempDir, "mnemonic-relative"),
|
||||
);
|
||||
|
||||
// Compare to the expected path
|
||||
expect(resolved).toBe(expectedPath);
|
||||
|
||||
@@ -159,7 +159,9 @@ export const createMockEngine = async (seed: string) => {
|
||||
};
|
||||
|
||||
export const createMockAppService = async (engine: Engine) => {
|
||||
const settings = new SettingsService(`${tmpdir()}/xo-cli-tests-settings.json`);
|
||||
const settings = new SettingsService(
|
||||
`${tmpdir()}/xo-cli-tests-settings.json`,
|
||||
);
|
||||
settings.setCurrency("USD");
|
||||
|
||||
const storage = await InMemoryStorage.create();
|
||||
|
||||
@@ -5,7 +5,10 @@ export class MockRatesService extends BaseRates {
|
||||
super();
|
||||
}
|
||||
|
||||
async getRate(numeratorUnitCode: string, denominatorUnitCode: string): Promise<number> {
|
||||
async getRate(
|
||||
numeratorUnitCode: string,
|
||||
denominatorUnitCode: string,
|
||||
): Promise<number> {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -20,4 +23,4 @@ export class MockRatesService extends BaseRates {
|
||||
async listPairs(): Promise<Set<string>> {
|
||||
return new Set();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,11 @@
|
||||
import { expect, test, describe, beforeEach, afterEach } from "vitest";
|
||||
import { existsSync, mkdirSync, rmSync, writeFileSync, realpathSync } from "node:fs";
|
||||
import {
|
||||
existsSync,
|
||||
mkdirSync,
|
||||
rmSync,
|
||||
writeFileSync,
|
||||
realpathSync,
|
||||
} from "node:fs";
|
||||
import { homedir, tmpdir } from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
@@ -130,7 +136,9 @@ describe("paths utilities", () => {
|
||||
|
||||
// Due to some weird MacOS behavior we need to use realpathSync to get the correct path
|
||||
// Basically, tmpDir() returns a symlink, but moving to that path puts us at `/private/${tmpDir()}`
|
||||
const expectedPath = realpathSync(path.join(tempDir, "mnemonic-cwd-test"));
|
||||
const expectedPath = realpathSync(
|
||||
path.join(tempDir, "mnemonic-cwd-test"),
|
||||
);
|
||||
|
||||
// Compare to the expected path
|
||||
expect(resolved).toBe(expectedPath);
|
||||
|
||||
Reference in New Issue
Block a user