Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
feat: 🎸 modify tests for type param
Browse files Browse the repository at this point in the history
  • Loading branch information
Rashi1997 committed Aug 10, 2020
1 parent feda8f1 commit bcd213d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
node_modules
coverage
test.js
testapp.js
8 changes: 4 additions & 4 deletions tests/fixation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
});
});
35 changes: 0 additions & 35 deletions tests/showEarnings.spec.js

This file was deleted.

8 changes: 4 additions & 4 deletions tests/showMessage.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
});
});
2 changes: 1 addition & 1 deletion tests/userId.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});

0 comments on commit bcd213d

Please sign in to comment.