Skip to content

Commit 113fd37

Browse files
committed
test: make human-readable code for mocks
1 parent 72eef89 commit 113fd37

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

packages/dev-server-import-maps/test/resolving.test.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -351,16 +351,14 @@ describe('resolving imports', () => {
351351
</body>
352352
</html>`,
353353
};
354-
const warnFn = mock.fn();
355-
const noopFn = mock.fn();
356354
const logger = {
357-
log: noopFn,
358-
debug: noopFn,
359-
error: noopFn,
360-
warn: warnFn,
361-
group: noopFn,
362-
groupEnd: noopFn,
363-
logSyntaxError: noopFn,
355+
log: mock.fn(),
356+
debug: mock.fn(),
357+
error: mock.fn(),
358+
warn: mock.fn(),
359+
group: mock.fn(),
360+
groupEnd: mock.fn(),
361+
logSyntaxError: mock.fn(),
364362
};
365363
const { server, host } = await createTestServer(
366364
{
@@ -372,8 +370,8 @@ describe('resolving imports', () => {
372370

373371
const text = await fetchText(`${host}/index.html`);
374372
expectIncludes(text, '<script type="importmap">{</script>');
375-
assert.equal(warnFn.mock.callCount(), 1);
376-
const warning = warnFn.mock.calls[0].arguments[0];
373+
assert.equal(logger.warn.mock.callCount(), 1);
374+
const warning = logger.warn.mock.calls[0].arguments[0];
377375
expectIncludes(warning, 'Failed to parse import map in "');
378376
expectIncludes(warning, `test${path.sep}index.html": `);
379377
server.stop();

0 commit comments

Comments
 (0)