@cavulsqa/create 2.2.0 → 2.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cavulsqa/create",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "Create a Vue + Framework7 + Capacitor + SQLite app from the cavulsqa templates.",
5
5
  "keywords": [
6
6
  "capacitor",
@@ -52,7 +52,7 @@
52
52
  }
53
53
  ]
54
54
  },
55
- "templatesFingerprint": "sha256-dj3zUrK7OwVRIwWJcrX/7pxRo/LsGJDBMolhJNIihUs=",
55
+ "templatesFingerprint": "sha256-9dD3cJPCgdO6nEfyea3vG2eZNUNd4gzbYnde1KPIZIM=",
56
56
  "scripts": {
57
57
  "build": "node scripts/bundleTemplates.mjs",
58
58
  "check": "vp check",
@@ -29,7 +29,8 @@ import {
29
29
  * There is deliberately no in-memory entry. A chain that silently ends somewhere data is not kept is
30
30
  * worse than one that fails and says why, and the error screen names every attempt.
31
31
  */
32
- const DEFAULT_ORDER: StorageCandidate[] = [
32
+ /** The ranking, before any environment preference reorders it. */
33
+ export const DEFAULT_ORDER: StorageCandidate[] = [
33
34
  opfsSahPool,
34
35
  waAccessHandlePool,
35
36
  waOriginPrivateFileSystem,
@@ -1,5 +1,5 @@
1
1
  import { afterEach, expect, test } from "vite-plus/test";
2
- import { storageChain } from "../src/app/storage.config.js";
2
+ import { DEFAULT_ORDER, storageChain } from "../src/app/storage.config.js";
3
3
  import {
4
4
  describeOpenFailure,
5
5
  MINIMUM_CHROMIUM_FOR_OPFS,
@@ -59,10 +59,19 @@ test("an open failure is translated into something actionable", () => {
59
59
  */
60
60
  test("the storage chain is ordered and honest about what each entry costs", () => {
61
61
  expect(storageChain.length).toBeGreaterThan(0);
62
- expect(storageChain[0]?.id).toBe("sqlite-wasm-opfs-sahpool");
63
- expect(storageChain[0]?.evidence).toBe("measured");
64
62
 
65
- for (const candidate of storageChain) {
63
+ // The ranking is asserted against the default order, not the live chain: VITE_STORAGE_ENGINE
64
+ // reorders the chain on purpose, and a generated app that chose another engine is not broken.
65
+ expect(DEFAULT_ORDER[0]?.id).toBe("sqlite-wasm-opfs-sahpool");
66
+ expect(DEFAULT_ORDER[0]?.evidence).toBe("measured");
67
+
68
+ // Whatever the environment asked for, the chain must still be every candidate exactly once -
69
+ // promoting one may not drop the others, or the fallback silently disappears.
70
+ expect([...storageChain].sort((a, b) => (a.id < b.id ? -1 : 1))).toEqual(
71
+ [...DEFAULT_ORDER].sort((a, b) => (a.id < b.id ? -1 : 1)),
72
+ );
73
+
74
+ for (const candidate of DEFAULT_ORDER) {
66
75
  expect(candidate.tradeoff.length, candidate.id).toBeGreaterThan(20);
67
76
  expect(candidate.label.length, candidate.id).toBeGreaterThan(5);
68
77
  }