@namiml/web-sdk 3.3.9-dev.202603180144 → 3.3.9-dev.202603180145

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.
Files changed (2) hide show
  1. package/README.md +26 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -33,6 +33,32 @@ Example apps showing how to use the SDK are available in our [Nami Web SDK repo]
33
33
 
34
34
  More information on configuring and using the SDK is available in our docs at [https://learn.namiml.com](https://learn.namiml.com).
35
35
 
36
+ ## Testing
37
+
38
+ Unit tests live in `tests/unit/` and mirror the `src/` directory structure. Run them with:
39
+
40
+ ```bash
41
+ yarn test
42
+ ```
43
+
44
+ ### Test infrastructure
45
+
46
+ The suite uses two transformers side-by-side, each with a distinct role:
47
+
48
+ | Tool | Role | What it handles |
49
+ |---|---|---|
50
+ | **ts-jest** | TypeScript transformer | All `.ts` test files and source files — compiles TypeScript to CommonJS for Jest |
51
+ | **babel-jest** | JavaScript transformer | Third-party ESM packages from `node_modules` (Lit, `@open-wc`, `@esm-bundle/chai`, `lodash-es`, etc.) that Jest cannot run as-is because they ship as native ES modules |
52
+ | **@open-wc/testing** | Web Component test utilities | `fixture()` for rendering Lit components into a real jsdom DOM, `elementUpdated()` for awaiting Lit update cycles, and semantic DOM diff assertions (`expect(el).dom.to.equal(…)`) |
53
+
54
+ `transformIgnorePatterns` in `jest.config.mjs` lists the packages that babel-jest must transform (all others in `node_modules` are skipped). `babel.config.jest.cjs` configures the babel presets and plugins used for those transformations.
55
+
56
+ ### Strategy for new tests
57
+
58
+ - **Pure logic** (services, repositories, utilities, managers): use ts-jest only. Import the class under test directly. No `@open-wc/testing` needed.
59
+ - **Web Components** (anything in `src/components/`): use `fixture()` from `@open-wc/testing` to mount the component in jsdom and `elementUpdated()` to wait for Lit's render cycle before asserting. See any existing file in `tests/unit/components/` for the pattern.
60
+ - Do not add new packages to `transformIgnorePatterns` without also verifying that `babel.config.jest.cjs` can transform them. New ESM-only packages may require additional babel plugins.
61
+
36
62
  ## Legacy support
37
63
 
38
64
  To support older browsers, import our side-effect module before you import the SDK. It installs the necessary polyfills and shims, allowing the main entry point to stay the same for every app.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@namiml/web-sdk",
3
3
  "type": "module",
4
- "version": "3.3.9-dev.202603180144",
4
+ "version": "3.3.9-dev.202603180145",
5
5
  "source": "src/nami-web.ts",
6
6
  "description": "Subscription monetization infrastructure — drop-in SDK with no-code paywalls, onboarding flows, A/B testing for web",
7
7
  "scripts": {