Skip to content

Commit a7a17ac

Browse files
committed
Actually get the thing to connect
1 parent 4164c41 commit a7a17ac

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

packages/node/tests/sync.test.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import { describe, vi, expect, beforeEach } from 'vitest';
22

33
import { connectedDatabaseTest, MockSyncService, TestConnector, waitForSyncStatus } from "./utils";
4-
import { AbstractPowerSyncDatabase, BucketChecksum, OplogEntryJSON } from '@powersync/common';
4+
import { AbstractPowerSyncDatabase, BucketChecksum, OplogEntryJSON, SyncStreamConnectionMethod } from '@powersync/common';
5+
import Logger from 'js-logger';
6+
7+
Logger.useDefaults();
58

69
describe('Sync', () => {
710
describe('reports progress', () => {
@@ -48,8 +51,8 @@ describe('Sync', () => {
4851
}
4952

5053
connectedDatabaseTest('without priorities', async ({database, syncService}) => {
51-
await database.connect(new TestConnector());
52-
await vi.waitFor(() => expect(syncService.connectedListeners).toBe(1));
54+
database.connect(new TestConnector(), { connectionMethod: SyncStreamConnectionMethod.HTTP });
55+
await vi.waitFor(() => expect(syncService.connectedListeners).toEqual(1));
5356

5457
syncService.pushLine({checkpoint: {
5558
last_op_id: '10',

packages/node/tests/utils.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ export interface MockSyncService {
124124
export class TestConnector implements PowerSyncBackendConnector {
125125
async fetchCredentials(): Promise<PowerSyncCredentials> {
126126
return {
127-
endpoint: '',
128-
token: ''
127+
endpoint: 'https://powersync.example.org',
128+
token: 'test'
129129
};
130130
}
131131
async uploadData(database: AbstractPowerSyncDatabase): Promise<void> {

0 commit comments

Comments
 (0)