Skip to content

Commit d9b5a4e

Browse files
committed
test: mock @uvdsl/solid-oidc-client-browser (uses import.meta.url, not parseable by jest/jsdom)
1 parent e394fb9 commit d9b5a4e

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

test/helpers/setup.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,21 @@ import { TextEncoder, TextDecoder } from 'util'
44
global.TextEncoder = TextEncoder as any
55
global.TextDecoder = TextDecoder as any
66

7-
fetchMock.enableMocks()
7+
fetchMock.enableMocks()
8+
9+
// @uvdsl/solid-oidc-client-browser uses `import.meta.url` (for its
10+
// SharedWorker URL), which jest/jsdom cannot evaluate. Stub the module
11+
// surface used by the adapter so SolidAuthnLogic can be unit-tested.
12+
jest.mock('@uvdsl/solid-oidc-client-browser', () => {
13+
class Session {
14+
isActive = false
15+
webId = undefined
16+
async login() {}
17+
async logout() {}
18+
async handleRedirectFromLogin() {}
19+
async restore() {}
20+
authFetch(input: any, init?: any) { return fetch(input, init) }
21+
}
22+
class SessionIDB {}
23+
return { Session, SessionIDB }
24+
}, { virtual: true })

0 commit comments

Comments
 (0)