@jobber/hooks 1.13.3 → 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
  });
@@ -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",
3
+ "version": "2.0.0",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",
@@ -13,7 +13,6 @@
13
13
  "dist/*"
14
14
  ],
15
15
  "devDependencies": {
16
- "@apollo/client": "^3.3.16",
17
16
  "@apollo/react-testing": "^4.0.0",
18
17
  "@jobber/formatters": "^0.2.2",
19
18
  "@testing-library/react": "^14.0.0",
@@ -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": "c92b6e7287a47c05434202bfbcd04375b6a7086f"
41
+ "gitHead": "5443401641cd1b6a04069c5269c79308bfe4f9ce"
44
42
  }