Skip to content

Commit fd39a8f

Browse files
committed
test: correctly use axios
1 parent 6d94c25 commit fd39a8f

File tree

2 files changed

+39
-54
lines changed

2 files changed

+39
-54
lines changed

packages/runtime/test/consumption/openid4vc/compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ services:
1212
- mongodb
1313

1414
connector:
15-
image: ghcr.io/nmshd/connector:7.0.1@sha256:b8458560fa85b190485aa544d9db34ab7d0b6b7b88129eda487b723e201734f8
15+
image: ghcr.io/nmshd/connector:7.1.1@sha256:b8458560fa85b190485aa544d9db34ab7d0b6b7b88129eda487b723e201734f8
1616
environment:
1717
CUSTOM_CONFIG_LOCATION: "/config.json"
1818
transportLibrary__baseUrl: ${NMSHD_TEST_BASEURL}

packages/runtime/test/consumption/openid4vc/openid4vc.test.ts

Lines changed: 38 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ beforeAll(async () => {
2222
baseURL: oid4vcServiceBaseUrl,
2323
headers: {
2424
"Content-Type": "application/json" // eslint-disable-line @typescript-eslint/naming-convention
25-
}
25+
},
26+
validateStatus: () => true // accept all status codes as valid
2627
});
2728
}, 120000);
2829

@@ -36,12 +37,12 @@ describe("OpenID4VCI and OpenID4VCP", () => {
3637

3738
test("should process a given credential offer", async () => {
3839
const response = await axiosInstance.post("/issuance/credentialOffers", {
39-
data: {
40-
credentialConfigurationIds: ["EmployeeIdCard-sdjwt"]
41-
}
40+
credentialConfigurationIds: ["EmployeeIdCard-sdjwt"]
4241
});
43-
const data = await response.data;
44-
credentialOfferUrl = data.result.credentialOffer;
42+
const responseData = await response.data;
43+
44+
credentialOfferUrl = responseData.result.credentialOffer;
45+
4546
const result = await consumptionServices.openId4Vc.fetchCredentialOffer({
4647
credentialOfferUrl
4748
});
@@ -69,60 +70,44 @@ describe("OpenID4VCI and OpenID4VCP", () => {
6970
}, 10000000);
7071

7172
test("should be able to process a given credential presentation", async () => {
72-
// Ensure the first test has completed and credentialOfferUrl is set
73+
// Ensure the first test has completed
7374
expect(credentialOfferUrl).toBeDefined();
7475

75-
const response = await axios.post(`presentation/presentationRequests`, {
76-
data: {
77-
pex: {
78-
id: "anId",
79-
purpose: "To prove you work here",
80-
// eslint-disable-next-line @typescript-eslint/naming-convention
81-
input_descriptors: [
82-
{
83-
id: "EmployeeIdCard",
84-
format: {
76+
const response = await axiosInstance.post("/presentation/presentationRequests", {
77+
pex: {
78+
id: "anId",
79+
purpose: "To prove you work here",
80+
// eslint-disable-next-line @typescript-eslint/naming-convention
81+
input_descriptors: [
82+
{
83+
id: "EmployeeIdCard",
84+
format: {
85+
// eslint-disable-next-line @typescript-eslint/naming-convention
86+
"vc+sd-jwt": {
8587
// eslint-disable-next-line @typescript-eslint/naming-convention
86-
"vc+sd-jwt": {
87-
// eslint-disable-next-line @typescript-eslint/naming-convention
88-
"sd-jwt_alg_values": [
89-
"RS256",
90-
"PS256",
91-
"HS256",
92-
"ES256",
93-
"ES256K",
94-
"RS384",
95-
"PS384",
96-
"HS384",
97-
"ES384",
98-
"RS512",
99-
"PS512",
100-
"HS512",
101-
"ES512",
102-
"EdDSA"
103-
]
104-
}
105-
},
106-
constraints: {
107-
fields: [
108-
{
109-
path: ["$.vct"],
110-
filter: {
111-
type: "string",
112-
pattern: "EmployeeIdCard"
113-
}
114-
}
115-
]
88+
"sd-jwt_alg_values": ["RS256", "PS256", "HS256", "ES256", "ES256K", "RS384", "PS384", "HS384", "ES384", "RS512", "PS512", "HS512", "ES512", "EdDSA"]
11689
}
90+
},
91+
constraints: {
92+
fields: [
93+
{
94+
path: ["$.vct"],
95+
filter: {
96+
type: "string",
97+
pattern: "EmployeeIdCard"
98+
}
99+
}
100+
]
117101
}
118-
]
119-
},
120-
version: "v1.draft21"
121-
}
102+
}
103+
]
104+
},
105+
version: "v1.draft21"
122106
});
123-
const data = await response.data;
107+
const responseData = await response.data;
108+
124109
const result = await consumptionServices.openId4Vc.fetchProofRequest({
125-
proofRequestUrl: data.result.presentationRequest
110+
proofRequestUrl: responseData.result.presentationRequest
126111
});
127112
const jsonRepresentation = result.value.jsonRepresentation;
128113

0 commit comments

Comments
 (0)