Skip to content

Commit 55da3ba

Browse files
committed
add test for new search path
1 parent cdccb16 commit 55da3ba

File tree

12 files changed

+9835
-241
lines changed

12 files changed

+9835
-241
lines changed

src/__tests__/CompareResults/__snapshots__/ResultsTable.test.tsx.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,10 @@ exports[`Results Table Should match snapshot 1`] = `
232232
</div>
233233
<input
234234
aria-invalid="false"
235-
aria-label="Search base by ID number or author email"
235+
aria-label="Search base by ID number, author email or bug number"
236236
class="MuiInputBase-input MuiOutlinedInput-input MuiInputBase-inputSizeSmall MuiInputBase-inputAdornedStart css-jrmsot-MuiInputBase-input-MuiOutlinedInput-input"
237237
id="search-base-input"
238-
placeholder="Search base by ID number or author email"
238+
placeholder="Search base by ID number, author email or bug number"
239239
type="text"
240240
value=""
241241
/>
@@ -520,10 +520,10 @@ exports[`Results Table Should match snapshot 1`] = `
520520
</div>
521521
<input
522522
aria-invalid="false"
523-
aria-label="Search revision by ID number or author email"
523+
aria-label="Search revision by ID number, author email or bug number"
524524
class="MuiInputBase-input MuiOutlinedInput-input MuiInputBase-inputSizeSmall MuiInputBase-inputAdornedStart css-jrmsot-MuiInputBase-input-MuiOutlinedInput-input"
525525
id="search-new-input"
526-
placeholder="Search revision by ID number or author email"
526+
placeholder="Search revision by ID number, author email or bug number"
527527
type="text"
528528
value=""
529529
/>

src/__tests__/Search/SearchView.test.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ function setupTestData() {
2222
const { testData } = getTestData();
2323
(global.fetch as FetchMockSandbox)
2424
.get(
25-
'begin:https://treeherder.mozilla.org/api/project/try/push/?author_contains=',
25+
'begin:https://treeherder.mozilla.org/api/project/try/push/?search=',
2626
(url) => {
27-
const author = new URL(url).searchParams.get('author_contains');
28-
return { results: testData.filter((item) => item.author === author) };
27+
const search = new URL(url).searchParams.get('search');
28+
return { results: testData.filter((item) => item.author === search) };
2929
},
3030
)
3131
.get(
@@ -134,7 +134,7 @@ describe('Search Container', () => {
134134
});
135135

136136
const baseInput = screen.getByPlaceholderText(
137-
'Search base by ID number or author email',
137+
'Search base by ID number, author email or bug number',
138138
);
139139
const repoDropdown = screen.getByRole('button', { name: 'Base' });
140140

@@ -160,13 +160,15 @@ describe('Base and OverTime Search', () => {
160160

161161
// Search input appears
162162
expect(
163-
screen.getByPlaceholderText(/Search base by ID number or author email/i),
163+
screen.getByPlaceholderText(
164+
/Search base by ID number, author email or bug number/i,
165+
),
164166
).toBeInTheDocument();
165167

166168
await expandOverTimeComponent();
167169
expect(
168170
screen.getAllByPlaceholderText(
169-
/Search revision by ID number or author email/i,
171+
/Search revision by ID number, author email or bug number/i,
170172
)[1],
171173
).toBeInTheDocument();
172174

@@ -299,11 +301,11 @@ describe('Base and OverTime Search', () => {
299301
// - once for [email protected]
300302
// The call to coconut@python.co was debounced.
301303
expect(global.fetch).not.toHaveBeenCalledWith(
302-
'https://treeherder.mozilla.org/api/project/try/push/?author_contains=johncleese%40python.co',
304+
'https://treeherder.mozilla.org/api/project/try/push/?search=johncleese%40python.co',
303305
undefined,
304306
);
305307
expect(global.fetch).toHaveBeenCalledWith(
306-
'https://treeherder.mozilla.org/api/project/try/push/?author_contains=johncleese%40python.com',
308+
'https://treeherder.mozilla.org/api/project/try/push/?search=johncleese%40python.com',
307309
undefined,
308310
);
309311
expect(global.fetch).toHaveBeenCalledTimes(4);
@@ -319,7 +321,7 @@ describe('Base and OverTime Search', () => {
319321
act(() => void jest.runAllTimers());
320322

321323
expect(global.fetch).toHaveBeenCalledWith(
322-
'https://treeherder.mozilla.org/api/project/try/push/?author_contains=terrygilliam%40python.com',
324+
'https://treeherder.mozilla.org/api/project/try/push/?search=terrygilliam%40python.com',
323325
undefined,
324326
);
325327

src/__tests__/Search/SelectedRevision.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ describe('SelectedRevision', () => {
7373
expect(baseDropdown).toHaveTextContent('try');
7474

7575
const firstSearchInput = screen.getAllByPlaceholderText(
76-
'Search base by ID number or author email',
76+
'Search base by ID number, author email or bug number',
7777
)[0];
7878
await user.click(firstSearchInput);
7979
await user.click(

0 commit comments

Comments
 (0)