diff --git a/.gitignore b/.gitignore index 47e88fd..7045ed0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ node_modules coverage -test.js \ No newline at end of file +testapp.js \ No newline at end of file diff --git a/tests/fixation.spec.js b/tests/fixation.spec.js index bbeed54..2cfecab 100644 --- a/tests/fixation.spec.js +++ b/tests/fixation.spec.js @@ -5,7 +5,7 @@ const jsPsych = require('jspsych-react') describe('Fixation trial', () => { it('fixation without photodiode box', () => { const config = init({USE_PHOTODIODE: false}); - const result = fixation(100, config, false); + const result = fixation('html_keyboard_response', 100, config, false); expect(result.stimulus).toContain('fixation-dot'); expect(result.stimulus).not.toContain('photodiode-spot'); expect(result.on_load()).toEqual(null); @@ -16,7 +16,7 @@ describe('Fixation trial', () => { it('fixation with photodiode box and task code', () => { const config = init({USE_PHOTODIODE: true}); let data = { code: null } - const result = fixation(100, config, false,10,10); + const result = fixation('html_keyboard_response', 100, config, false,10,10); expect(result.stimulus).toContain('fixation-dot'); expect(result.stimulus).toContain('photodiode-spot'); expect(result.on_load()).not.toEqual(null); @@ -25,14 +25,14 @@ describe('Fixation trial', () => { it('fixation with jsPsych.NO_KEYS', () => { const config = init({USE_PHOTODIODE: false}); - const result = fixation(100, config, false, undefined, undefined, jsPsych.NO_KEYS); + const result = fixation('html_keyboard_response', 100, config, false, undefined, undefined, jsPsych.NO_KEYS); expect(result.choices).toEqual(undefined); }); it('fixation with choices', () => { const config = init({USE_PHOTODIODE: false}); const choices = ['p','q'] - const result = fixation(100, config, false, undefined, undefined, choices); + const result = fixation('html_keyboard_response', 100, config, false, undefined, undefined, choices); expect(result.choices).toEqual(choices); }); }); \ No newline at end of file diff --git a/tests/showEarnings.spec.js b/tests/showEarnings.spec.js deleted file mode 100644 index 8535b63..0000000 --- a/tests/showEarnings.spec.js +++ /dev/null @@ -1,35 +0,0 @@ -const showEarnings = require('../trials/showEarnings.js'); -const {init} = require('../app.js'); - -describe('showEarnings trial', () => { - it('showEarnings without photodiode box', () => { - const config = init({USE_PHOTODIODE: false}); - const result = showEarnings(100, config, 10, false); - expect(result.on_load()).toEqual(null); - expect(result.on_finish()).toEqual(null); - expect(result.stimulus).toContain('beads_container'); - expect(result.stimulus).not.toContain('photodiode-spot'); - }); - - it('showEarnings with photodiode box', () => { - const config = init({USE_PHOTODIODE: true}); - let data = { code: null } - const result = showEarnings(100, config, 10, false,10,10); - expect(result.on_load()).toEqual(undefined); - expect(result.on_finish(data)).toEqual(10); - expect(result.stimulus).toContain('beads_container'); - expect(result.stimulus).toContain('photodiode-spot'); - }); - - it('check for earnings less than 0 with text-danger', () => { - const config = init({USE_PHOTODIODE: true}); - const result = showEarnings(100, config, -1, false,10,10); - expect(result.stimulus).toContain('text-danger') - }); - - it('check for earnings greater than 0 with text-success', () => { - const config = init({USE_PHOTODIODE: true}); - const result = showEarnings(100, config, 10, false,10,10); - expect(result.stimulus).toContain('text-success') - }); - }); \ No newline at end of file diff --git a/tests/showMessage.spec.js b/tests/showMessage.spec.js index ba7758d..aa81f73 100644 --- a/tests/showMessage.spec.js +++ b/tests/showMessage.spec.js @@ -6,7 +6,7 @@ describe('showMessage trial', () => { it('showMessage without photodiode box', () => { const config = init({USE_PHOTODIODE: false}); const message = 'Experiment Start' - const result = showMessage(100, config, message, false); + const result = showMessage('html_keyboard_response',100, config, message, false); expect(result.stimulus).toContain(message); expect(result.stimulus).not.toContain('photodiode-spot'); expect(result.on_load()).toEqual(null); @@ -18,7 +18,7 @@ describe('showMessage trial', () => { const config = init({USE_PHOTODIODE: true}); const message = 'Experiment Start' let data = { code: null } - const result = showMessage(100, config, message, false,10,10); + const result = showMessage('html_keyboard_response',100, config, message, false,10,10); expect(result.stimulus).toContain(message); expect(result.stimulus).toContain('photodiode-spot'); expect(result.on_load()).not.toEqual(null); @@ -27,14 +27,14 @@ describe('showMessage trial', () => { it('showMessage with jsPsych.NO_KEYS', () => { const config = init({USE_PHOTODIODE: false}); - const result = showMessage(100, config, false, undefined, undefined, undefined, jsPsych.NO_KEYS); + const result = showMessage('html_button_response',100, config, false, undefined, undefined, undefined, jsPsych.NO_KEYS); expect(result.choices).toEqual(undefined); }); it('showMessage with choices', () => { const config = init({USE_PHOTODIODE: false}); const choices = ['p','q'] - const result = showMessage(100, config, false, undefined, undefined, undefined, choices); + const result = showMessage('html_button_response',100, config, false, undefined, undefined, undefined, choices); expect(result.choices).toEqual(choices); }); }); \ No newline at end of file diff --git a/tests/userId.spec.js b/tests/userId.spec.js index 927a3c3..8650bd4 100644 --- a/tests/userId.spec.js +++ b/tests/userId.spec.js @@ -6,7 +6,7 @@ describe('userId trial', () => { it('check for set ID message', () => { const config = init({USE_MTURK: true}); const setIdMessage = "Setting User ID" - const result = userId(jsPsych, 100, config, setIdMessage, false); + const result = userId(jsPsych, 'html_keyboard_response', 100, config, setIdMessage, false); expect(result.stimulus).toContain(setIdMessage); }); }); \ No newline at end of file