From 66caf177ee93fa1ab0a76d5e15b3bc35c8144180 Mon Sep 17 00:00:00 2001 From: Jim O'Donnell Date: Fri, 25 Oct 2024 15:36:31 +0100 Subject: [PATCH] fix the subject picker tests --- .../SubjectPicker/SubjectPicker.spec.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/app-project/src/shared/components/SubjectPicker/SubjectPicker.spec.js b/packages/app-project/src/shared/components/SubjectPicker/SubjectPicker.spec.js index ff197fd9abe..5d48b56e7cc 100644 --- a/packages/app-project/src/shared/components/SubjectPicker/SubjectPicker.spec.js +++ b/packages/app-project/src/shared/components/SubjectPicker/SubjectPicker.spec.js @@ -10,6 +10,16 @@ describe('Components > Subject Picker', function () { let columnHeadings, displayName, link, tableRows before(async function () { + nock('https://panoptes-staging.zooniverse.org') + .get('/api/subjects/selection') + .query(true) + .reply(200, { + subjects: [ + { id: 1, already_seen: false, retired: false }, + { id: 2, already_seen: true, retired: false }, + { id: 3, already_seen: true, retired: true } + ] + }) const DefaultStory = composeStory(Default, Meta) await applyRequestHandlers(DefaultStory.parameters.msw) render() @@ -25,11 +35,7 @@ describe('Components > Subject Picker', function () { '24 January 1916', '25 January 1916' ] - tableRows = [] - subjects.forEach(async subject => { - const row = await within(tableContent).findByText(subject) - tableRows.push(row) - }) + tableRows = subjects.map(async subject => await within(tableContent).findByText(subject)) await Promise.all(tableRows) }) @@ -41,7 +47,7 @@ describe('Components > Subject Picker', function () { expect(columnHeadings).to.exist() }) - it.skip('should have a row for each subject', function () { + it('should have a row for each subject', function () { expect(tableRows.length).to.equal(3) })