cozy-client 38.5.1 → 38.6.0

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.
@@ -2677,7 +2677,7 @@ var CozyClient = /*#__PURE__*/function () {
2677
2677
  CozyClient.hooks = CozyClient.hooks || {};
2678
2678
  CozyClient.fetchPolicies = _policies.default; //COZY_CLIENT_VERSION_PACKAGE in replaced by babel. See babel config
2679
2679
 
2680
- CozyClient.version = "38.5.1";
2680
+ CozyClient.version = "38.6.0";
2681
2681
 
2682
2682
  _microee.default.mixin(CozyClient);
2683
2683
 
@@ -13,8 +13,6 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
13
13
 
14
14
  var _CozyClient = _interopRequireDefault(require("../CozyClient"));
15
15
 
16
- var _logger = _interopRequireDefault(require("../logger"));
17
-
18
16
  var _storeAttestation = require("./store-attestation");
19
17
 
20
18
  /**
@@ -157,10 +155,8 @@ var certifyFlagship = /*#__PURE__*/function () {
157
155
  case 13:
158
156
  _context3.prev = 13;
159
157
  _context3.t0 = _context3["catch"](2);
160
-
161
- _logger.default.warn('[FLAGSHIP_CERTIFICATION] Certification failed but the cozy-stack will continue with 2FA certification');
162
-
163
- _logger.default.warn(_context3.t0.message);
158
+ console.warn("[FLAGSHIP_CERTIFICATION] Certification for URI \"".concat(client.stackClient.uri, "\" failed but the cozy-stack will continue with 2FA certification"));
159
+ console.warn(_context3.t0.message);
164
160
 
165
161
  case 17:
166
162
  case "end":
@@ -2,7 +2,6 @@ import { certifyFlagship } from './flagship-certification'
2
2
  import { createMockClient } from '../mock'
3
3
 
4
4
  import { getAppAttestationFromStore } from './store-attestation'
5
- import logger from '../logger'
6
5
 
7
6
  jest.mock('./store-attestation', () => ({
8
7
  getAppAttestationFromStore: jest.fn()
@@ -19,6 +18,8 @@ const getClientMock = () => {
19
18
  }
20
19
  })
21
20
 
21
+ client.stackClient.uri = 'http://cozy.tools:8080'
22
+
22
23
  client.stackClient.oauthOptions = {
23
24
  clientID: 'SOME_CLIENT_ID',
24
25
  registrationAccessToken: 'SOME_REGISTRATION_ACCESS_TOKEN'
@@ -60,10 +61,17 @@ const getFetchJsonPostParams = (url, body = null) => {
60
61
  ]
61
62
  }
62
63
 
64
+ const consoleWarn = console.warn
65
+
63
66
  describe('certifyFlagship', () => {
64
67
  afterEach(() => {
65
68
  jest.restoreAllMocks()
66
69
  getAppAttestationFromStore.mockReset()
70
+ console.warn = jest.fn()
71
+ })
72
+
73
+ afterAll(() => {
74
+ console.warn = consoleWarn
67
75
  })
68
76
 
69
77
  it('should ask challenge to cozy-stack, call the store API and then send the result to the stack', async () => {
@@ -136,10 +144,10 @@ describe('certifyFlagship', () => {
136
144
  ...getFetchJsonPostParams(`/auth/clients/SOME_CLIENT_ID/challenge`)
137
145
  )
138
146
 
139
- expect(logger.warn).toHaveBeenCalledWith(
140
- '[FLAGSHIP_CERTIFICATION] Certification failed but the cozy-stack will continue with 2FA certification'
147
+ expect(console.warn).toHaveBeenCalledWith(
148
+ '[FLAGSHIP_CERTIFICATION] Certification for URI "http://cozy.tools:8080" failed but the cozy-stack will continue with 2FA certification'
141
149
  )
142
- expect(logger.warn).toHaveBeenCalledWith(
150
+ expect(console.warn).toHaveBeenCalledWith(
143
151
  '[FLAGSHIP_CERTIFICATION] Something went wrong while requesting a challenge from CozyStack:\nSOME_STACK_CHALLENGE_ERROR'
144
152
  )
145
153
  })
@@ -166,10 +174,10 @@ describe('certifyFlagship', () => {
166
174
  androidSafetyNetApiKey: 'SOME_ANDROID_SAFETY_NET_API_KEY'
167
175
  })
168
176
 
169
- expect(logger.warn).toHaveBeenCalledWith(
170
- '[FLAGSHIP_CERTIFICATION] Certification failed but the cozy-stack will continue with 2FA certification'
177
+ expect(console.warn).toHaveBeenCalledWith(
178
+ '[FLAGSHIP_CERTIFICATION] Certification for URI "http://cozy.tools:8080" failed but the cozy-stack will continue with 2FA certification'
171
179
  )
172
- expect(logger.warn).toHaveBeenCalledWith('SOME_STORE_API_ERROR')
180
+ expect(console.warn).toHaveBeenCalledWith('SOME_STORE_API_ERROR')
173
181
  })
174
182
 
175
183
  it('should ask challenge to cozy-stack, call the store API, send the result to the stack and then handle cozy-stack certification failure', async () => {
@@ -205,10 +213,10 @@ describe('certifyFlagship', () => {
205
213
  })
206
214
  )
207
215
 
208
- expect(logger.warn).toHaveBeenCalledWith(
209
- '[FLAGSHIP_CERTIFICATION] Certification failed but the cozy-stack will continue with 2FA certification'
216
+ expect(console.warn).toHaveBeenCalledWith(
217
+ '[FLAGSHIP_CERTIFICATION] Certification for URI "http://cozy.tools:8080" failed but the cozy-stack will continue with 2FA certification'
210
218
  )
211
- expect(logger.warn).toHaveBeenCalledWith(
219
+ expect(console.warn).toHaveBeenCalledWith(
212
220
  '[FLAGSHIP_CERTIFICATION] Something went wrong while giving attestation to CozyStack:\nSOME_STACK_CERTIFICATION_ERROR'
213
221
  )
214
222
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-client",
3
- "version": "38.5.1",
3
+ "version": "38.6.0",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.node.js",
6
6
  "browser": "dist/index.js",
@@ -73,5 +73,5 @@
73
73
  "react-native-ios11-devicecheck": "https://github.com/cozy/react-native-devicecheck#app-attest-v0.1"
74
74
  },
75
75
  "sideEffects": false,
76
- "gitHead": "4c1672ea17f48297d1a671658caf707a8356f6b0"
76
+ "gitHead": "23f719602fa317e6f8b66e91db493d25e51810aa"
77
77
  }