Skip to content

Commit

Permalink
chore: add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
martinsaporiti committed Jun 26, 2024
1 parent bf6679c commit 6c462da
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions internal/api/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,76 @@ func TestServer_CreateClaim(t *testing.T) {
createCredentialEventsCount: 1,
},
},
{
name: "Happy path with two proofs",
auth: authOk,
did: did,
body: CreateClaimRequest{
CredentialSchema: "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json",
Type: "KYCAgeCredential",
CredentialSubject: map[string]any{
"id": "did:polygonid:polygon:mumbai:2qFDkNkWePjd6URt6kGQX14a7wVKhBZt8bpy7HZJZi",
"birthday": 19960425,
"documentType": 2,
},
Expiration: common.ToPointer(time.Now().Unix()),
Proofs: &[]CreateClaimRequestProofs{
"BJJSignature2021",
"Iden3SparseMerkleTreeProof",
},
},
expected: expected{
response: CreateClaim201JSONResponse{},
httpCode: http.StatusCreated,
createCredentialEventsCount: 1,
},
},
{
name: "Happy path with bjjSignature proof",
auth: authOk,
did: did,
body: CreateClaimRequest{
CredentialSchema: "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json",
Type: "KYCAgeCredential",
CredentialSubject: map[string]any{
"id": "did:polygonid:polygon:mumbai:2qFDkNkWePjd6URt6kGQX14a7wVKhBZt8bpy7HZJZi",
"birthday": 19960425,
"documentType": 2,
},
Expiration: common.ToPointer(time.Now().Unix()),
Proofs: &[]CreateClaimRequestProofs{
"BJJSignature2021",
},
},
expected: expected{
response: CreateClaim201JSONResponse{},
httpCode: http.StatusCreated,
createCredentialEventsCount: 1,
},
},
{
name: "Happy path with Iden3SparseMerkleTreeProof proof",
auth: authOk,
did: did,
body: CreateClaimRequest{
CredentialSchema: "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json",
Type: "KYCAgeCredential",
CredentialSubject: map[string]any{
"id": "did:polygonid:polygon:mumbai:2qFDkNkWePjd6URt6kGQX14a7wVKhBZt8bpy7HZJZi",
"birthday": 19960425,
"documentType": 2,
},
Expiration: common.ToPointer(time.Now().Unix()),
Proofs: &[]CreateClaimRequestProofs{
"Iden3SparseMerkleTreeProof",
},
},
expected: expected{
response: CreateClaim201JSONResponse{},
httpCode: http.StatusCreated,
createCredentialEventsCount: 0,
},
},
{
name: "Happy path with ipfs schema",
auth: authOk,
Expand Down

0 comments on commit 6c462da

Please sign in to comment.