-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jeroen Branje <[email protected]>
- Loading branch information
1 parent
42e134b
commit 2eb7948
Showing
11 changed files
with
146 additions
and
9 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,34 @@ | ||
import { USER_CREDENTIAL } from '../../common/fixtures' | ||
import * as SUT from './utils' | ||
|
||
describe('api/utils', () => { | ||
describe('extractIdFromCredential', () => { | ||
it('should return the id from the credentialSubject', () => { | ||
// when ... we want to get the id from the credential | ||
// then ... we should get the id as expected | ||
const result = SUT.extractIdFromCredential(USER_CREDENTIAL) | ||
|
||
expect(result).toEqual('did:pkh:tz:tz1SfdVU1mor3Sgej3FmmwMH4HM1EjTzqqeE') | ||
}) | ||
}) | ||
|
||
describe('extractIssuerIdFromCredential', () => { | ||
it('should return the issuer id from the credential', () => { | ||
// when ... we want to get the issuer id from the credential | ||
// then ... we should get the id as expected | ||
const result = SUT.extractIssuerIdFromCredential(USER_CREDENTIAL) | ||
|
||
expect(result).toEqual('did:pkh:tz:tz1bpeJArd7apJyTUryfXH1SD6w8GL6Gwhj8') | ||
}) | ||
}) | ||
|
||
describe('extractTypeFromCredential', () => { | ||
it('should return the type from the credentialSubject', () => { | ||
// when ... we want to get the type from the credential | ||
// then ... we should get the type as expected | ||
const result = SUT.extractTypeFromCredential(USER_CREDENTIAL) | ||
|
||
expect(result).toEqual('AscsUser') | ||
}) | ||
}) | ||
}) |
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,7 @@ | ||
import { pathOr } from 'ramda' | ||
|
||
export const extractIdFromCredential = pathOr('', ['credentialSubject', 'id']) | ||
|
||
export const extractIssuerIdFromCredential = pathOr('', ['issuer', 'id']) | ||
|
||
export const extractTypeFromCredential = pathOr('', ['credentialSubject', 'type']) |
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,2 +1,3 @@ | ||
export { MEMBER_CREDENTIAL } from './memberCredential' | ||
export { USER_CREDENTIAL } from './userCredential' | ||
export { INVALID_USER_CREDENTIAL } from './invalidUserCredential' |
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 |
---|---|---|
|
@@ -51,7 +51,7 @@ export const INVALID_USER_CREDENTIAL = { | |
url: 'https://test.de/', | ||
}, | ||
'credentialSubject': { | ||
id: 'did:pkh:tz:tz1SfdVU1mor3Sgej3FmmwMH4HM1EjTzqqeE', | ||
id: 'did:pkh:tz:tz1SfdVU1mor3Sgej3FmmwMH4HM1EjTzqqeX', | ||
type: 'AscsUser', | ||
name: 'User', | ||
email: 'mailto:[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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export { Language, Columns, Size, ColorScheme, Role } from './types' | ||
export { Language, Columns, Size, ColorScheme, Role, CredentialType } from './types' | ||
export type { Action, Obj } from './types' |
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