From d6fbdbee09fa73f09752be55a3054cb18d812a87 Mon Sep 17 00:00:00 2001 From: Jim O'Donnell Date: Thu, 7 Nov 2024 10:00:37 +0000 Subject: [PATCH] test the length of the mock classification --- .../lib-classifier/src/store/ClassificationStore.spec.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/lib-classifier/src/store/ClassificationStore.spec.js b/packages/lib-classifier/src/store/ClassificationStore.spec.js index f9a8bd2c0cf..3955d6dcfc6 100644 --- a/packages/lib-classifier/src/store/ClassificationStore.spec.js +++ b/packages/lib-classifier/src/store/ClassificationStore.spec.js @@ -135,6 +135,7 @@ describe('Model > ClassificationStore', function () { clock.tick(1 * 60 * 60 * 1000) // wait for one hour before starting the classification. classifications.addAnnotation(taskSnapshot, singleChoiceAnnotationSnapshot.value) clock.tick(30 * 1000) // wait for 30 seconds before finishing the classification. + classifications.addAnnotation(taskSnapshot, 1) classifications.completeClassification() }) @@ -151,6 +152,13 @@ describe('Model > ClassificationStore', function () { const finishedAt = submittedClassification.metadata.finished_at expect(finishedAt).to.equal('2024-11-06T14:00:30.000Z') }) + + it('should only record time spent classifying', function () { + const startedAt = submittedClassification.metadata.started_at + const finishedAt = submittedClassification.metadata.finished_at + const timeSpent = (new Date(finishedAt) - new Date(startedAt)) / 1000 + expect(timeSpent).to.equal(30) + }) }) describe('with invalid feedback', function () {