@powersync/service-core-tests 0.0.0-dev-20260602073133 → 0.0.0-dev-20260909133214
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.
- package/CHANGELOG.md +112 -4
- package/dist/test-utils/AbstractStreamTestContext.d.ts +7 -6
- package/dist/test-utils/AbstractStreamTestContext.js +28 -25
- package/dist/test-utils/AbstractStreamTestContext.js.map +1 -1
- package/dist/test-utils/StorageDataHelpers.d.ts +6 -5
- package/dist/test-utils/StorageDataHelpers.js +40 -2
- package/dist/test-utils/StorageDataHelpers.js.map +1 -1
- package/dist/test-utils/bucket-validation.d.ts +3 -3
- package/dist/test-utils/bucket-validation.js +3 -3
- package/dist/test-utils/general-utils.d.ts +16 -3
- package/dist/test-utils/general-utils.js +37 -4
- package/dist/test-utils/general-utils.js.map +1 -1
- package/dist/test-utils/storage-combinations.d.ts +13 -0
- package/dist/test-utils/storage-combinations.js +26 -0
- package/dist/test-utils/storage-combinations.js.map +1 -0
- package/dist/test-utils/stream_utils.d.ts +0 -1
- package/dist/test-utils/stream_utils.js +0 -10
- package/dist/test-utils/stream_utils.js.map +1 -1
- package/dist/test-utils/test-utils-index.d.ts +1 -0
- package/dist/test-utils/test-utils-index.js +1 -0
- package/dist/test-utils/test-utils-index.js.map +1 -1
- package/dist/tests/register-compacting-tests.js +36 -29
- package/dist/tests/register-compacting-tests.js.map +1 -1
- package/dist/tests/register-data-storage-checkpoint-tests.js +138 -14
- package/dist/tests/register-data-storage-checkpoint-tests.js.map +1 -1
- package/dist/tests/register-data-storage-data-tests.js +205 -138
- package/dist/tests/register-data-storage-data-tests.js.map +1 -1
- package/dist/tests/register-data-storage-parameter-tests.js +44 -42
- package/dist/tests/register-data-storage-parameter-tests.js.map +1 -1
- package/dist/tests/register-parameter-compacting-tests.js +3 -2
- package/dist/tests/register-parameter-compacting-tests.js.map +1 -1
- package/dist/tests/register-sync-tests.js +404 -86
- package/dist/tests/register-sync-tests.js.map +1 -1
- package/dist/tests/util.d.ts +8 -2
- package/dist/tests/util.js +12 -0
- package/dist/tests/util.js.map +1 -1
- package/package.json +5 -6
- package/src/test-utils/AbstractStreamTestContext.ts +31 -27
- package/src/test-utils/StorageDataHelpers.ts +52 -8
- package/src/test-utils/bucket-validation.ts +3 -3
- package/src/test-utils/general-utils.ts +62 -10
- package/src/test-utils/storage-combinations.ts +51 -0
- package/src/test-utils/stream_utils.ts +0 -11
- package/src/test-utils/test-utils-index.ts +1 -0
- package/src/tests/register-compacting-tests.ts +55 -32
- package/src/tests/register-data-storage-checkpoint-tests.ts +171 -14
- package/src/tests/register-data-storage-data-tests.ts +251 -150
- package/src/tests/register-data-storage-parameter-tests.ts +58 -42
- package/src/tests/register-parameter-compacting-tests.ts +3 -2
- package/src/tests/register-sync-tests.ts +443 -88
- package/src/tests/util.ts +15 -2
- package/tsconfig.json +1 -4
- package/tsconfig.tsbuildinfo +1 -1
package/src/tests/util.ts
CHANGED
|
@@ -8,15 +8,28 @@ import {
|
|
|
8
8
|
} from '@powersync/service-sync-rules';
|
|
9
9
|
import { bucketRequest } from '../test-utils/general-utils.js';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Resolve storage again after test writes activate the sync config. The storage
|
|
13
|
+
* instance used by the writer retains its original PROCESSING stream snapshot,
|
|
14
|
+
* while compact() expects an instance constructed with the current state.
|
|
15
|
+
*/
|
|
16
|
+
export async function compactActive(factory: storage.BucketStorageFactory, options: storage.CompactOptions) {
|
|
17
|
+
const active = await factory.getActiveSyncConfig();
|
|
18
|
+
if (active == null) {
|
|
19
|
+
throw new Error('Expected an active sync config before compacting');
|
|
20
|
+
}
|
|
21
|
+
await active.storage.compact(options);
|
|
22
|
+
}
|
|
23
|
+
|
|
11
24
|
export function bucketRequestMap(
|
|
12
|
-
syncRules: storage.
|
|
25
|
+
syncRules: storage.PersistedSyncConfigContent,
|
|
13
26
|
buckets: Iterable<readonly [string, bigint]>
|
|
14
27
|
): storage.BucketDataRequest[] {
|
|
15
28
|
return Array.from(buckets, ([bucketName, opId]) => bucketRequest(syncRules, bucketName, opId));
|
|
16
29
|
}
|
|
17
30
|
|
|
18
31
|
export function bucketRequests(
|
|
19
|
-
syncRules: storage.
|
|
32
|
+
syncRules: storage.PersistedSyncConfigContent,
|
|
20
33
|
bucketNames: string[]
|
|
21
34
|
): storage.BucketChecksumRequest[] {
|
|
22
35
|
return bucketNames.map((bucketName) => {
|
package/tsconfig.json
CHANGED