Skip to content

Commit

Permalink
fix the subject picker tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eatyourgreens committed Oct 25, 2024
1 parent ee80eec commit 66caf17
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(<DefaultStory />)
Expand All @@ -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)
})

Expand All @@ -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)
})

Expand Down

0 comments on commit 66caf17

Please sign in to comment.