Skip to content

Commit

Permalink
fix: jest/expect-expect warning (#2062)
Browse files Browse the repository at this point in the history
Inlined the code since it couldn't understand the double redirection.
  • Loading branch information
nschonni authored Dec 5, 2021
1 parent 211ca51 commit 7366b54
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions packages/cspell-lib/src/util/resolveFile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ describe('Validate resolveFile', () => {
${`resolveFile${ext}`} | ${__dirname} | ${require.resolve('./resolveFile')} | ${true}
${'lerna'} | ${__dirname} | ${require.resolve('lerna')} | ${true}
${userNotFound} | ${__dirname} | ${path.resolve(path.join(os.homedir(), notFound))} | ${false}
`('resolveFile "$filename" rel "$relativeTo"', validateResolveFile);
`('resolveFile "$filename" rel "$relativeTo"', ({ filename, relativeTo, expected, found }: ResolveFileTest) => {
const r = resolveFile(filename, relativeTo);
expect(r.filename).toBe(expected);
expect(r.found).toBe(found);
});

test.each(
config.import
Expand All @@ -49,15 +53,9 @@ describe('Validate resolveFile', () => {
found: true,
}))
.map(({ filename, relativeTo, expected, found }) => [filename, relativeTo, expected, found])
)('resolveFile "%s" rel "%s"', validateResolveArgs);

function validateResolveFile({ filename, relativeTo, expected, found }: ResolveFileTest) {
validateResolveArgs(filename, relativeTo, expected, found);
}

function validateResolveArgs(filename: string, relativeTo: string, expected: string, found: boolean) {
)('resolveFile "%s" rel "%s"', (filename: string, relativeTo: string, expected: string, found: boolean) => {
const r = resolveFile(filename, relativeTo);
expect(r.filename).toBe(expected);
expect(r.found).toBe(found);
}
});
});

0 comments on commit 7366b54

Please sign in to comment.