Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
Signed-off-by: Jan <60812202+janrtvld@users.noreply.github.com>
  • Loading branch information
janrtvld committed Sep 2, 2022
1 parent f26f848 commit e70aa01
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 21 deletions.
8 changes: 5 additions & 3 deletions packages/rest/src/controllers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export interface ProposeCredentialOptions {
issuerDid: string
attributes: {
name: string
mimeType: string
value: string
}[]
}
Expand All @@ -66,10 +65,14 @@ export interface ProposeCredentialOptions {
export interface AcceptCredentialProposalOptions {
credentialFormats?: {
indy: {
schemaIssuerDid: string
schemaId: string
schemaName: string
schemaVersion: string
credentialDefinitionId: string
issuerDid: string
attributes: {
name: string
mimeType: string
value: string
}[]
}
Expand All @@ -85,7 +88,6 @@ export interface OfferCredentialOptions {
credentialDefinitionId: string
attributes: {
name: string
mimeType: string
value: string
}[]
}
Expand Down
6 changes: 3 additions & 3 deletions packages/rest/src/routes/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const models: TsoaRoute.Models = {
"dataType": "refObject",
"properties": {
"protocolVersion": {"ref":"ProtocolVersionType_CredentialServices_","required":true},
"credentialFormats": {"dataType":"nestedObjectLiteral","nestedProperties":{"indy":{"dataType":"nestedObjectLiteral","nestedProperties":{"attributes":{"dataType":"array","array":{"dataType":"nestedObjectLiteral","nestedProperties":{"value":{"dataType":"string","required":true},"mimeType":{"dataType":"string","required":true},"name":{"dataType":"string","required":true}}},"required":true},"issuerDid":{"dataType":"string","required":true},"credentialDefinitionId":{"dataType":"string","required":true},"schemaVersion":{"dataType":"string","required":true},"schemaName":{"dataType":"string","required":true},"schemaId":{"dataType":"string","required":true},"schemaIssuerDid":{"dataType":"string","required":true}},"required":true}},"required":true},
"credentialFormats": {"dataType":"nestedObjectLiteral","nestedProperties":{"indy":{"dataType":"nestedObjectLiteral","nestedProperties":{"attributes":{"dataType":"array","array":{"dataType":"nestedObjectLiteral","nestedProperties":{"value":{"dataType":"string","required":true},"name":{"dataType":"string","required":true}}},"required":true},"issuerDid":{"dataType":"string","required":true},"credentialDefinitionId":{"dataType":"string","required":true},"schemaVersion":{"dataType":"string","required":true},"schemaName":{"dataType":"string","required":true},"schemaId":{"dataType":"string","required":true},"schemaIssuerDid":{"dataType":"string","required":true}},"required":true}},"required":true},
"autoAcceptCredential": {"ref":"AutoAcceptCredential"},
"comment": {"dataType":"string"},
"connectionId": {"dataType":"string","required":true},
Expand All @@ -87,7 +87,7 @@ const models: TsoaRoute.Models = {
"AcceptCredentialProposalOptions": {
"dataType": "refObject",
"properties": {
"credentialFormats": {"dataType":"nestedObjectLiteral","nestedProperties":{"indy":{"dataType":"nestedObjectLiteral","nestedProperties":{"attributes":{"dataType":"array","array":{"dataType":"nestedObjectLiteral","nestedProperties":{"value":{"dataType":"string","required":true},"mimeType":{"dataType":"string","required":true},"name":{"dataType":"string","required":true}}},"required":true},"credentialDefinitionId":{"dataType":"string","required":true}},"required":true}}},
"credentialFormats": {"dataType":"nestedObjectLiteral","nestedProperties":{"indy":{"dataType":"nestedObjectLiteral","nestedProperties":{"attributes":{"dataType":"array","array":{"dataType":"nestedObjectLiteral","nestedProperties":{"value":{"dataType":"string","required":true},"name":{"dataType":"string","required":true}}},"required":true},"issuerDid":{"dataType":"string","required":true},"credentialDefinitionId":{"dataType":"string","required":true},"schemaVersion":{"dataType":"string","required":true},"schemaName":{"dataType":"string","required":true},"schemaId":{"dataType":"string","required":true},"schemaIssuerDid":{"dataType":"string","required":true}},"required":true}}},
"autoAcceptCredential": {"ref":"AutoAcceptCredential"},
"comment": {"dataType":"string"},
},
Expand All @@ -98,7 +98,7 @@ const models: TsoaRoute.Models = {
"dataType": "refObject",
"properties": {
"protocolVersion": {"ref":"ProtocolVersionType_CredentialServices_","required":true},
"credentialFormats": {"dataType":"nestedObjectLiteral","nestedProperties":{"indy":{"dataType":"nestedObjectLiteral","nestedProperties":{"attributes":{"dataType":"array","array":{"dataType":"nestedObjectLiteral","nestedProperties":{"value":{"dataType":"string","required":true},"mimeType":{"dataType":"string","required":true},"name":{"dataType":"string","required":true}}},"required":true},"credentialDefinitionId":{"dataType":"string","required":true}},"required":true}},"required":true},
"credentialFormats": {"dataType":"nestedObjectLiteral","nestedProperties":{"indy":{"dataType":"nestedObjectLiteral","nestedProperties":{"attributes":{"dataType":"array","array":{"dataType":"nestedObjectLiteral","nestedProperties":{"value":{"dataType":"string","required":true},"name":{"dataType":"string","required":true}}},"required":true},"credentialDefinitionId":{"dataType":"string","required":true}},"required":true}},"required":true},
"autoAcceptCredential": {"ref":"AutoAcceptCredential"},
"comment": {"dataType":"string"},
"connectionId": {"dataType":"string","required":true},
Expand Down
34 changes: 21 additions & 13 deletions packages/rest/src/routes/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,12 @@
"value": {
"type": "string"
},
"mimeType": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"value",
"mimeType",
"name"
],
"type": "object"
Expand Down Expand Up @@ -180,29 +176,45 @@
"value": {
"type": "string"
},
"mimeType": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"value",
"mimeType",
"name"
],
"type": "object"
},
"type": "array"
},
"issuerDid": {
"type": "string"
},
"credentialDefinitionId": {
"type": "string"
},
"schemaVersion": {
"type": "string"
},
"schemaName": {
"type": "string"
},
"schemaId": {
"type": "string"
},
"schemaIssuerDid": {
"type": "string"
}
},
"required": [
"attributes",
"credentialDefinitionId"
"issuerDid",
"credentialDefinitionId",
"schemaVersion",
"schemaName",
"schemaId",
"schemaIssuerDid"
],
"type": "object"
}
Expand Down Expand Up @@ -237,16 +249,12 @@
"value": {
"type": "string"
},
"mimeType": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"value",
"mimeType",
"name"
],
"type": "object"
Expand Down
11 changes: 11 additions & 0 deletions packages/rest/tests/credential.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,17 @@ describe('CredentialController', () => {
credentialFormats: {
indy: {
credentialDefinitionId: 'WghBqNdoFjaYh6F5N9eBF:3:CL:3210:test',
issuerDid: 'WghBqNdoFjaYh6F5N9eBF',
schemaId: 'WgWxqztrNooG92RXvxSTWv:2:test:1.0',
schemaIssuerDid: 'WghBqNdoFjaYh6F5N9eBF',
schemaName: 'test',
schemaVersion: '1.0',
attributes: [
{
name: 'name',
value: 'test',
},
],
},
},
autoAcceptCredential: 'always',
Expand Down
3 changes: 1 addition & 2 deletions packages/rest/tests/proof.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,11 @@ describe('ProofController', () => {
name: 'string',
},
},
requestedPredicates: {},
},
})

expect(response.statusCode).toBe(200)
expect(response.body.message).toBeDefined()
expect(response.body.proofUrl).toBeDefined()
expect(response.body.proofRecord).toBeDefined()
})
})
Expand Down

0 comments on commit e70aa01

Please sign in to comment.