cozy-client 43.0.0 → 43.1.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.
- package/dist/CozyClient.js +1 -1
- package/dist/mock.js +12 -6
- package/dist/mock.spec.js +7 -0
- package/package.json +2 -2
package/dist/CozyClient.js
CHANGED
|
@@ -2703,7 +2703,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
2703
2703
|
CozyClient.hooks = CozyClient.hooks || {};
|
|
2704
2704
|
CozyClient.fetchPolicies = _policies.default; //COZY_CLIENT_VERSION_PACKAGE in replaced by babel. See babel config
|
|
2705
2705
|
|
|
2706
|
-
CozyClient.version = "43.
|
|
2706
|
+
CozyClient.version = "43.1.0";
|
|
2707
2707
|
|
|
2708
2708
|
_microee.default.mixin(CozyClient);
|
|
2709
2709
|
|
package/dist/mock.js
CHANGED
|
@@ -29,13 +29,19 @@ var fillQueryInsideClient = function fillQueryInsideClient(client, queryName, qu
|
|
|
29
29
|
var definition = queryOptions.definition,
|
|
30
30
|
doctype = queryOptions.doctype,
|
|
31
31
|
data = queryOptions.data,
|
|
32
|
-
|
|
32
|
+
queryError = queryOptions.queryError,
|
|
33
|
+
queryResult = (0, _objectWithoutProperties2.default)(queryOptions, ["definition", "doctype", "data", "queryError"]);
|
|
33
34
|
client.store.dispatch((0, _store.initQuery)(queryName, definition || (0, _dsl.Q)(doctype)));
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
|
|
36
|
+
if (queryError) {
|
|
37
|
+
client.store.dispatch((0, _store.receiveQueryError)(queryName, queryError));
|
|
38
|
+
} else {
|
|
39
|
+
client.store.dispatch((0, _store.receiveQueryResult)(queryName, _objectSpread({
|
|
40
|
+
data: data ? data.map(function (doc) {
|
|
41
|
+
return (0, _cozyStackClient.normalizeDoc)(doc, doctype);
|
|
42
|
+
}) : data
|
|
43
|
+
}, queryResult)));
|
|
44
|
+
}
|
|
39
45
|
};
|
|
40
46
|
|
|
41
47
|
var mockedQueryFromMockedRemoteData = function mockedQueryFromMockedRemoteData(remoteData) {
|
package/dist/mock.spec.js
CHANGED
|
@@ -14,6 +14,10 @@ describe('createMockClient', () => {
|
|
|
14
14
|
simpsons: {
|
|
15
15
|
data: simpsonsFixture,
|
|
16
16
|
doctype: 'io.cozy.simpsons'
|
|
17
|
+
},
|
|
18
|
+
simpsonsError: {
|
|
19
|
+
doctype: 'io.cozy.simpsons',
|
|
20
|
+
queryError: new Error('some error')
|
|
17
21
|
}
|
|
18
22
|
}
|
|
19
23
|
})
|
|
@@ -24,6 +28,9 @@ describe('createMockClient', () => {
|
|
|
24
28
|
'homer',
|
|
25
29
|
'marge'
|
|
26
30
|
])
|
|
31
|
+
const errorQuery = client.getQueryFromState('simpsonsError')
|
|
32
|
+
expect(errorQuery.fetchStatus).toBe('failed')
|
|
33
|
+
expect(errorQuery.lastError).toStrictEqual(new Error('some error'))
|
|
27
34
|
})
|
|
28
35
|
|
|
29
36
|
it('should mock query with data passed in "remote" option', async () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-client",
|
|
3
|
-
"version": "43.
|
|
3
|
+
"version": "43.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.node.js",
|
|
6
6
|
"browser": "dist/index.js",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"react-native-ios11-devicecheck": "https://github.com/cozy/react-native-devicecheck#app-attest-v0.1"
|
|
76
76
|
},
|
|
77
77
|
"sideEffects": false,
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "81e6523fab6fc927e6526d880910608124168059"
|
|
79
79
|
}
|