@pod-os/elements 0.42.0-rc.4e559a9.0 → 0.42.0-rc.5e6c109.0
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.
|
@@ -7,9 +7,13 @@ vi.mock('../pod-os', () => ({
|
|
|
7
7
|
createPodOS: vi.fn(),
|
|
8
8
|
}));
|
|
9
9
|
vi.mock('../authentication', () => ({
|
|
10
|
-
BrowserSession: vi.fn().
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
BrowserSession: vi.fn().mockImplementation(
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
class {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.onSessionRestore = () => { };
|
|
15
|
+
this.handleIncomingRedirect = vi.fn();
|
|
16
|
+
}
|
|
13
17
|
}),
|
|
14
18
|
}));
|
|
15
19
|
vi.mock('../components/events/usePodOS');
|
|
@@ -37,6 +41,7 @@ export function mockPodOS() {
|
|
|
37
41
|
login: vi.fn().mockImplementation(() => {
|
|
38
42
|
sessionInfo$.next({ isLoggedIn: true, webId: alice.webId });
|
|
39
43
|
}),
|
|
44
|
+
logout: vi.fn(),
|
|
40
45
|
proposeUriForNewThing: vi.fn(),
|
|
41
46
|
addNewThing: vi.fn().mockResolvedValue(undefined),
|
|
42
47
|
fetchProfile: vi.fn(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mockPodOS.vitest.js","sourceRoot":"","sources":["../../../src/test/mockPodOS.vitest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,EAAE,EAAE,MAAM,QAAQ,CAAC;AAElC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAEzD,EAAE,CAAC,IAAI,CAAC,W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AAc,GAAG,IAAI,aAAa,EAAU,CAAC;IACnD,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC;SACf,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC;SACvB,UAAU,CAAC;QACV,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI;QACvB,YAAY,EAAE,GAAG,EAAE,CAAC,cAAc;QAClC,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;YACd,GAAG,EAAE,KAAK,CAAC,OAAO;SACnB,CAAC;KACH,CAAC,CAAC;IACJ,WAAoB,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IACzC,QAAiB,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;IAEzC,OAAO,EAAsB,CAAC;AAChC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,EAAkB;IAC/C,QAAQ,CAAC,gBAAgB,CACvB,aAAa,EACb,CAAC,KAAU,EAAE,EAAE;QACb,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACnB,CAAC,EACD,EAAE,IAAI,EAAE,IAAI,EAAE,CACf,CAAC;AACJ,CAAC","sourcesContent":["import { Mock, vi } from 'vitest';\nimport { PodOS } from '@pod-os/core';\nimport { when } from 'vitest-when';\nimport { BehaviorSubject, ReplaySubject } from 'rxjs';\nimport { createPodOS } from '../pod-os';\nimport { usePodOS } from '../components/events/usePodOS';\n\nvi.mock('../pod-os', () => ({\n createPodOS: vi.fn(),\n}));\n\nvi.mock('../authentication', () => ({\n BrowserSession: vi.fn().mockImplementation(\n // @ts-ignore\n class {\n onSessionRestore = () => {};\n handleIncomingRedirect = vi.fn();\n },\n ),\n}));\n\nvi.mock('../components/events/usePodOS');\n\nconst alice = {\n webId: 'https://pod.example/alice#me',\n name: 'Alice',\n picture: 'https://pod.example/alice/me.jpg',\n};\n\nexport function mockPodOS(): PodOS {\n const sessionInfo$ = new BehaviorSubject({ isLoggedIn: false, webId: '' });\n const fileFetcher = {\n fetchFile: vi.fn(),\n putFile: vi.fn(),\n createNewFile: vi.fn().mockResolvedValue(undefined),\n createNewFolder: vi.fn().mockResolvedValue(undefined),\n };\n const os = {\n fetch: vi.fn(),\n files: () => fileFetcher,\n store: {\n get: vi.fn(),\n observeFindMembers: vi.fn(),\n },\n observeSession: () => sessionInfo$,\n login: vi.fn().mockImplementation(() => {\n sessionInfo$.next({ isLoggedIn: true, webId: alice.webId });\n }),\n logout: vi.fn(),\n proposeUriForNewThing: vi.fn(),\n addNewThing: vi.fn().mockResolvedValue(undefined),\n fetchProfile: vi.fn(),\n buildSearchIndex: vi.fn(),\n proposeAppsFor: vi.fn().mockReturnValue([]),\n addPropertyValue: vi.fn(),\n addRelation: vi.fn(),\n };\n const observedLabel$ = new ReplaySubject<string>();\n observedLabel$.next(alice.name);\n when(os.store.get)\n .calledWith(alice.webId)\n .thenReturn({\n label: () => alice.name,\n observeLabel: () => observedLabel$,\n picture: () => ({\n url: alice.picture,\n }),\n });\n (createPodOS as Mock).mockReturnValue(os);\n (usePodOS as Mock).mockResolvedValue(os);\n\n return os as unknown as PodOS;\n}\n\n/**\n * Respond to pod-os:init event with the given os instance\n * @param os\n */\nexport function mockOsProvider(os: Partial<PodOS>) {\n document.addEventListener(\n 'pod-os:init',\n (event: any) => {\n event.detail(os);\n },\n { once: true }, // only once to prevent test pollution\n );\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { setupServer } from "msw/node";
|
|
2
|
+
import { http, HttpResponse } from "msw";
|
|
3
|
+
export const server = setupServer();
|
|
4
|
+
export function turtleFile(url, content, { delayedUntil = Promise.resolve() } = {}) {
|
|
5
|
+
return http.get(url, async () => {
|
|
6
|
+
const response = HttpResponse.text(content);
|
|
7
|
+
response.headers.set('Content-Type', 'text/turtle');
|
|
8
|
+
await delayedUntil;
|
|
9
|
+
return response;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export function notFound(url) {
|
|
13
|
+
return http.get(url, async () => {
|
|
14
|
+
return HttpResponse.text('Not found', {
|
|
15
|
+
status: 404,
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=msw.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"msw.js","sourceRoot":"","sources":["../../../src/test/msw.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AAEzC,MAAM,CAAC,MAAM,MAAM,GAAG,WAAW,EAAE,CAAC;AAMpC,MAAM,UAAU,UAAU,CAAC,GAAW,EAAE,OAAe,EAAE,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,EAAE,KAAc,EAAE;IACzG,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,IAAI,EAAE;QAC9B,MAAM,QAAQ,GAAG,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5C,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC;QACpD,MAAM,YAAY,CAAC;QACnB,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,GAAW;IAClC,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,IAAI,EAAE;QAC9B,OAAO,YAAY,CAAC,IAAI,CAAC,WAAW,EAAE;YACpC,MAAM,EAAE,GAAG;SACZ,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { setupServer } from 'msw/node';\nimport { http, HttpResponse } from 'msw';\n\nexport const server = setupServer();\n\ninterface Options {\n delayedUntil?: Promise<void>;\n}\n\nexport function turtleFile(url: string, content: string, { delayedUntil = Promise.resolve() }: Options = {}) {\n return http.get(url, async () => {\n const response = HttpResponse.text(content);\n response.headers.set('Content-Type', 'text/turtle');\n await delayedUntil;\n return response;\n });\n}\n\nexport function notFound(url: string) {\n return http.get(url, async () => {\n return HttpResponse.text('Not found', {\n status: 404,\n });\n });\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const server: import("msw/node").SetupServer;
|
|
2
|
+
interface Options {
|
|
3
|
+
delayedUntil?: Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
export declare function turtleFile(url: string, content: string, { delayedUntil }?: Options): import("msw").HttpHandler;
|
|
6
|
+
export declare function notFound(url: string): import("msw").HttpHandler;
|
|
7
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pod-os/elements",
|
|
3
|
-
"version": "0.42.0-rc.
|
|
3
|
+
"version": "0.42.0-rc.5e6c109.0",
|
|
4
4
|
"description": "Custom elements for usage with Solid Pods",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"type": "module",
|
|
@@ -19,14 +19,16 @@
|
|
|
19
19
|
"scripts": {
|
|
20
20
|
"build": "stencil build --docs",
|
|
21
21
|
"start": "stencil build --dev --watch --serve",
|
|
22
|
-
"test": "npm run jest && npm run vitest",
|
|
22
|
+
"test": "npm run jest && npm run vitest:unit && npm run vitest:integration",
|
|
23
23
|
"jest": "jest ./src",
|
|
24
24
|
"vitest": "vitest run",
|
|
25
|
+
"vitest:unit": "vitest run --project unit-dom --project unit",
|
|
26
|
+
"vitest:integration": "stencil-test --prod --project integration-dom",
|
|
25
27
|
"vitest:watch": "vitest",
|
|
26
28
|
"generate": "stencil generate"
|
|
27
29
|
},
|
|
28
30
|
"dependencies": {
|
|
29
|
-
"@pod-os/core": "v0.31.0-rc.
|
|
31
|
+
"@pod-os/core": "v0.31.0-rc.5e6c109.0",
|
|
30
32
|
"@shoelace-style/shoelace": "^2.20.1",
|
|
31
33
|
"@stencil/core": "^4.43.2",
|
|
32
34
|
"@stencil/store": "^2.2.2",
|
|
@@ -58,6 +60,7 @@
|
|
|
58
60
|
"jest": "^30.3.0",
|
|
59
61
|
"jest-cli": "^30.3.0",
|
|
60
62
|
"jest-when": "^3.7.0",
|
|
63
|
+
"msw": "^2.14.6",
|
|
61
64
|
"prettier": "^3.5.3",
|
|
62
65
|
"url-template": "^3.1.1",
|
|
63
66
|
"vitest": "^4.1.8",
|