@hot-updater/test-utils 1.0.0-rc.32 → 1.0.0-rc.36

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 CHANGED
@@ -3277,9 +3277,9 @@ const READ_BUDGETS = [
3277
3277
  },
3278
3278
  intervalMs: DAY
3279
3279
  }),
3280
- adapter: reads(0, 0, 4, 30),
3280
+ adapter: reads(0, 0, 6, 30),
3281
3281
  engine: {
3282
- calls: 4,
3282
+ calls: 6,
3283
3283
  rows: 4
3284
3284
  },
3285
3285
  check: ({ versions }) => expect(versions).toEqual([{
@@ -4517,13 +4517,61 @@ const registerInsightsModelTests = (state) => {
4517
4517
  appVersion: "1.0.0",
4518
4518
  platform: "ios",
4519
4519
  releaseId: releaseA,
4520
+ builtinBundleId: null,
4520
4521
  installations: 1
4521
4522
  }, {
4522
4523
  appVersion: "1.0.0",
4523
4524
  platform: "ios",
4524
4525
  releaseId: releaseB,
4526
+ builtinBundleId: null,
4527
+ installations: 1
4528
+ }]));
4529
+ });
4530
+ it("distributes installations on their native build's built-in bundle by its ID", async () => {
4531
+ const model = state.getDatabase();
4532
+ const channel = "builtin-distribution";
4533
+ const launch = (suffix, bundleId, minBundleId) => {
4534
+ const base = createBundleEventRowFixture(suffix, 1e3);
4535
+ return {
4536
+ ...base,
4537
+ type: "UNCHANGED",
4538
+ channel,
4539
+ from_bundle_id: null,
4540
+ to_bundle_id: bundleId,
4541
+ metadata: {
4542
+ ...base.metadata,
4543
+ update_strategy: null,
4544
+ min_bundle_id: minBundleId
4545
+ }
4546
+ };
4547
+ };
4548
+ const builtin = createBundleEventRowFixture("9901", 0).id;
4549
+ await record(model, launch("9902", builtin, builtin));
4550
+ await record(model, launch("9903", builtin, builtin));
4551
+ await record(model, launch("9904", createBundleEventRowFixture("9905", 0).id, builtin));
4552
+ const usage = await model.getAppUsage({
4553
+ channel,
4554
+ platform: "ios",
4555
+ timeRange: {
4556
+ start: 0,
4557
+ end: 36e5
4558
+ },
4559
+ intervalMs: 36e5
4560
+ });
4561
+ expect(usage.bundleDistribution).toEqual(expect.arrayContaining([{
4562
+ appVersion: "1.0.0",
4563
+ platform: "ios",
4564
+ releaseId: null,
4565
+ builtinBundleId: builtin,
4566
+ installations: 2
4567
+ }, {
4568
+ appVersion: "1.0.0",
4569
+ platform: "ios",
4570
+ releaseId: null,
4571
+ builtinBundleId: null,
4525
4572
  installations: 1
4526
4573
  }]));
4574
+ expect(usage.bundleDistribution).toHaveLength(2);
4527
4575
  });
4528
4576
  it("pages insights events newest first with a stable cursor", async () => {
4529
4577
  const model = state.getDatabase();
@@ -127,6 +127,7 @@ const setupClientPlugins = (plugins, options = {}) => {
127
127
  sdkVersion: options.sdkVersion ?? "0.0.0-test",
128
128
  getInstallId: () => read(options.installId ?? "00000000-0000-4000-8000-000000000000"),
129
129
  getAppVersion: () => read(options.appVersion === void 0 ? "1.0.0" : options.appVersion),
130
+ getMinBundleId: () => options.minBundleId ?? "00000000-0000-0000-0000-000000000000",
130
131
  getBundleId: () => read(options.bundleId ?? "00000000-0000-0000-0000-000000000000"),
131
132
  getChannel: () => read(options.channel ?? "production"),
132
133
  getCohort: () => read(options.cohort ?? "1"),
@@ -26,6 +26,12 @@ interface ClientPluginTestOptions {
26
26
  readonly isDebugBuild?: boolean;
27
27
  /** The running bundle. Default: `00000000-0000-0000-0000-000000000000`. */
28
28
  readonly bundleId?: TestValue<string>;
29
+ /**
30
+ * The native build's built-in bundle. Default:
31
+ * `00000000-0000-0000-0000-000000000000`, so the default bundle is the
32
+ * built-in one.
33
+ */
34
+ readonly minBundleId?: string;
29
35
  /** Default: `production`. */
30
36
  readonly channel?: TestValue<string>;
31
37
  /** Default: `1`. */
@@ -26,6 +26,12 @@ interface ClientPluginTestOptions {
26
26
  readonly isDebugBuild?: boolean;
27
27
  /** The running bundle. Default: `00000000-0000-0000-0000-000000000000`. */
28
28
  readonly bundleId?: TestValue<string>;
29
+ /**
30
+ * The native build's built-in bundle. Default:
31
+ * `00000000-0000-0000-0000-000000000000`, so the default bundle is the
32
+ * built-in one.
33
+ */
34
+ readonly minBundleId?: string;
29
35
  /** Default: `production`. */
30
36
  readonly channel?: TestValue<string>;
31
37
  /** Default: `1`. */
@@ -126,6 +126,7 @@ const setupClientPlugins = (plugins, options = {}) => {
126
126
  sdkVersion: options.sdkVersion ?? "0.0.0-test",
127
127
  getInstallId: () => read(options.installId ?? "00000000-0000-4000-8000-000000000000"),
128
128
  getAppVersion: () => read(options.appVersion === void 0 ? "1.0.0" : options.appVersion),
129
+ getMinBundleId: () => options.minBundleId ?? "00000000-0000-0000-0000-000000000000",
129
130
  getBundleId: () => read(options.bundleId ?? "00000000-0000-0000-0000-000000000000"),
130
131
  getChannel: () => read(options.channel ?? "production"),
131
132
  getCohort: () => read(options.cohort ?? "1"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/test-utils",
3
- "version": "1.0.0-rc.32",
3
+ "version": "1.0.0-rc.36",
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.34",
54
- "@hot-updater/protocol": "^1.0.0-rc.30",
55
- "@hot-updater/plugin-core": "^1.0.0-rc.30",
56
- "@hot-updater/server": "^1.0.0-rc.34"
53
+ "@hot-updater/plugin-insights": "^1.0.0-rc.36",
54
+ "@hot-updater/plugin-core": "^1.0.0-rc.36",
55
+ "@hot-updater/protocol": "^1.0.0-rc.36",
56
+ "@hot-updater/server": "^1.0.0-rc.36"
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.34",
87
- "@hot-updater/protocol": "1.0.0-rc.30",
88
- "@hot-updater/js": "1.0.0-rc.27",
89
- "@hot-updater/server": "1.0.0-rc.34",
90
- "@hot-updater/plugin-core": "1.0.0-rc.30"
86
+ "@hot-updater/plugin-insights": "1.0.0-rc.36",
87
+ "@hot-updater/js": "1.0.0-rc.36",
88
+ "@hot-updater/protocol": "1.0.0-rc.36",
89
+ "@hot-updater/plugin-core": "1.0.0-rc.36",
90
+ "@hot-updater/server": "1.0.0-rc.36"
91
91
  },
92
92
  "inlinedDependencies": {
93
93
  "@nodelib/fs.scandir": "2.1.5",