Skip to content

Commit

Permalink
refactor(core): improve tests
Browse files Browse the repository at this point in the history
Rename require-search test to import-search
and improve testing the promise rejection.

Co-authored-by: Erick Zhao <erick@hotmail.ca>
  • Loading branch information
SpacingBat3 and erickzhao committed Jun 23, 2024
1 parent 595b084 commit 2cf6d60
Showing 1 changed file with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,7 @@ describe('import-search', () => {
});

it('should throw if file exists but fails to load', async () => {
let test: () => unknown;
try {
const ret = await importSearch(__dirname, ['../fixture/require-search/throw-error']);
test = () => ret;
} catch (error) {
test = () => {
throw error;
};
}
expect(test).to.throw('test');
const promise = importSearch(__dirname, ['../fixture/require-search/throw-error']);
await expect(promise).to.be.rejectedWith('test');
});
});

0 comments on commit 2cf6d60

Please sign in to comment.