| 1180 | hasLoaded = false |
| 1181 | |
| 1182 | constructor( |
| 1183 | presenceSignal: Signal<IntegrationPresence | null>, |
| 1184 | presenceMode?: 'solo' | 'full' |
| 1185 | ) { |
| 1186 | this.server = new TestServer(integrationSchema) |
| 1187 | this.socketPair = new TestSocketPair('test_presence_mode', this.server) |
| 1188 | this.socketPair.connect() |
| 1189 | |
| 1190 | this.client = new TLSyncClient<R>({ |
| 1191 | store: new Store({ schema: integrationSchema, props: {} }), |
| 1192 | socket: this.socketPair.clientSocket, |
| 1193 | onLoad: () => { |
| 1194 | this.hasLoaded = true |
| 1195 | }, |
| 1196 | onSyncError: vi.fn((reason) => { |
| 1197 | throw new Error('onSyncError: ' + reason) |
| 1198 | }), |
| 1199 | presence: presenceSignal, |
| 1200 | presenceMode: presenceMode ? computed('', () => presenceMode) : undefined, |
| 1201 | }) |
| 1202 | |
| 1203 | disposables.push(() => { |
| 1204 | this.client.close() |
| 1205 | }) |
| 1206 | } |
| 1207 | |
| 1208 | flush() { |
| 1209 | this.server.flushDebouncingMessages() |