@hot-updater/test-utils 1.0.0-rc.28 → 1.0.0-rc.30
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/dist/index.mjs +48 -35
- package/package.json +6 -6
package/dist/index.mjs
CHANGED
|
@@ -3198,6 +3198,27 @@ const READ_BUDGETS = [
|
|
|
3198
3198
|
},
|
|
3199
3199
|
check: (count) => expect(count).toBe(11)
|
|
3200
3200
|
}),
|
|
3201
|
+
budget({
|
|
3202
|
+
api: "countEventSeries: buckets in the window × shards, all used",
|
|
3203
|
+
read: ({ insights }) => insights.countEventSeries({
|
|
3204
|
+
filter: bundleEvents,
|
|
3205
|
+
timeRange: {
|
|
3206
|
+
start: T0,
|
|
3207
|
+
end: T0 + 3 * DAY
|
|
3208
|
+
},
|
|
3209
|
+
intervalMs: DAY
|
|
3210
|
+
}),
|
|
3211
|
+
adapter: reads(0, 0, 1, 25),
|
|
3212
|
+
engine: {
|
|
3213
|
+
calls: 1,
|
|
3214
|
+
rows: 6
|
|
3215
|
+
},
|
|
3216
|
+
check: (points) => expect(points.map(({ events }) => events)).toEqual([
|
|
3217
|
+
24,
|
|
3218
|
+
0,
|
|
3219
|
+
1
|
|
3220
|
+
])
|
|
3221
|
+
}),
|
|
3201
3222
|
budget({
|
|
3202
3223
|
api: "countLatestEvents: buckets in the window × shards, all used",
|
|
3203
3224
|
read: ({ insights }) => insights.countLatestEvents({
|
|
@@ -3245,25 +3266,6 @@ const READ_BUDGETS = [
|
|
|
3245
3266
|
},
|
|
3246
3267
|
check: ({ data }) => expect(data[0].metrics.launches).toBe(25)
|
|
3247
3268
|
}),
|
|
3248
|
-
budget({
|
|
3249
|
-
api: "release activity over a window: buckets × shards, all used",
|
|
3250
|
-
read: ({ insights }) => insights.getReleaseActivity({
|
|
3251
|
-
scope: {
|
|
3252
|
-
platform: "ios",
|
|
3253
|
-
channel: "production"
|
|
3254
|
-
},
|
|
3255
|
-
timeRange: {
|
|
3256
|
-
start: T0,
|
|
3257
|
-
end: T0 + 3 * DAY
|
|
3258
|
-
}
|
|
3259
|
-
}),
|
|
3260
|
-
adapter: reads(0, 0, 2, 24),
|
|
3261
|
-
engine: {
|
|
3262
|
-
calls: 2,
|
|
3263
|
-
rows: 4
|
|
3264
|
-
},
|
|
3265
|
-
check: ({ data }) => expect(data[0].metrics.launches).toBe(25)
|
|
3266
|
-
}),
|
|
3267
3269
|
budget({
|
|
3268
3270
|
api: "app usage: nonzero distribution and usage-sketch rows in the window, all used",
|
|
3269
3271
|
read: ({ insights }) => insights.getAppUsage({
|
|
@@ -3388,7 +3390,7 @@ const READ_BUDGETS = [
|
|
|
3388
3390
|
install_id: "install-2",
|
|
3389
3391
|
received_at_ms: T0 + 3 * HOUR
|
|
3390
3392
|
})),
|
|
3391
|
-
adapter: reads(4,
|
|
3393
|
+
adapter: reads(4, 6, 0, 0),
|
|
3392
3394
|
engine: {
|
|
3393
3395
|
calls: 2,
|
|
3394
3396
|
rows: 1
|
|
@@ -4413,12 +4415,13 @@ const registerInsightsModelTests = (state) => {
|
|
|
4413
4415
|
beforeReceivedAtMs: 100
|
|
4414
4416
|
})).resolves.toBe(0);
|
|
4415
4417
|
});
|
|
4416
|
-
it("maintains idempotent release,
|
|
4418
|
+
it("maintains idempotent release, event series, usage, and latest-distribution summaries", async () => {
|
|
4417
4419
|
const model = state.getDatabase();
|
|
4418
4420
|
const releaseA = "00000000-0000-7000-8000-000000008001";
|
|
4419
4421
|
const releaseB = "00000000-0000-7000-8000-000000008002";
|
|
4422
|
+
const base = createBundleEventRowFixture("9801", 1e3);
|
|
4420
4423
|
const download = {
|
|
4421
|
-
...
|
|
4424
|
+
...base,
|
|
4422
4425
|
type: "UPDATE_DOWNLOADED",
|
|
4423
4426
|
install_id: "summary-install-a",
|
|
4424
4427
|
from_release_id: releaseA,
|
|
@@ -4470,22 +4473,32 @@ const registerInsightsModelTests = (state) => {
|
|
|
4470
4473
|
launches: 2,
|
|
4471
4474
|
failedLaunches: 1
|
|
4472
4475
|
}]);
|
|
4473
|
-
const
|
|
4474
|
-
|
|
4475
|
-
platform: "ios",
|
|
4476
|
-
channel: "production"
|
|
4477
|
-
},
|
|
4476
|
+
const hourly = (filter) => model.countEventSeries({
|
|
4477
|
+
filter,
|
|
4478
4478
|
timeRange: {
|
|
4479
4479
|
start: 0,
|
|
4480
|
-
end:
|
|
4481
|
-
}
|
|
4482
|
-
|
|
4483
|
-
expect(scope.data[0]?.metrics).toMatchObject({
|
|
4484
|
-
downloads: 1,
|
|
4485
|
-
launches: 3,
|
|
4486
|
-
failedLaunches: 1,
|
|
4487
|
-
uniqueUsers: 2
|
|
4480
|
+
end: 108e5
|
|
4481
|
+
},
|
|
4482
|
+
intervalMs: 36e5
|
|
4488
4483
|
});
|
|
4484
|
+
const points = (...counts) => counts.map((events, index) => ({
|
|
4485
|
+
startMs: index * 36e5,
|
|
4486
|
+
events
|
|
4487
|
+
}));
|
|
4488
|
+
const scope = {
|
|
4489
|
+
platform: "ios",
|
|
4490
|
+
channel: "production"
|
|
4491
|
+
};
|
|
4492
|
+
await expectInsightsIndex(() => hourly({
|
|
4493
|
+
...scope,
|
|
4494
|
+
type: "UPDATE_APPLIED",
|
|
4495
|
+
toBundleId: base.to_bundle_id
|
|
4496
|
+
}), points(2, 0, 0));
|
|
4497
|
+
await expectInsightsIndex(() => hourly({
|
|
4498
|
+
...scope,
|
|
4499
|
+
type: "RECOVERED",
|
|
4500
|
+
fromBundleId: base.from_bundle_id
|
|
4501
|
+
}), points(1, 0, 0));
|
|
4489
4502
|
const usage = await model.getAppUsage({
|
|
4490
4503
|
channel: "production",
|
|
4491
4504
|
platform: "all",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/test-utils",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.30",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Test utilities for Hot Updater packages",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"mysql2": "*",
|
|
51
51
|
"pg": "*",
|
|
52
52
|
"vitest": "^4.0.0",
|
|
53
|
-
"@hot-updater/plugin-insights": "^1.0.0-rc.
|
|
53
|
+
"@hot-updater/plugin-insights": "^1.0.0-rc.31",
|
|
54
54
|
"@hot-updater/protocol": "^1.0.0-rc.28",
|
|
55
|
-
"@hot-updater/
|
|
56
|
-
"@hot-updater/
|
|
55
|
+
"@hot-updater/server": "^1.0.0-rc.31",
|
|
56
|
+
"@hot-updater/plugin-core": "^1.0.0-rc.28"
|
|
57
57
|
},
|
|
58
58
|
"peerDependenciesMeta": {
|
|
59
59
|
"@electric-sql/pglite": {
|
|
@@ -83,11 +83,11 @@
|
|
|
83
83
|
"typescript": "npm:@typescript/typescript6@6.0.2",
|
|
84
84
|
"vitest": "4.1.4",
|
|
85
85
|
"workspace-tools": "^0.41.7",
|
|
86
|
-
"@hot-updater/plugin-insights": "1.0.0-rc.
|
|
86
|
+
"@hot-updater/plugin-insights": "1.0.0-rc.31",
|
|
87
87
|
"@hot-updater/protocol": "1.0.0-rc.28",
|
|
88
88
|
"@hot-updater/js": "1.0.0-rc.27",
|
|
89
89
|
"@hot-updater/plugin-core": "1.0.0-rc.28",
|
|
90
|
-
"@hot-updater/server": "1.0.0-rc.
|
|
90
|
+
"@hot-updater/server": "1.0.0-rc.31"
|
|
91
91
|
},
|
|
92
92
|
"inlinedDependencies": {
|
|
93
93
|
"@nodelib/fs.scandir": "2.1.5",
|