Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OCM-Engine
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Harbor Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eclipse Projects
xfsc
Organization Credential Manager
OCM-Engine
Merge requests
!29
feat(ssi): crud proof events
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
feat(ssi): crud proof events
tsabolov/ocm-engine:ssi-proof-functionality
into
main
Overview
0
Commits
3
Pipelines
0
Changes
8
Merged
Berend Sliedrecht
requested to merge
tsabolov/ocm-engine:ssi-proof-functionality
into
main
1 year ago
Overview
0
Commits
3
Pipelines
0
Changes
8
Expand
Signed-off-by: Berend Sliedrecht
berend@animo.id
0
0
Merge request reports
Viewing commit
cdd7f57a
Show latest version
8 files
+
468
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
8
Search (e.g. *.vue) (Ctrl+P)
cdd7f57a
feat(credential-manager): add credential requests module
· cdd7f57a
Konstantin Tsabolov
authored
1 year ago
apps/credential-manager/src/credential-requests/__tests__/credential-requests.controller.spec.ts
0 → 100644
+
90
−
0
Options
import
type
{
TestingModule
}
from
'
@nestjs/testing
'
;
import
type
{
EventAnonCredsCredentialRequestGetAll
,
EventAnonCredsCredentialRequestGetById
,
}
from
'
@ocm/shared
'
;
import
{
Test
}
from
'
@nestjs/testing
'
;
import
{
Subject
,
of
,
takeUntil
}
from
'
rxjs
'
;
import
{
NATS_CLIENT
}
from
'
../../common/constants.js
'
;
import
{
CredentialRequestsController
}
from
'
../credential-requests.controller.js
'
;
import
{
CredentialRequestsService
}
from
'
../credential-requests.service.js
'
;
describe
(
'
CredentialRequestsController
'
,
()
=>
{
const
natsClientMock
=
{};
let
controller
:
CredentialRequestsController
;
let
service
:
CredentialRequestsService
;
beforeEach
(
async
()
=>
{
const
module
:
TestingModule
=
await
Test
.
createTestingModule
({
controllers
:
[
CredentialRequestsController
],
providers
:
[
{
provide
:
NATS_CLIENT
,
useValue
:
natsClientMock
},
CredentialRequestsService
,
],
}).
compile
();
controller
=
module
.
get
<
CredentialRequestsController
>
(
CredentialRequestsController
,
);
service
=
module
.
get
<
CredentialRequestsService
>
(
CredentialRequestsService
);
});
describe
(
'
find
'
,
()
=>
{
it
(
'
should return a list of credential requests
'
,
(
done
)
=>
{
const
unsubscribe$
=
new
Subject
<
void
>
();
const
tenantId
=
'
exampleTenantId
'
;
const
expectedResult
:
EventAnonCredsCredentialRequestGetAll
[
'
data
'
]
=
[];
jest
.
spyOn
(
service
,
'
findCredentialRequests
'
)
.
mockReturnValueOnce
(
of
(
expectedResult
));
controller
.
find
({
tenantId
})
.
pipe
(
takeUntil
(
unsubscribe$
))
.
subscribe
((
result
)
=>
{
expect
(
result
).
toStrictEqual
(
expectedResult
);
unsubscribe$
.
next
();
unsubscribe$
.
complete
();
done
();
});
});
});
describe
(
'
getById
'
,
()
=>
{
it
(
'
should return a credential request
'
,
(
done
)
=>
{
const
unsubscribe$
=
new
Subject
<
void
>
();
const
tenantId
=
'
exampleTenantId
'
;
const
credentialRequestId
=
'
exampleCredentialRequestId
'
;
const
expectedResult
:
EventAnonCredsCredentialRequestGetById
[
'
data
'
]
=
{
blinded_ms
:
{},
blinded_ms_correctness_proof
:
{},
cred_def_id
:
'
cred_def_id
'
,
nonce
:
'
nonce
'
,
entropy
:
'
entropy
'
,
prover_did
:
'
prover_did
'
,
};
jest
.
spyOn
(
service
,
'
getCredentialRequestById
'
)
.
mockReturnValueOnce
(
of
(
expectedResult
));
controller
.
getById
({
credentialRequestId
},
{
tenantId
})
.
pipe
(
takeUntil
(
unsubscribe$
))
.
subscribe
((
result
)
=>
{
expect
(
result
).
toStrictEqual
(
expectedResult
);
unsubscribe$
.
next
();
unsubscribe$
.
complete
();
done
();
});
});
});
});
Loading