Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
hiddenSummaryWorkflow = WorkflowFactory.build({
configuration: {
hide_classification_summaries: true
},
steps: [
['S1', { taskKeys: ['T1'] }],
['S2', { taskKeys: ['T2'] }]
],
tasks: {
T1: SingleChoiceTaskFactory.build(),
T2: MultipleChoiceTaskFactory.build()
}
})
subjects = Factory.buildList('subject', 10)
subject = subjects[0]
})
describe('Model > SubjectStore', function () {
const longListSubjects = Factory.buildList('subject', 10)
const shortListSubjects = Factory.buildList('subject', 2)
function mockSubjectStore (subjects) {
const project = ProjectFactory.build()
const workflow = WorkflowFactory.build({ id: project.configuration.default_workflow })
const client = stubPanoptesJs({ subjects, workflows: workflow })
const store = RootStore.create({
classifications: {},
dataVisAnnotating: {},
drawing: {},
feedback: {},
fieldGuide: {},
subjectViewer: {},
tutorials: {},
workflowSteps: {},
userProjectPreferences: {}
import taskRegistry from '@plugins/tasks'
const { AnnotationModel: SingleChoiceAnnotation } = taskRegistry.get('single')
const feedbackRulesStub = {
T0: [{
id: 'testRule',
answer: '0',
strategy: 'singleAnswerQuestion',
successEnabled: true,
successMessage: 'Yay!',
failureEnabled: true,
failureMessage: 'No!'
}]
}
const subjectsStub = Factory.buildList('subject', 10)
const singleChoiceTaskStub = SingleChoiceTaskFactory.build()
const singleChoiceAnnotationStub = SingleChoiceAnnotationFactory.build()
const workflowStub = WorkflowFactory.build({ tasks: { T0: singleChoiceTaskStub } })
const projectStub = ProjectFactory.build({}, { activeWorkflowId: workflowStub.id })
describe('Model > ClassificationStore', function () {
function setupStores (stores) {
const clientStub = stubPanoptesJs({ classifications: [], subjects: subjectsStub })
const store = RootStore.create(stores, {
client: clientStub,
authClient: { checkBearerToken: () => Promise.resolve(), checkCurrent: () => Promise.resolve() }
})
store.projects.setResource(projectStub)
store.projects.setActive(projectStub.id)
store.workflows.setResource(workflowStub)
store.workflows.setActive(workflowStub.id)
describe('Model > SubjectStore', function () {
const longListSubjects = Factory.buildList('subject', 10)
const shortListSubjects = Factory.buildList('subject', 2)
function mockSubjectStore (subjects) {
const project = ProjectFactory.build()
const workflow = WorkflowFactory.build({ id: project.configuration.default_workflow })
const client = stubPanoptesJs({ subjects, workflows: workflow })
const store = RootStore.create({
classifications: {},
dataVisAnnotating: {},
drawing: {},
feedback: {},
fieldGuide: {},
subjectViewer: {},
tutorials: {},
workflowSteps: {},
userProjectPreferences: {}
}, {