Skip to content

Commit

Permalink
Update test types for vitest v2
Browse files Browse the repository at this point in the history
  • Loading branch information
ryangoree committed Oct 17, 2024
1 parent 8fa42e2 commit 024b92b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 27 deletions.
6 changes: 3 additions & 3 deletions packages/clide-js/test/units/core/resolve.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('resolve', () => {
subcommandsDir: 'commands/foo',
} as ResolvedCommand);

resolved = await resolved.resolveNext?.();
resolved = await resolved.resolveNext!();

expect(resolved).toMatchObject({
command: commandModules['commands/foo/bar.js'],
Expand All @@ -66,7 +66,7 @@ describe('resolve', () => {
subcommandsDir: 'commands/foo/bar',
} as ResolvedCommand);

resolved = await resolved.resolveNext?.();
resolved = await resolved.resolveNext!();

expect(resolved).toMatchObject({
command: commandModules['commands/foo/bar/baz.js'],
Expand Down Expand Up @@ -109,7 +109,7 @@ describe('resolve', () => {
subcommandsDir: 'commands/[qux]',
} as ResolvedCommand);

resolved = await resolved.resolveNext?.();
resolved = await resolved.resolveNext!();

expect(resolved).toEqual({
command: commandModules['commands/[qux]/[...quux].js'],
Expand Down
2 changes: 1 addition & 1 deletion packages/clide-js/test/utils/command-modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export function mockCommandStringModules<TCommandString extends string>(
}

type MockCommandModule = {
handler: Mock<[state: Readonly<State>]>;
handler: Mock<(state: Readonly<State>) => any>;
};

/**
Expand Down
28 changes: 14 additions & 14 deletions packages/clide-plugin-command-menu/src/command-menu.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ vi.mock('./command-menu-prompt', async (importOriginal) => {
const original: any = await importOriginal();
return {
...original,
commandMenuPrompt: vi.fn<[CommandMenuPromptOptions], ResolvedCommand[]>(
({ commandsDir }): ResolvedCommand[] => [
{
command: {
handler: vi.fn(({ next, data }) => next(data)),
},
commandName: 'mock-command',
remainingCommandString: '',
commandPath: `${commandsDir}/mock-command`,
commandTokens: ['mock-command'],
subcommandsDir: `${commandsDir}/mock-command`,
params: {},
commandMenuPrompt: vi.fn<
(options: CommandMenuPromptOptions) => ResolvedCommand[]
>(({ commandsDir }): ResolvedCommand[] => [
{
command: {
handler: vi.fn(({ next, data }) => next(data)),
},
],
),
commandName: 'mock-command',
remainingCommandString: '',
commandPath: `${commandsDir}/mock-command`,
commandTokens: ['mock-command'],
subcommandsDir: `${commandsDir}/mock-command`,
params: {},
},
]),
};
});

Expand Down
9 changes: 0 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1159,15 +1159,6 @@ ci-info@^3.7.0:
resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.9.0.tgz#4279a62028a7b1f262f3473fc9605f5e218c59b4"
integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==

clide-js@^0.2.2:
version "0.2.2"
resolved "https://registry.yarnpkg.com/clide-js/-/clide-js-0.2.2.tgz#6f87cff52f7f24efaaa1fa6c3a5d24f840d2e833"
integrity sha512-doO/LiXmkcwogkoJddNZQct1vH5i8MGH44LNVWcFnUBeA5xHl45h5kSjZkosT++Z867ryeNRB9xA+lnKgbzQpQ==
dependencies:
cliui "^8.0.1"
prompts "^2.4.2"
yargs-parser "^21.1.1"

cliui@^8.0.1:
version "8.0.1"
resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa"
Expand Down

0 comments on commit 024b92b

Please sign in to comment.