-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: tests Signed-off-by: Mirko Mollik <[email protected]> * setup deps before run Signed-off-by: Mirko Mollik <[email protected]> * fix: tests Signed-off-by: Mirko Mollik <[email protected]> --------- Signed-off-by: Mirko Mollik <[email protected]>
- Loading branch information
Showing
20 changed files
with
201 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { | ||
Keycloak, | ||
HolderBackend, | ||
HolderFrontend, | ||
IssuerBackend, | ||
VerifierBackend, | ||
} from '@credhub/testing'; | ||
import { appendFileSync } from 'fs'; | ||
|
||
export interface GlobalConfig { | ||
holderFrontendPort: number; | ||
keycloakPort: number; | ||
verifierPort: number; | ||
issuerPort: number; | ||
} | ||
|
||
export const CONFIG_KEY = 'CONFIG'; | ||
|
||
export interface GlobalThisConfig { | ||
config: { | ||
keycloak: Keycloak; | ||
holderBackend: HolderBackend; | ||
holderFrontend: HolderFrontend; | ||
issuerBackend: IssuerBackend; | ||
verifierBackend: VerifierBackend; | ||
}; | ||
} | ||
|
||
export default async function globalSetup() { | ||
if (process.env['NO_CONTAINER']) { | ||
process.env[CONFIG_KEY] = JSON.stringify({ | ||
holderFrontendPort: 4200, | ||
keycloakPort: 8080, | ||
verifierPort: 3002, | ||
issuerPort: 3001, | ||
} as GlobalConfig); | ||
} | ||
|
||
const keycloak = await Keycloak.init(); | ||
const holderBackend = await HolderBackend.init(keycloak); | ||
const holderFrontend = await HolderFrontend.init(holderBackend); | ||
const issuerBackend = await IssuerBackend.init(keycloak); | ||
const verifierBackend = await VerifierBackend.init(keycloak); | ||
const holderFrontendPort = holderFrontend.instance.getMappedPort(80); | ||
const keycloakPort = keycloak.instance.getMappedPort(8080); | ||
const verifierPort = verifierBackend.instance.getMappedPort(3000); | ||
const issuerPort = issuerBackend.instance.getMappedPort(3000); | ||
process.env[CONFIG_KEY] = JSON.stringify({ | ||
holderFrontendPort, | ||
keycloakPort, | ||
verifierPort, | ||
issuerPort, | ||
} as GlobalConfig); | ||
(globalThis as unknown as GlobalThisConfig).config = { | ||
keycloak, | ||
holderBackend, | ||
holderFrontend, | ||
issuerBackend, | ||
verifierBackend, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { GlobalThisConfig } from './global-setup'; | ||
|
||
export default async function globalTeardown() { | ||
if (process.env['NO_CONTAINER']) { | ||
return; | ||
} | ||
const config = (globalThis as unknown as GlobalThisConfig).config; | ||
await config.keycloak.stop(); | ||
await config.holderBackend.stop(); | ||
await config.holderFrontend.stop(); | ||
await config.issuerBackend.stop(); | ||
await config.verifierBackend.stop(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
{ | ||
"dependencies": { | ||
"@sphereon/pex": "^3.3.3", | ||
"@sphereon/oid4vci-client": "^0.14.0", | ||
"pg": "^8.11.5" | ||
}, | ||
"pnpm": { | ||
"patchedDependencies": { | ||
"@sphereon/[email protected]": "patches/@[email protected]" | ||
"@sphereon/[email protected]": "patches/@[email protected]", | ||
"@sphereon/[email protected]": "patches/@[email protected]" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,13 +3,14 @@ | |
"sqlite3": "^5.1.7", | ||
"pg": "^8.11.5", | ||
"@sphereon/pex": "^3.3.3", | ||
"@sphereon/oid4vci-issuer": "^0.12.0", | ||
"@sphereon/ssi-express-support": "0.26.0" | ||
"@sphereon/ssi-express-support": "0.26.0", | ||
"@sphereon/oid4vci-issuer": "^0.14.0" | ||
}, | ||
"pnpm": { | ||
"patchedDependencies": { | ||
"@sphereon/[email protected]": "patches/@[email protected]", | ||
"@sphereon/[email protected]": "patches/@[email protected]" | ||
"@sphereon/[email protected]": "patches/@[email protected]", | ||
"@sphereon/[email protected]": "patches/@[email protected]" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.