Skip to content

Commit

Permalink
DPP-96 test improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Brummos committed Dec 11, 2023
1 parent 7b91333 commit d19d846
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
45 changes: 23 additions & 22 deletions packages/ms-authenticator/__tests__/authenticators.test.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
import { getMSClientCredentialAccessToken, UsernamePasswordAuthenticator } from '../src'
import * as process from 'process'
import { AuthenticationResult } from '@azure/msal-node'
import { getMSClientCredentialAccessToken, UsernamePasswordAuthenticator } from '../src'
jest.setTimeout(100000)

describe('@sphereon/ssi-sdk.ms-authenticator', () => {
it('should authenticate using clientCredential', async () => {
return await expect(
getMSClientCredentialAccessToken({
azClientId: process.env.SPHEREON_SSI_MSAL_CLIENT_ID || 'client_id',
azClientSecret: process.env.SPHEREON_SSI_MSAL_CLIENT_SECRET || 'client_secret',
azTenantId: process.env.SPHEREON_SSI_MSAL_TENANT_ID || 'tenant_id',
credentialManifestUrl:
'https://beta.eu.did.msidentity.com/v1.0/e2a42b2f-7460-4499-afc2-425315ef058a/verifiableCredential/contracts/VerifiedCredentialExpert2',
})
).resolves.toBeDefined()
describe('@sphereon/ssi-sdk.ms-authenticator', (): void => {
it('should authenticate using clientCredential', async (): Promise<void> => {
const result: AuthenticationResult = await getMSClientCredentialAccessToken({
azClientId: process.env.SPHEREON_SSI_MSAL_CLIENT_ID ?? 'client_id',
azClientSecret: process.env.SPHEREON_SSI_MSAL_CLIENT_SECRET ?? 'client_secret',
azTenantId: process.env.SPHEREON_SSI_MSAL_TENANT_ID ?? 'tenant_id',
credentialManifestUrl:
'https://beta.eu.did.msidentity.com/v1.0/e2a42b2f-7460-4499-afc2-425315ef058a/verifiableCredential/contracts/VerifiedCredentialExpert2',
})

expect(result).toBeDefined()
})

it('should authenticate using usernamePassword', async () => {
return await expect(
UsernamePasswordAuthenticator({
azTenantId: process.env.SPHEREON_SSI_MSAL_TENANT_ID || 'tenant_id',
azClientId: process.env.SPHEREON_SSI_MSAL_CLIENT_ID || 'client_id',
scopes: ['user.read'],
username: process.env.SPHEREON_SSI_MSAL_USERNAME || 'username',
password: process.env.SPHEREON_SSI_MSAL_PASSWORD || 'password',
})
).resolves.toBeDefined()
it('should authenticate using usernamePassword', async (): Promise<void> => {
const result: string = await UsernamePasswordAuthenticator({
azTenantId: process.env.SPHEREON_SSI_MSAL_TENANT_ID ?? 'tenant_id',
azClientId: process.env.SPHEREON_SSI_MSAL_CLIENT_ID ?? 'client_id',
scopes: ['user.read'],
username: process.env.SPHEREON_SSI_MSAL_USERNAME ?? 'username',
password: process.env.SPHEREON_SSI_MSAL_PASSWORD ?? 'password',
})

expect(result).toBeDefined()
})
})
2 changes: 1 addition & 1 deletion packages/web3-provider-headless/src/rpc-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export function createRpcServer(
return next()
}
)
express.use(opts.basePath ?? '', router)
express.use(opts?.basePath ?? '', router)
}

export function createServiceMethod(method: string, service: Record<string, Function>, provider: EthersHeadlessProvider) {
Expand Down

0 comments on commit d19d846

Please sign in to comment.