@velocitycareerlabs/server-webwallet 1.25.0-dev-build.1c0807f72 → 1.25.0-dev-build.19131a687

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velocitycareerlabs/server-webwallet",
3
- "version": "1.25.0-dev-build.1c0807f72",
3
+ "version": "1.25.0-dev-build.19131a687",
4
4
  "description": "Web Wallet application",
5
5
  "repository": "https://github.com/velocitycareerlabs/packages",
6
6
  "engines": {
@@ -26,28 +26,28 @@
26
26
  "access": "public"
27
27
  },
28
28
  "dependencies": {
29
- "@fastify/autoload": "^5.10.0",
30
- "@fastify/helmet": "^11.1.1",
31
- "@fastify/multipart": "^8.3.1",
32
- "@fastify/sensible": "^5.6.0",
33
- "@fastify/swagger": "^8.15.0",
34
- "@fastify/swagger-ui": "^4.2.0",
29
+ "@fastify/autoload": "^6.0.0",
30
+ "@fastify/helmet": "^13.0.0",
31
+ "@fastify/multipart": "^9.0.0",
32
+ "@fastify/sensible": "^6.0.0",
33
+ "@fastify/swagger": "^9.0.0",
34
+ "@fastify/swagger-ui": "^5.0.0",
35
35
  "@spencejs/spence-mongo-repos": "^0.10.2",
36
- "@velocitycareerlabs/auth": "1.25.0-dev-build.1100a9862",
37
- "@velocitycareerlabs/common-functions": "1.25.0-dev-build.1100a9862",
38
- "@velocitycareerlabs/common-schemas": "1.25.0-dev-build.1100a9862",
39
- "@velocitycareerlabs/config": "1.25.0-dev-build.1100a9862",
40
- "@velocitycareerlabs/fastify-plugins": "1.25.0-dev-build.1100a9862",
41
- "@velocitycareerlabs/jwt": "1.25.0-dev-build.1100a9862",
42
- "@velocitycareerlabs/migrations": "1.25.0-dev-build.1c0807f72",
43
- "@velocitycareerlabs/request": "1.25.0-dev-build.1100a9862",
44
- "@velocitycareerlabs/server-provider": "1.25.0-dev-build.1100a9862",
45
- "@velocitycareerlabs/vc-checks": "1.25.0-dev-build.1100a9862",
46
- "@velocitycareerlabs/vnf-nodejs-wallet-sdk": "1.25.0-dev-build.1100a9862",
36
+ "@velocitycareerlabs/auth": "1.25.0-dev-build.10fcae56a",
37
+ "@velocitycareerlabs/common-functions": "1.25.0-dev-build.10fcae56a",
38
+ "@velocitycareerlabs/common-schemas": "1.25.0-dev-build.10fcae56a",
39
+ "@velocitycareerlabs/config": "1.25.0-dev-build.10fcae56a",
40
+ "@velocitycareerlabs/fastify-plugins": "1.25.0-dev-build.10fcae56a",
41
+ "@velocitycareerlabs/jwt": "1.25.0-dev-build.10fcae56a",
42
+ "@velocitycareerlabs/migrations": "1.25.0-dev-build.19131a687",
43
+ "@velocitycareerlabs/request": "1.25.0-dev-build.10fcae56a",
44
+ "@velocitycareerlabs/server-provider": "1.25.0-dev-build.10fcae56a",
45
+ "@velocitycareerlabs/vc-checks": "1.25.0-dev-build.10fcae56a",
46
+ "@velocitycareerlabs/vnf-nodejs-wallet-sdk": "1.25.0-dev-build.10fcae56a",
47
47
  "blueimp-md5": "2.19.0",
48
48
  "env-var": "^7.0.0",
49
- "fastify": "^4.29.0",
50
- "fastify-plugin": "^4.5.1",
49
+ "fastify": "^5.0.0",
50
+ "fastify-plugin": "^5.0.0",
51
51
  "got": "11.8.6",
52
52
  "http-errors": "2.0.0",
53
53
  "lodash": "^4.17.21",
@@ -56,8 +56,8 @@
56
56
  },
57
57
  "devDependencies": {
58
58
  "@spencejs/spence-factories": "0.10.2",
59
- "@velocitycareerlabs/crypto": "1.25.0-dev-build.1100a9862",
60
- "@velocitycareerlabs/tests-helpers": "1.25.0-dev-build.1100a9862",
59
+ "@velocitycareerlabs/crypto": "1.25.0-dev-build.10fcae56a",
60
+ "@velocitycareerlabs/tests-helpers": "1.25.0-dev-build.10fcae56a",
61
61
  "dotenv": "16.4.7",
62
62
  "eslint": "8.57.1",
63
63
  "eslint-config-airbnb-base": "14.2.1",
@@ -73,5 +73,5 @@
73
73
  "nodemon": "3.1.10",
74
74
  "prettier": "2.8.8"
75
75
  },
76
- "gitHead": "4a89d7939ee0210fb27471a554b37ac8bb187aea"
76
+ "gitHead": "b8ed6fb0a1994fd901620bbfd8b6dbe149f6d889"
77
77
  }
@@ -1,4 +1,3 @@
1
- const { mock } = require('node:test');
2
1
  const { mongoDb } = require('@spencejs/spence-mongo-repos');
3
2
  const { omit } = require('lodash/fp');
4
3
  const nock = require('nock');
@@ -14,8 +13,10 @@ const {
14
13
  mongoify,
15
14
  } = require('@velocitycareerlabs/tests-helpers');
16
15
  const buildFastify = require('./helpers/webwallet-build-fastify');
17
- const { mockFetch } = require('./helpers/mock-fetch');
18
- const { mockSchema, mockedCredentialCategories } = require('./mocks');
16
+ const {
17
+ mockDisplayDescriptor,
18
+ mockedCredentialCategories,
19
+ } = require('./mocks');
19
20
  const initCredentialsFactory = require('./factories/credentials');
20
21
  const { WebWalletServerError } = require('../src/errors/error-codes');
21
22
 
@@ -48,7 +49,6 @@ describe('Test credentials controller', () => {
48
49
 
49
50
  beforeAll(async () => {
50
51
  fastify = buildFastify();
51
-
52
52
  nock('https://localhost/').get('/.well-known/jwks.json').reply(200, jwks);
53
53
 
54
54
  await fastify.ready();
@@ -77,8 +77,11 @@ describe('Test credentials controller', () => {
77
77
  did: 'did:test:2',
78
78
  }),
79
79
  ]);
80
+ nock('http://lib.localhost.test')
81
+ .get('/display-descriptors/open-badge-v2.0.descriptor.json')
82
+ .reply(200, mockDisplayDescriptor);
80
83
 
81
- mock.method(global, 'fetch', () => mockFetch(200, mockSchema));
84
+ // mock.method(global, 'fetch', () => mockFetch(200, mockDisplayDescriptor));
82
85
  const response = await fastify.injectJson({
83
86
  method: 'GET',
84
87
  url: '/credentials',
@@ -95,7 +98,7 @@ describe('Test credentials controller', () => {
95
98
  new VCLFilter(currentUserCredential.issuer.id)
96
99
  )
97
100
  );
98
- expect(global.fetch.mock.calls).toHaveLength(1);
101
+ // expect(global.fetch.mock.calls).toHaveLength(1);
99
102
 
100
103
  expect(response.json).toEqual({
101
104
  credentials: [
@@ -122,7 +125,9 @@ describe('Test credentials controller', () => {
122
125
  }),
123
126
  ]);
124
127
 
125
- mock.method(global, 'fetch', () => mockFetch(500, mockSchema));
128
+ nock('http://lib.localhost.test')
129
+ .get('/display-descriptors/open-badge-v2.0.descriptor.json')
130
+ .reply(500);
126
131
  const response = await fastify.injectJson({
127
132
  method: 'GET',
128
133
  url: '/credentials',
@@ -137,7 +142,7 @@ describe('Test credentials controller', () => {
137
142
  'Failed to fetch descriptor from http://lib.localhost.test/display-descriptors/open-badge-v2.0.descriptor.json'
138
143
  );
139
144
 
140
- expect(global.fetch.mock.calls).toHaveLength(1);
145
+ // expect(global.fetch.mock.calls).toHaveLength(1);
141
146
  });
142
147
 
143
148
  it('should return empty array of credentials if there are no items in DB for user Id', async () => {
@@ -1,6 +1,6 @@
1
1
  HOST_URL=http://localhost.test
2
2
  CAREER_WALLET_URL=http://careerwallet.localhost.test
3
- OAUTH0_DOMAIN=https://localhost/
3
+ OAUTH0_DOMAIN=localhost
4
4
  OAUTH0_WEBAPP_CLIENT_ID=foo
5
5
  AUTH0_WEB_WALLET_AUDIENCE=foo
6
6
  LIB_URL=http://lib.localhost.test
@@ -1,4 +1,3 @@
1
- const { mock } = require('node:test');
2
1
  const nock = require('nock');
3
2
  const { mongoDb } = require('@spencejs/spence-mongo-repos');
4
3
  const { omit } = require('lodash/fp');
@@ -14,7 +13,6 @@ const {
14
13
  VCLVerifiableCredential,
15
14
  } = require('@velocitycareerlabs/vnf-nodejs-wallet-sdk');
16
15
  const { deepLink } = require('./mocks');
17
- const { mockFetch } = require('../helpers/mock-fetch');
18
16
 
19
17
  jest.mock('@velocitycareerlabs/vnf-nodejs-wallet-sdk', () => {
20
18
  const originalModule = jest.requireActual(
@@ -48,7 +46,7 @@ const vclSdk = VCLProvider.getInstance();
48
46
  const initAccountsFactory = require('../factories/accounts');
49
47
  const initCredentialsFactory = require('../factories/credentials');
50
48
 
51
- const { mockSchema } = require('../mocks');
49
+ const { mockDisplayDescriptor } = require('../mocks');
52
50
 
53
51
  const { mockOffers, mockParsedResponse } = require('./mocks');
54
52
 
@@ -138,7 +136,9 @@ describe('Test Deep Link issuing controller', () => {
138
136
 
139
137
  describe('GET /issuing/deep-link/offers - get offers by deep link', () => {
140
138
  it('should return offers by pre-auth token (vendorOriginContext) successfully', async () => {
141
- mock.method(global, 'fetch', () => mockFetch(200, mockSchema));
139
+ nock('http://lib.localhost.test')
140
+ .get('/display-descriptors/open-badge-v2.0.descriptor.json')
141
+ .reply(200, mockDisplayDescriptor);
142
142
 
143
143
  const response = await fastify.injectJson({
144
144
  method: 'POST',
@@ -173,7 +173,6 @@ describe('Test Deep Link issuing controller', () => {
173
173
  )
174
174
  );
175
175
 
176
- expect(global.fetch.mock.calls).toHaveLength(1);
177
176
  const { offers, credentialManifest } = response.json;
178
177
  expect(credentialManifest.jwt).toBe(
179
178
  vclMockCredentialManifest.jwt.encodedJwt
@@ -182,7 +181,9 @@ describe('Test Deep Link issuing controller', () => {
182
181
  });
183
182
 
184
183
  it('should return offers by Input Credentials successfully', async () => {
185
- mock.method(global, 'fetch', () => mockFetch(200, mockSchema));
184
+ nock('http://lib.localhost.test')
185
+ .get('/display-descriptors/open-badge-v2.0.descriptor.json')
186
+ .reply(200, mockDisplayDescriptor);
186
187
  const inputCredential = await persistCredentials({
187
188
  encodedCredential: 'InputCredentialForOffers',
188
189
  });
@@ -231,8 +232,6 @@ describe('Test Deep Link issuing controller', () => {
231
232
  )
232
233
  );
233
234
 
234
- expect(global.fetch.mock.calls).toHaveLength(1);
235
-
236
235
  const { offers, credentialManifest } = response.json;
237
236
  expect(credentialManifest.jwt).toBe(
238
237
  vclMockCredentialManifest.jwt.encodedJwt
@@ -1,4 +1,4 @@
1
- const mockSchema = {
1
+ const mockDisplayDescriptor = {
2
2
  title: {
3
3
  path: [
4
4
  '$.hasCredential.issuer.name',
@@ -103,5 +103,5 @@ const mockSchema = {
103
103
  };
104
104
 
105
105
  module.exports = {
106
- mockSchema,
106
+ mockDisplayDescriptor,
107
107
  };
@@ -1,6 +1,6 @@
1
1
  module.exports = {
2
2
  ...require('./issuers'),
3
- ...require('./schema'),
3
+ ...require('./display-descriptor'),
4
4
  ...require('./credential-categories'),
5
5
  ...require('./credentials'),
6
6
  ...require('./didjwk'),
@@ -1,12 +0,0 @@
1
- const mockFetch = (statusCode, responseBody) => {
2
- return Promise.resolve(
3
- new Response(JSON.stringify(responseBody), {
4
- status: statusCode,
5
- ok: statusCode >= 200 && statusCode < 300,
6
- })
7
- );
8
- };
9
-
10
- module.exports = {
11
- mockFetch,
12
- };