|
1 | | -import { AbstractPowerSyncDatabase, createBaseLogger, createLogger } from '@powersync/common'; |
| 1 | +import { AbstractPowerSyncDatabase, createBaseLogger, createLogger, LogLevel } from '@powersync/common'; |
2 | 2 | import { OpenAsyncDatabaseConnection, WASqliteConnection } from '@powersync/web'; |
3 | 3 | import * as Comlink from 'comlink'; |
4 | 4 | import { beforeAll, describe, expect, it, onTestFinished, vi } from 'vitest'; |
@@ -43,8 +43,9 @@ describe('Multiple Instances', { sequential: true }, () => { |
43 | 43 | { timeout: 10_000 }, |
44 | 44 | async ({ context: { openDatabase, mockService } }) => { |
45 | 45 | const logger = createLogger('test-logger'); |
| 46 | + logger.setLevel(LogLevel.TRACE); |
46 | 47 | const spiedErrorLogger = vi.spyOn(logger, 'error'); |
47 | | - const spiedDebugLogger = vi.spyOn(logger, 'debug'); |
| 48 | + const spiedTraceLogger = vi.spyOn(logger, 'trace'); |
48 | 49 |
|
49 | 50 | // Open an additional database which we can spy on the logs. |
50 | 51 | const powersync = openDatabase({ |
@@ -73,14 +74,13 @@ describe('Multiple Instances', { sequential: true }, () => { |
73 | 74 | { timeout: 3_000 } |
74 | 75 | ); |
75 | 76 |
|
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. |
78 | 78 | await vi.waitFor( |
79 | 79 | () => |
80 | 80 | expect( |
81 | | - spiedDebugLogger.mock.calls |
| 81 | + spiedTraceLogger.mock.calls |
82 | 82 | .flat(1) |
83 | | - .find((argument) => typeof argument == 'string' && argument.includes(message)) |
| 83 | + .find((argument) => typeof argument == 'string' && argument.includes('powersync_control')) |
84 | 84 | ).exist, |
85 | 85 | { timeout: 2000 } |
86 | 86 | ); |
|
0 commit comments