@jobber/hooks 1.13.3-pre.9 → 2.0.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.
@@ -41,6 +41,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
41
41
  };
42
42
  Object.defineProperty(exports, "__esModule", { value: true });
43
43
  var react_hooks_1 = require("@testing-library/react-hooks");
44
+ var react_1 = require("@testing-library/react");
44
45
  var useCollectionQuery_1 = require("./useCollectionQuery");
45
46
  var test_utilities_1 = require("./test-utilities");
46
47
  beforeEach(function () {
@@ -186,9 +187,8 @@ describe("useCollectionQuery", function () {
186
187
  describe("when nextPage is called while it's still loadingNextPage", function () {
187
188
  it("should not trigger a nextPage", function () { return __awaiter(void 0, void 0, void 0, function () {
188
189
  var result;
189
- var _a, _b, _c, _d;
190
- return __generator(this, function (_e) {
191
- switch (_e.label) {
190
+ return __generator(this, function (_a) {
191
+ switch (_a.label) {
192
192
  case 0:
193
193
  result = react_hooks_1.renderHook(function () { return useCollectionQueryHook(query); }, {
194
194
  wrapper: test_utilities_1.wrapper([
@@ -199,7 +199,7 @@ describe("useCollectionQuery", function () {
199
199
  }).result;
200
200
  return [4 /*yield*/, react_hooks_1.act(test_utilities_1.wait)];
201
201
  case 1:
202
- _e.sent();
202
+ _a.sent();
203
203
  react_hooks_1.act(function () {
204
204
  result.current.nextPage();
205
205
  });
@@ -208,8 +208,13 @@ describe("useCollectionQuery", function () {
208
208
  });
209
209
  return [4 /*yield*/, react_hooks_1.act(test_utilities_1.wait)];
210
210
  case 2:
211
- _e.sent();
212
- expect((_d = (_c = (_b = (_a = result.current.data) === null || _a === void 0 ? void 0 : _a.conversation) === null || _b === void 0 ? void 0 : _b.smsMessages) === null || _c === void 0 ? void 0 : _c.edges) === null || _d === void 0 ? void 0 : _d.length).toBe(2);
211
+ _a.sent();
212
+ return [4 /*yield*/, react_1.waitFor(function () {
213
+ var _a, _b, _c;
214
+ expect((_c = (_b = (_a = result.current.data) === null || _a === void 0 ? void 0 : _a.conversation) === null || _b === void 0 ? void 0 : _b.smsMessages) === null || _c === void 0 ? void 0 : _c.edges).toHaveLength(2);
215
+ })];
216
+ case 3:
217
+ _a.sent();
213
218
  return [2 /*return*/];
214
219
  }
215
220
  });
@@ -277,9 +282,8 @@ describe("useCollectionQuery", function () {
277
282
  describe("when there is no error", function () {
278
283
  it("should update data", function () { return __awaiter(void 0, void 0, void 0, function () {
279
284
  var result;
280
- var _a, _b, _c, _d;
281
- return __generator(this, function (_e) {
282
- switch (_e.label) {
285
+ return __generator(this, function (_a) {
286
+ switch (_a.label) {
283
287
  case 0:
284
288
  result = react_hooks_1.renderHook(function () { return useCollectionQueryHook(query); }, {
285
289
  wrapper: test_utilities_1.wrapper([
@@ -289,14 +293,19 @@ describe("useCollectionQuery", function () {
289
293
  }).result;
290
294
  return [4 /*yield*/, react_hooks_1.act(test_utilities_1.wait)];
291
295
  case 1:
292
- _e.sent();
296
+ _a.sent();
293
297
  react_hooks_1.act(function () {
294
298
  result.current.nextPage();
295
299
  });
296
300
  return [4 /*yield*/, react_hooks_1.act(test_utilities_1.wait)];
297
301
  case 2:
298
- _e.sent();
299
- expect((_d = (_c = (_b = (_a = result.current.data) === null || _a === void 0 ? void 0 : _a.conversation) === null || _b === void 0 ? void 0 : _b.smsMessages) === null || _c === void 0 ? void 0 : _c.edges) === null || _d === void 0 ? void 0 : _d.length).toBe(2);
302
+ _a.sent();
303
+ return [4 /*yield*/, react_1.waitFor(function () {
304
+ var _a, _b, _c;
305
+ expect((_c = (_b = (_a = result.current.data) === null || _a === void 0 ? void 0 : _a.conversation) === null || _b === void 0 ? void 0 : _b.smsMessages) === null || _c === void 0 ? void 0 : _c.edges).toHaveLength(2);
306
+ })];
307
+ case 3:
308
+ _a.sent();
300
309
  return [2 /*return*/];
301
310
  }
302
311
  });
@@ -421,7 +430,7 @@ describe("useCollectionQuery", function () {
421
430
  });
422
431
  describe("#subscribeToMore", function () {
423
432
  describe("when hook receives update from item not in collection", function () {
424
- it("it should add new item to collection", function () { return __awaiter(void 0, void 0, void 0, function () {
433
+ it("should add new item to collection", function () { return __awaiter(void 0, void 0, void 0, function () {
425
434
  var _a, result, waitForNextUpdate;
426
435
  var _b, _c, _d, _e, _f;
427
436
  return __generator(this, function (_g) {
@@ -450,7 +459,7 @@ describe("useCollectionQuery", function () {
450
459
  }); });
451
460
  });
452
461
  describe("when hook receives update from item already in collection", function () {
453
- it("it should return the existing collection", function () { return __awaiter(void 0, void 0, void 0, function () {
462
+ it("should return the existing collection", function () { return __awaiter(void 0, void 0, void 0, function () {
454
463
  var _a, result, waitForNextUpdate;
455
464
  var _b, _c, _d, _e, _f;
456
465
  return __generator(this, function (_g) {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * Traps the focus within the children of the ref element.
4
3
  *
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare function useFormState(): readonly [{
3
2
  isDirty: boolean;
4
3
  isValid: boolean;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const Breakpoints: {
3
2
  base: number;
4
3
  small: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/hooks",
3
- "version": "1.13.3-pre.9+4283b81c",
3
+ "version": "2.0.0",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",
@@ -13,9 +13,8 @@
13
13
  "dist/*"
14
14
  ],
15
15
  "devDependencies": {
16
- "@apollo/client": "^3.3.16",
17
16
  "@apollo/react-testing": "^4.0.0",
18
- "@jobber/formatters": "^0.2.2-pre.51+4283b81c",
17
+ "@jobber/formatters": "^0.2.2",
19
18
  "@testing-library/react": "^14.0.0",
20
19
  "@testing-library/react-hooks": "^7.0.0",
21
20
  "@testing-library/user-event": "^12.0.2",
@@ -24,7 +23,6 @@
24
23
  "@types/react-dom": "^18.0.11",
25
24
  "@types/uuid": "^8.3.3",
26
25
  "@types/zxcvbn": "^4.4.1",
27
- "graphql": "^14.6.0",
28
26
  "typescript": "^3.8.3",
29
27
  "uuid": "^8.3.2"
30
28
  },
@@ -37,8 +35,8 @@
37
35
  "zxcvbn": "^4.4.2"
38
36
  },
39
37
  "peerDependencies": {
40
- "@apollo/client": "^3.3.16",
41
- "react": ">=16.8"
38
+ "@apollo/client": "^3.7.10",
39
+ "react": "^18"
42
40
  },
43
- "gitHead": "4283b81c1012981fc5198a4f835b6d3a2159d2b2"
41
+ "gitHead": "5443401641cd1b6a04069c5269c79308bfe4f9ce"
44
42
  }