Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDrone7 committed Jan 3, 2024
1 parent 0bd8891 commit 1dd1528
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions packages/web/tests/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ describe('UTIL: client', () => {
expect(client.initialized).toBeTruthy();
});

it('logs the initialization', async () => {
const spy = jest.spyOn(console, 'debug');
spy.mockImplementation(() => {});
await new Client().initialize({ logger: { enabled: true, level: 'TRACE' } });
expect(spy.mock.calls.length).toBeGreaterThanOrEqual(10);
});

it('can fetch in different locales', async () => {
const boots = await client.items.fetch('1001', { ignoreCache: true });
await client.updateLocale('ko_KR', false);
Expand Down
9 changes: 8 additions & 1 deletion packages/web/tests/logger.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Client } from '../dist';
import { Client, ShieldbowLogger } from '../dist';

describe('UTIL: logger', () => {
const client = new Client();
Expand Down Expand Up @@ -31,4 +31,11 @@ describe('UTIL: logger', () => {
client.logger?.trace('Test trace');
expect(spy).not.toHaveBeenCalled();
});

it('uses debug for trace', () => {
const debugSpy = jest.spyOn(console, 'debug');
const logger = new ShieldbowLogger('TRACE');
logger.trace('Test trace');
expect(debugSpy).toHaveBeenCalled();
});
});

0 comments on commit 1dd1528

Please sign in to comment.