diff --git a/internal/api/server_test.go b/internal/api/server_test.go index aa7e31f71..3c35279bc 100644 --- a/internal/api/server_test.go +++ b/internal/api/server_test.go @@ -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,