@jobber/components-native 0.89.1-JOB-139857-e7771b4.7 → 0.89.1

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": "@jobber/components-native",
3
- "version": "0.89.1-JOB-139857-e7771b4.7+e7771b4e1",
3
+ "version": "0.89.1",
4
4
  "license": "MIT",
5
5
  "description": "React Native implementation of Atlantis",
6
6
  "repository": {
@@ -94,5 +94,5 @@
94
94
  "react-native-safe-area-context": "^5.4.0",
95
95
  "react-native-svg": ">=12.0.0"
96
96
  },
97
- "gitHead": "e7771b4e1b4363a1f41119579a03282032c2f1fe"
97
+ "gitHead": "25bace94c2635ea2ae92f0aa7ae7d5b5c40841d2"
98
98
  }
@@ -43,42 +43,42 @@ function setup({
43
43
  }
44
44
 
45
45
  it("renders a BottomSheet", async () => {
46
- const { getByText } = setup({});
46
+ const { findByText } = setup({});
47
47
 
48
48
  await waitForUntestableRender(
49
49
  "Wait for AccessibilityInfo.isScreenReaderEnabled to resolve",
50
50
  );
51
51
 
52
- act(() => {
52
+ await act(async () => {
53
53
  ref.current?.open();
54
54
  });
55
55
 
56
- expect(getByText("BottomSheet")).toBeDefined();
56
+ expect(await findByText("BottomSheet")).toBeDefined();
57
57
  });
58
58
 
59
59
  it("renders a BottomSheet with a header", async () => {
60
60
  const header = "Hello this is header";
61
- const { getByText } = setup({ heading: header });
61
+ const { findByText } = setup({ heading: header });
62
62
 
63
63
  await waitForUntestableRender(
64
64
  "Wait for AccessibilityInfo.isScreenReaderEnabled to resolve",
65
65
  );
66
66
 
67
- act(() => {
67
+ await act(async () => {
68
68
  ref.current?.open();
69
69
  });
70
70
 
71
- expect(getByText(header)).toBeDefined();
71
+ expect(await findByText(header)).toBeDefined();
72
72
  });
73
73
 
74
74
  it("BottomSheet can be closed with the cancel action", async () => {
75
- const { getByText, queryByText } = setup({ showCancel: true });
75
+ const { findByLabelText, queryByText } = setup({ showCancel: true });
76
76
 
77
- act(() => {
77
+ await act(async () => {
78
78
  ref.current?.open();
79
79
  });
80
80
 
81
- fireEvent.press(getByText("Cancel"));
81
+ fireEvent.press(await findByLabelText("Cancel"));
82
82
 
83
83
  await waitFor(() => {
84
84
  expect(queryByText("BottomSheet")).toBeNull();
@@ -93,7 +93,7 @@ describe("when loading is provided and true", () => {
93
93
  "Wait for AccessibilityInfo.isScreenReaderEnabled to resolve",
94
94
  );
95
95
 
96
- act(() => {
96
+ await act(async () => {
97
97
  ref.current?.open();
98
98
  });
99
99
 
@@ -104,7 +104,7 @@ describe("when loading is provided and true", () => {
104
104
  it("calls onClose when BottomSheet is closed", async () => {
105
105
  setup({});
106
106
 
107
- act(() => {
107
+ await act(async () => {
108
108
  ref.current?.open();
109
109
  ref.current?.close();
110
110
  });
@@ -117,7 +117,7 @@ it("calls onClose when BottomSheet is closed", async () => {
117
117
  it("calls onOpen when BottomSheet is opened", async () => {
118
118
  setup({});
119
119
 
120
- act(() => {
120
+ await act(async () => {
121
121
  ref.current?.open();
122
122
  });
123
123
 
@@ -132,17 +132,17 @@ describe("when there is a screen reader enabled", () => {
132
132
  .spyOn(AccessibilityInfo, "isScreenReaderEnabled")
133
133
  .mockImplementation(() => Promise.resolve(true));
134
134
 
135
- const { getByText, queryByText } = setup({});
135
+ const { findByLabelText, queryByText } = setup({});
136
136
 
137
137
  await waitForUntestableRender(
138
138
  "Wait for AccessibilityInfo.isScreenReaderEnabled to resolve",
139
139
  );
140
140
 
141
- act(() => {
141
+ await act(async () => {
142
142
  ref.current?.open();
143
143
  });
144
144
 
145
- fireEvent.press(getByText("Cancel"));
145
+ fireEvent.press(await findByLabelText("Cancel"));
146
146
 
147
147
  await waitFor(() => {
148
148
  expect(queryByText("BottomSheet")).toBeNull();
@@ -168,7 +168,7 @@ it("fires the press handlers when the primary action buttons are pressed", () =>
168
168
  expect(editAction).toHaveBeenCalled();
169
169
  });
170
170
 
171
- it("opens the secondary action menu when the More button is pressed", () => {
171
+ it("opens the secondary action menu when the More button is pressed", async () => {
172
172
  const createAction = jest.fn();
173
173
  const editAction = jest.fn();
174
174
  const deleteAction = jest.fn();
@@ -196,11 +196,11 @@ it("opens the secondary action menu when the More button is pressed", () => {
196
196
 
197
197
  fireEvent.press(getByLabelText("More"));
198
198
 
199
- expect(findByText("Edit")).not.toBeNull();
200
- expect(findByText("Delete")).not.toBeNull();
199
+ expect(await findByText("Edit")).not.toBeNull();
200
+ expect(await findByText("Delete")).not.toBeNull();
201
201
  });
202
202
 
203
- it("renders heading and cancel options if passed in", () => {
203
+ it("renders heading and cancel options if passed in", async () => {
204
204
  const createAction = jest.fn();
205
205
  const editAction = jest.fn();
206
206
  const { findByText, getByLabelText } = render(
@@ -223,8 +223,8 @@ it("renders heading and cancel options if passed in", () => {
223
223
 
224
224
  fireEvent.press(getByLabelText("More"));
225
225
 
226
- expect(findByText("Heading")).not.toBeNull();
227
- expect(findByText("Cancel")).not.toBeNull();
226
+ expect(await findByText("Heading")).not.toBeNull();
227
+ expect(await findByText("Cancel")).not.toBeNull();
228
228
  });
229
229
 
230
230
  it("renders custom button for primary action if passed in", () => {
@@ -127,7 +127,7 @@ describe("when a secondaryActions is passed in", () => {
127
127
  const beforeSubmitMock = jest.fn().mockImplementation(() => {
128
128
  return Promise.resolve(true);
129
129
  });
130
- const { getByLabelText } = render(
130
+ const { findByLabelText, getByLabelText } = render(
131
131
  <ButtonGroupForTest
132
132
  primaryAction={pressHandler}
133
133
  loading={false}
@@ -145,7 +145,7 @@ describe("when a secondaryActions is passed in", () => {
145
145
  />,
146
146
  );
147
147
  fireEvent.press(getByLabelText("More"));
148
- expect(getByLabelText("hi")).toBeDefined();
148
+ expect(await findByLabelText("hi")).toBeDefined();
149
149
  fireEvent.press(getByLabelText("hi"));
150
150
  expect(beforeSubmitMock).toHaveBeenCalled();
151
151
  await waitFor(() => {
@@ -210,17 +210,17 @@ function basicRenderTestWithValue() {
210
210
  jest.advanceTimersByTime(progressBarAnimationTime);
211
211
  });
212
212
 
213
- it("shows a BottomSheet with a remove option when tapped", () => {
214
- const { getByTestId, getByLabelText } = tree;
213
+ it("shows a BottomSheet with a remove option when tapped", async () => {
214
+ const { getByTestId, findByLabelText } = tree;
215
215
  fireEvent.press(getByTestId(testId));
216
- expect(getByLabelText(removeLabel)).toBeDefined();
216
+ expect(await findByLabelText(removeLabel)).toBeDefined();
217
217
  });
218
218
 
219
219
  describe("when the BottomSheet remove option is tapped", () => {
220
- it("calls the onRemove action", () => {
221
- const { getByTestId, getByLabelText } = tree;
220
+ it("calls the onRemove action", async () => {
221
+ const { getByTestId, findByLabelText } = tree;
222
222
  fireEvent.press(getByTestId(testId));
223
- fireEvent.press(getByLabelText(removeLabel));
223
+ fireEvent.press(await findByLabelText(removeLabel));
224
224
  expect(onRemove).toHaveBeenCalledTimes(1);
225
225
  });
226
226
  });
@@ -233,36 +233,36 @@ function basicRenderTestWithValue() {
233
233
  );
234
234
 
235
235
  describe("when the preview option is tapped", () => {
236
- it("calls onPreview with a valid image", () => {
236
+ it("calls onPreview with a valid image", async () => {
237
237
  const previewLabel = "Preview image";
238
- const { getByTestId, getByLabelText } = renderFormatFile(
238
+ const { getByTestId, findByLabelText } = renderFormatFile(
239
239
  FILE_UPLOAD_MOCK_IMAGE({ progress: 1, status: StatusCode.Completed }),
240
240
  "image",
241
241
  );
242
242
  fireEvent.press(getByTestId("test-image"));
243
- fireEvent.press(getByLabelText(previewLabel));
243
+ fireEvent.press(await findByLabelText(previewLabel));
244
244
  expect(mockOnPreview).toHaveBeenCalledTimes(1);
245
245
  });
246
246
 
247
- it("calls onPreview with a valid pdf file", () => {
247
+ it("calls onPreview with a valid pdf file", async () => {
248
248
  const previewLabel = "Preview file";
249
- const { getByTestId, getByLabelText } = renderFormatFile(
249
+ const { getByTestId, findByLabelText } = renderFormatFile(
250
250
  FILE_UPLOAD_MOCK_PDF({ progress: 1, status: StatusCode.Completed }),
251
251
  "file",
252
252
  );
253
253
  fireEvent.press(getByTestId("test-file"));
254
- fireEvent.press(getByLabelText(previewLabel));
254
+ fireEvent.press(await findByLabelText(previewLabel));
255
255
  expect(mockOnPreview).toHaveBeenCalledTimes(1);
256
256
  });
257
257
 
258
- it("calls onPreview with a valid external PDF file", () => {
258
+ it("calls onPreview with a valid external PDF file", async () => {
259
259
  const previewLabel = "Preview file";
260
- const { getByTestId, getByLabelText } = renderFormatFile(
260
+ const { getByTestId, findByLabelText } = renderFormatFile(
261
261
  FILE_MOCK_PDF,
262
262
  "file",
263
263
  );
264
264
  fireEvent.press(getByTestId("test-file"));
265
- fireEvent.press(getByLabelText(previewLabel));
265
+ fireEvent.press(await findByLabelText(previewLabel));
266
266
  expect(mockOnPreview).toHaveBeenCalledTimes(1);
267
267
  });
268
268
 
@@ -52,29 +52,29 @@ const basicRenderTestWithValue = () => {
52
52
  });
53
53
 
54
54
  describe("onPreviewPress", () => {
55
- it("renders the preview option", () => {
56
- const { getByLabelText } = tree;
55
+ it("renders the preview option", async () => {
56
+ const { findByLabelText } = tree;
57
57
 
58
- expect(getByLabelText(previewLabel)).toBeDefined();
58
+ expect(await findByLabelText(previewLabel)).toBeDefined();
59
59
  });
60
60
 
61
- it("is called when pressed", () => {
62
- const { getByLabelText } = tree;
63
- fireEvent.press(getByLabelText(previewLabel));
61
+ it("is called when pressed", async () => {
62
+ const { findByLabelText } = tree;
63
+ fireEvent.press(await findByLabelText(previewLabel));
64
64
  expect(onPreview).toHaveBeenCalledTimes(1);
65
65
  });
66
66
  });
67
67
 
68
68
  describe("onRemovePress", () => {
69
- it("renders the remove option", () => {
70
- const { getByLabelText } = tree;
69
+ it("renders the remove option", async () => {
70
+ const { findByLabelText } = tree;
71
71
 
72
- expect(getByLabelText(removeLabel)).toBeDefined();
72
+ expect(await findByLabelText(removeLabel)).toBeDefined();
73
73
  });
74
74
 
75
- it("is called when pressed", () => {
76
- const { getByLabelText } = tree;
77
- fireEvent.press(getByLabelText(removeLabel));
75
+ it("is called when pressed", async () => {
76
+ const { findByLabelText } = tree;
77
+ fireEvent.press(await findByLabelText(removeLabel));
78
78
 
79
79
  expect(onRemove).toHaveBeenCalledTimes(1);
80
80
  });