From f15fc8ff7f55956fd5a40f7e7962507edbe59909 Mon Sep 17 00:00:00 2001 From: Jim O'Donnell Date: Fri, 25 Oct 2024 10:49:47 +0100 Subject: [PATCH] fix fetchStatuses.spec.js --- .../helpers/fetchStatuses.spec.js | 47 ++++++++++--------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/packages/app-project/src/shared/components/SubjectPicker/helpers/fetchStatuses.spec.js b/packages/app-project/src/shared/components/SubjectPicker/helpers/fetchStatuses.spec.js index e4e583ba58..b9ec6f44b0 100644 --- a/packages/app-project/src/shared/components/SubjectPicker/helpers/fetchStatuses.spec.js +++ b/packages/app-project/src/shared/components/SubjectPicker/helpers/fetchStatuses.spec.js @@ -1,33 +1,18 @@ import nock from 'nock' -import sinon from 'sinon' -import { fetchStatuses, fetchSubjects } from './' +import { fetchStatuses } from './' -describe.skip('Components > Subject Picker > helpers > fetchStatuses', function () { +describe('Components > Subject Picker > helpers > fetchStatuses', function () { let subjects const expectedData = [ - { subject_id: 1, page: '43', date_with_space: '23 January 1916', status: 'SubjectPicker.unclassified' }, - { subject_id: 2, page: '44', date_with_space: '24 January 1916', status: 'SubjectPicker.alreadySeen' }, - { subject_id: 3, page: '45', date_with_space: '25 January 1916', status: 'SubjectPicker.retired' }, + { subject_id: 1, page: '43', date: '23 January 1916', status: 'SubjectPicker.unclassified' }, + { subject_id: 2, page: '44', date: '24 January 1916', status: 'SubjectPicker.alreadySeen' }, + { subject_id: 3, page: '45', date: '25 January 1916', status: 'SubjectPicker.retired' }, ] before(async function () { - const columns = [ - 'subject_id', - 'Page', - 'Date. With space' - ] - const rows = [ - [1, '43', '23 January 1916'], - [2, '44', '24 January 1916'], - [3, '45', '25 January 1916'] - ] const workflow = { id: '1' } - const subjectsAPI = nock('https://subject-set-search-api.zooniverse.org/subjects') - .get('/1.json') - .query(true) - .reply(200, { columns, rows }) const panoptes = nock('https://panoptes-staging.zooniverse.org/api') .get('/subjects/selection') .query(true) @@ -38,7 +23,27 @@ describe.skip('Components > Subject Picker > helpers > fetchStatuses', function { id: 3, already_seen: true, retired: true } ] }) - const panoptesSubjects = await fetchSubjects('1') + const panoptesSubjects = [ + { + subject_id: 1, + page: '43', + date: '23 January 1916', + status: 'loading' + }, + { + subject_id: 2, + page: '44', + date: '24 January 1916', + status: 'loading' + }, + { + subject_id: 3, + page: '45', + date: '25 January 1916', + status: 'loading' + } + ] + subjects = await fetchStatuses(panoptesSubjects, workflow) })