@arsedizioni/ars-utils 22.0.33 → 22.0.35
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/clipper.common/README.md +74 -74
- package/fesm2022/arsedizioni-ars-utils-clipper.common.mjs +996 -678
- package/fesm2022/arsedizioni-ars-utils-clipper.common.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-clipper.ui.mjs +122 -152
- package/fesm2022/arsedizioni-ars-utils-clipper.ui.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-core.mjs +4 -2
- package/fesm2022/arsedizioni-ars-utils-core.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-evolution.common.mjs +13 -8
- package/fesm2022/arsedizioni-ars-utils-evolution.common.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-help.mjs +5 -6
- package/fesm2022/arsedizioni-ars-utils-help.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-support.common.mjs +8 -6
- package/fesm2022/arsedizioni-ars-utils-support.common.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-support.ui.mjs +5 -7
- package/fesm2022/arsedizioni-ars-utils-support.ui.mjs.map +1 -1
- package/package.json +1 -1
- package/types/arsedizioni-ars-utils-clipper.common.d.ts +468 -299
- package/types/arsedizioni-ars-utils-clipper.ui.d.ts +24 -17
- package/types/arsedizioni-ars-utils-evolution.common.d.ts +4 -4
- package/types/arsedizioni-ars-utils-support.common.d.ts +3 -4
package/clipper.common/README.md
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
# Clipper common — Vitest test suite
|
|
2
|
-
|
|
3
|
-
Effective unit-test suite for the `clipper.common` library: the 6 feature services,
|
|
4
|
-
the shared `ClipperCoreService`, the `ClipperService` facade and `ClipperAuthInterceptor`.
|
|
5
|
-
|
|
6
|
-
## What is covered
|
|
7
|
-
|
|
8
|
-
| Spec | Focus |
|
|
9
|
-
| --- | --- |
|
|
10
|
-
| `core.service.spec.ts` | state mutators (`ensureLoginInfo`, `setLoggedIn`, `setTeams`, `updateContext`, `initializeChannels`, `reset`, `clear`), lazy `loginInfo` load, `initialize` (serviceUri/appUri/flags, client-id / embedded, F5 branch), broadcast handlers (`LOGIN_CHANGED`, `LOGOUT` logged-in/out), `ping` |
|
|
11
|
-
| `login.service.spec.ts` | credential + OAuth login, MFA pending, failure, temporary context, `autoLogin`/`autoLogout`, `confirmIdentity`, `logout` (clears session on success **and** error), `newOTP` |
|
|
12
|
-
| `documents.service.spec.ts` | every endpoint, `references`/`referencesFacets` mode routing + `null`, default taxonomy body, dashboard counters, bag parsing (`loadBag`/`addToBag`/`removeFromBag`/`clearBag`) |
|
|
13
|
-
| `account.service.spec.ts` | password/settings, `updateSettings`→`setChannels`, `updateChannelsState`→`setChannelsState`, the moved channel helpers, `updateTrialInfo` guards + both result branches, links |
|
|
14
|
-
| `archive.service.spec.ts` | folders/files endpoints, `exportArchiveFolders` URL building, multipart `importArchiveFolders`/`saveArchiveFile` form data, blob download |
|
|
15
|
-
| `calendar.service.spec.ts` | all deadline endpoints + team storage + ICS export |
|
|
16
|
-
| `collaboration.service.spec.ts` | teams (incl. `adminsOnly` team-storage rule), contacts, notes |
|
|
17
|
-
| `clipper.service.spec.ts` | facade exposes/forwards feature services, re-exports core signals by identity, delegates `initialize`/`ping` |
|
|
18
|
-
| `auth.interceptor.spec.ts` | header decoration, passthrough of non-Clipper URLs, error mapping (0/403/405/410/5xx), `NotifySystemErrors` flag, 5s debounce |
|
|
19
|
-
|
|
20
|
-
## File placement
|
|
21
|
-
|
|
22
|
-
Drop the files into the library mirroring its structure (import paths assume this):
|
|
23
|
-
|
|
24
|
-
```
|
|
25
|
-
common/
|
|
26
|
-
services/ ← *.service.spec.ts + clipper.service.spec.ts
|
|
27
|
-
interceptors/ auth.interceptor.spec.ts
|
|
28
|
-
testing/ ← clipper-test-helpers.ts (shared TestBed harness + fakes)
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
`vitest.config.ts` goes at the package root and `src/test-setup.ts` wherever your
|
|
32
|
-
setup lives — adjust `setupFiles` accordingly. If you already have a Vitest config,
|
|
33
|
-
just merge the `test` block.
|
|
34
|
-
|
|
35
|
-
## Running
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
npm i -D vitest @analogjs/vite-plugin-angular @analogjs/vitest-angular jsdom
|
|
39
|
-
npx vitest run # single run
|
|
40
|
-
npx vitest # watch
|
|
41
|
-
npx vitest run --coverage # coverage
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
`@angular/*` and `@arsedizioni/ars-utils/*` are the library's own dependencies and
|
|
45
|
-
are used as-is (no mocking). Only `BroadcastService` and `SplashService` are replaced
|
|
46
|
-
by controllable test doubles via TestBed providers.
|
|
47
|
-
|
|
48
|
-
## How it works
|
|
49
|
-
|
|
50
|
-
`createHarness()` (in `testing/clipper-test-helpers.ts`) wires a `TestBed` with the
|
|
51
|
-
HTTP testing backend (`HttpTestingController`), all services and the fakes, resets
|
|
52
|
-
storage, and (unless `skipInitialize`) calls `core.initialize()`. It returns every
|
|
53
|
-
service plus the fakes, so a spec reads like:
|
|
54
|
-
|
|
55
|
-
```ts
|
|
56
|
-
const h = createHarness();
|
|
57
|
-
h.documents.query({ text: 'iva' }).subscribe();
|
|
58
|
-
h.http.expectOne(`${h.serviceUri}/documents`).flush(ok({ items: [] }));
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
`FakeBroadcastService.emit(id, data)` pushes inbound bus messages (for the core
|
|
62
|
-
broadcast handler), while `sendMessage` is a spy recording outbound broadcasts —
|
|
63
|
-
the two are decoupled to avoid feedback loops.
|
|
64
|
-
|
|
65
|
-
## Assumptions / notes
|
|
66
|
-
|
|
67
|
-
- `@Service()` is treated as `@Injectable()`-compatible (it is provided through TestBed).
|
|
68
|
-
- The suite was authored against the library sources but **not executed here**, because
|
|
69
|
-
the private `@arsedizioni` packages and the Angular toolchain aren't installed in the
|
|
70
|
-
authoring environment. Run `vitest` in the repo; if `@Service`/zoneless setup needs a
|
|
71
|
-
tweak, it will be in `src/test-setup.ts` only.
|
|
72
|
-
- `initializeChannels`/`updateChannels` mutate the shared `ClipperChannels` constant
|
|
73
|
-
objects (existing library behaviour) — assertions check the produced channel, not
|
|
74
|
-
object identity, to stay robust.
|
|
1
|
+
# Clipper common — Vitest test suite
|
|
2
|
+
|
|
3
|
+
Effective unit-test suite for the `clipper.common` library: the 6 feature services,
|
|
4
|
+
the shared `ClipperCoreService`, the `ClipperService` facade and `ClipperAuthInterceptor`.
|
|
5
|
+
|
|
6
|
+
## What is covered
|
|
7
|
+
|
|
8
|
+
| Spec | Focus |
|
|
9
|
+
| --- | --- |
|
|
10
|
+
| `core.service.spec.ts` | state mutators (`ensureLoginInfo`, `setLoggedIn`, `setTeams`, `updateContext`, `initializeChannels`, `reset`, `clear`), lazy `loginInfo` load, `initialize` (serviceUri/appUri/flags, client-id / embedded, F5 branch), broadcast handlers (`LOGIN_CHANGED`, `LOGOUT` logged-in/out), `ping` |
|
|
11
|
+
| `login.service.spec.ts` | credential + OAuth login, MFA pending, failure, temporary context, `autoLogin`/`autoLogout`, `confirmIdentity`, `logout` (clears session on success **and** error), `newOTP` |
|
|
12
|
+
| `documents.service.spec.ts` | every endpoint, `references`/`referencesFacets` mode routing + `null`, default taxonomy body, dashboard counters, bag parsing (`loadBag`/`addToBag`/`removeFromBag`/`clearBag`) |
|
|
13
|
+
| `account.service.spec.ts` | password/settings, `updateSettings`→`setChannels`, `updateChannelsState`→`setChannelsState`, the moved channel helpers, `updateTrialInfo` guards + both result branches, links |
|
|
14
|
+
| `archive.service.spec.ts` | folders/files endpoints, `exportArchiveFolders` URL building, multipart `importArchiveFolders`/`saveArchiveFile` form data, blob download |
|
|
15
|
+
| `calendar.service.spec.ts` | all deadline endpoints + team storage + ICS export |
|
|
16
|
+
| `collaboration.service.spec.ts` | teams (incl. `adminsOnly` team-storage rule), contacts, notes |
|
|
17
|
+
| `clipper.service.spec.ts` | facade exposes/forwards feature services, re-exports core signals by identity, delegates `initialize`/`ping` |
|
|
18
|
+
| `auth.interceptor.spec.ts` | header decoration, passthrough of non-Clipper URLs, error mapping (0/403/405/410/5xx), `NotifySystemErrors` flag, 5s debounce |
|
|
19
|
+
|
|
20
|
+
## File placement
|
|
21
|
+
|
|
22
|
+
Drop the files into the library mirroring its structure (import paths assume this):
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
common/
|
|
26
|
+
services/ ← *.service.spec.ts + clipper.service.spec.ts
|
|
27
|
+
interceptors/ auth.interceptor.spec.ts
|
|
28
|
+
testing/ ← clipper-test-helpers.ts (shared TestBed harness + fakes)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
`vitest.config.ts` goes at the package root and `src/test-setup.ts` wherever your
|
|
32
|
+
setup lives — adjust `setupFiles` accordingly. If you already have a Vitest config,
|
|
33
|
+
just merge the `test` block.
|
|
34
|
+
|
|
35
|
+
## Running
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm i -D vitest @analogjs/vite-plugin-angular @analogjs/vitest-angular jsdom
|
|
39
|
+
npx vitest run # single run
|
|
40
|
+
npx vitest # watch
|
|
41
|
+
npx vitest run --coverage # coverage
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
`@angular/*` and `@arsedizioni/ars-utils/*` are the library's own dependencies and
|
|
45
|
+
are used as-is (no mocking). Only `BroadcastService` and `SplashService` are replaced
|
|
46
|
+
by controllable test doubles via TestBed providers.
|
|
47
|
+
|
|
48
|
+
## How it works
|
|
49
|
+
|
|
50
|
+
`createHarness()` (in `testing/clipper-test-helpers.ts`) wires a `TestBed` with the
|
|
51
|
+
HTTP testing backend (`HttpTestingController`), all services and the fakes, resets
|
|
52
|
+
storage, and (unless `skipInitialize`) calls `core.initialize()`. It returns every
|
|
53
|
+
service plus the fakes, so a spec reads like:
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
const h = createHarness();
|
|
57
|
+
h.documents.query({ text: 'iva' }).subscribe();
|
|
58
|
+
h.http.expectOne(`${h.serviceUri}/documents`).flush(ok({ items: [] }));
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`FakeBroadcastService.emit(id, data)` pushes inbound bus messages (for the core
|
|
62
|
+
broadcast handler), while `sendMessage` is a spy recording outbound broadcasts —
|
|
63
|
+
the two are decoupled to avoid feedback loops.
|
|
64
|
+
|
|
65
|
+
## Assumptions / notes
|
|
66
|
+
|
|
67
|
+
- `@Service()` is treated as `@Injectable()`-compatible (it is provided through TestBed).
|
|
68
|
+
- The suite was authored against the library sources but **not executed here**, because
|
|
69
|
+
the private `@arsedizioni` packages and the Angular toolchain aren't installed in the
|
|
70
|
+
authoring environment. Run `vitest` in the repo; if `@Service`/zoneless setup needs a
|
|
71
|
+
tweak, it will be in `src/test-setup.ts` only.
|
|
72
|
+
- `initializeChannels`/`updateChannels` mutate the shared `ClipperChannels` constant
|
|
73
|
+
objects (existing library behaviour) — assertions check the produced channel, not
|
|
74
|
+
object identity, to stay robust.
|