@powersync/service-module-mongodb 0.14.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -61,8 +61,9 @@ function defineResumeTest({ factory: factoryGenerator, storageVersion }: Storage
61
61
  context2.storage = factory.getInstance(activeContent!);
62
62
 
63
63
  // If this test times out, it likely didn't throw the expected error here.
64
- const error = await context2.startStreaming().catch((ex) => ex);
64
+ const result = await context2.startStreaming();
65
65
  // The ChangeStreamReplicationJob will detect this and throw a ChangeStreamInvalidatedError
66
- expect(error).toBeInstanceOf(ChangeStreamInvalidatedError);
66
+ expect(result.status).toEqual('rejected');
67
+ expect((result as PromiseRejectedResult).reason).toBeInstanceOf(ChangeStreamInvalidatedError);
67
68
  });
68
69
  }
package/test/src/util.ts CHANGED
@@ -5,8 +5,8 @@ import * as postgres_storage from '@powersync/service-module-postgres-storage';
5
5
  import * as types from '@module/types/types.js';
6
6
  import {
7
7
  BSON_DESERIALIZE_DATA_OPTIONS,
8
- CURRENT_STORAGE_VERSION,
9
- LEGACY_STORAGE_VERSION,
8
+ SUPPORTED_STORAGE_VERSIONS,
9
+ TestStorageConfig,
10
10
  TestStorageFactory
11
11
  } from '@powersync/service-core';
12
12
  import { describe, TestOptions } from 'vitest';
@@ -24,11 +24,11 @@ export const INITIALIZED_MONGO_STORAGE_FACTORY = mongo_storage.test_utils.mongoT
24
24
  isCI: env.CI
25
25
  });
26
26
 
27
- export const INITIALIZED_POSTGRES_STORAGE_FACTORY = postgres_storage.test_utils.postgresTestStorageFactoryGenerator({
27
+ export const INITIALIZED_POSTGRES_STORAGE_FACTORY = postgres_storage.test_utils.postgresTestSetup({
28
28
  url: env.PG_STORAGE_TEST_URL
29
29
  });
30
30
 
31
- const TEST_STORAGE_VERSIONS = [LEGACY_STORAGE_VERSION, CURRENT_STORAGE_VERSION];
31
+ export const TEST_STORAGE_VERSIONS = SUPPORTED_STORAGE_VERSIONS;
32
32
 
33
33
  export interface StorageVersionTestContext {
34
34
  factory: TestStorageFactory;
@@ -36,12 +36,12 @@ export interface StorageVersionTestContext {
36
36
  }
37
37
 
38
38
  export function describeWithStorage(options: TestOptions, fn: (context: StorageVersionTestContext) => void) {
39
- const describeFactory = (storageName: string, factory: TestStorageFactory) => {
39
+ const describeFactory = (storageName: string, config: TestStorageConfig) => {
40
40
  describe(`${storageName} storage`, options, function () {
41
41
  for (const storageVersion of TEST_STORAGE_VERSIONS) {
42
42
  describe(`storage v${storageVersion}`, function () {
43
43
  fn({
44
- factory,
44
+ factory: config.factory,
45
45
  storageVersion
46
46
  });
47
47
  });