mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
feat: Full rework of account management
Complete rewrite of the account management and related systems. Makes the architecture more modular, allowing for easier extensions and configurations.
This commit is contained in:
24
test/unit/identity/IdentityUtil.test.ts
Normal file
24
test/unit/identity/IdentityUtil.test.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { importOidcProvider } from '../../../src/identity/IdentityUtil';
|
||||
|
||||
describe('IdentityUtil', (): void => {
|
||||
it('avoids dynamic imports when testing with Jest.', async(): Promise<void> => {
|
||||
const oidc = await importOidcProvider();
|
||||
expect(oidc.default).toBeDefined();
|
||||
expect(oidc.interactionPolicy).toBeDefined();
|
||||
});
|
||||
|
||||
it('imports the oidc-provider package when not running jest.', async(): Promise<void> => {
|
||||
// We need to fool the IDP factory into thinking we are not in a test run
|
||||
const jestWorkerId = process.env.JEST_WORKER_ID;
|
||||
const nodeEnv = process.env.NODE_ENV;
|
||||
delete process.env.JEST_WORKER_ID;
|
||||
delete process.env.NODE_ENV;
|
||||
|
||||
const oidc = await importOidcProvider();
|
||||
expect(oidc.default).toBeDefined();
|
||||
expect(oidc.interactionPolicy).toBeDefined();
|
||||
|
||||
process.env.JEST_WORKER_ID = jestWorkerId;
|
||||
process.env.NODE_ENV = nodeEnv;
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user