Skip to content

Commit 1e2529d

Browse files
committed
Fix web tests
1 parent acf6b70 commit 1e2529d

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

packages/web/tests/multiple_instances.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AbstractPowerSyncDatabase, createBaseLogger, createLogger } from '@powersync/common';
1+
import { AbstractPowerSyncDatabase, createBaseLogger, createLogger, LogLevel } from '@powersync/common';
22
import { OpenAsyncDatabaseConnection, WASqliteConnection } from '@powersync/web';
33
import * as Comlink from 'comlink';
44
import { beforeAll, describe, expect, it, onTestFinished, vi } from 'vitest';
@@ -43,8 +43,9 @@ describe('Multiple Instances', { sequential: true }, () => {
4343
{ timeout: 10_000 },
4444
async ({ context: { openDatabase, mockService } }) => {
4545
const logger = createLogger('test-logger');
46+
logger.setLevel(LogLevel.TRACE);
4647
const spiedErrorLogger = vi.spyOn(logger, 'error');
47-
const spiedDebugLogger = vi.spyOn(logger, 'debug');
48+
const spiedTraceLogger = vi.spyOn(logger, 'trace');
4849

4950
// Open an additional database which we can spy on the logs.
5051
const powersync = openDatabase({
@@ -73,14 +74,13 @@ describe('Multiple Instances', { sequential: true }, () => {
7374
{ timeout: 3_000 }
7475
);
7576

76-
// Should log that a connection attempt has been made
77-
const message = 'Streaming sync iteration started';
77+
// Asserting that powersync_control logs exists verifies that some connection attempt was made.
7878
await vi.waitFor(
7979
() =>
8080
expect(
81-
spiedDebugLogger.mock.calls
81+
spiedTraceLogger.mock.calls
8282
.flat(1)
83-
.find((argument) => typeof argument == 'string' && argument.includes(message))
83+
.find((argument) => typeof argument == 'string' && argument.includes('powersync_control'))
8484
).exist,
8585
{ timeout: 2000 }
8686
);

0 commit comments

Comments
 (0)