relocate tests on core library

This commit is contained in:
Josh de Leeuw 2018-06-25 15:18:23 -04:00
parent 243c49dc74
commit c112f930c1
5 changed files with 22 additions and 41 deletions

View File

@ -1,11 +1,13 @@
const utils = require('./testing-utils.js'); const utils = require('../testing-utils.js');
beforeEach(function(){
require('../../jspsych.js');
require('../../plugins/jspsych-html-keyboard-response.js');
})
describe('on_finish (trial)', function(){ describe('on_finish (trial)', function(){
test('should get an object of data generated by the trial', function(){ test('should get an object of data generated by the trial', function(){
require('../jspsych.js');
require('../plugins/jspsych-html-keyboard-response.js');
return (new Promise(function(resolve, reject){ return (new Promise(function(resolve, reject){
var key_data = null; var key_data = null;
@ -32,9 +34,6 @@ describe('on_finish (trial)', function(){
test('should be able to write to the data', function(){ test('should be able to write to the data', function(){
require('../jspsych.js');
require('../plugins/jspsych-html-keyboard-response.js');
return (new Promise(function(resolve, reject){ return (new Promise(function(resolve, reject){
var promise_data = {}; var promise_data = {};
@ -67,9 +66,7 @@ describe('on_finish (trial)', function(){
describe('on_start (trial)', function(){ describe('on_start (trial)', function(){
test('should get trial data with function parameters evaluated', function(){ test('should get trial data with function parameters evaluated', function(){
require('../jspsych.js');
require('../plugins/jspsych-html-keyboard-response.js');
return (new Promise(function(resolve, reject){ return (new Promise(function(resolve, reject){
var d = null; var d = null;
@ -95,9 +92,7 @@ describe('on_start (trial)', function(){
}); });
test('should get trial data with timeline variables evaluated', function(){ test('should get trial data with timeline variables evaluated', function(){
require('../jspsych.js');
require('../plugins/jspsych-html-keyboard-response.js');
return (new Promise(function(resolve, reject){ return (new Promise(function(resolve, reject){
var d = null; var d = null;
@ -128,9 +123,7 @@ describe('on_start (trial)', function(){
describe('on_trial_finish (experiment level)', function(){ describe('on_trial_finish (experiment level)', function(){
test('should get an object containing the trial data', function(){ test('should get an object containing the trial data', function(){
require('../jspsych.js');
require('../plugins/jspsych-html-keyboard-response.js');
return (new Promise(function(resolve, reject){ return (new Promise(function(resolve, reject){
var promise_data = {}; var promise_data = {};
@ -159,9 +152,7 @@ describe('on_trial_finish (experiment level)', function(){
}); });
test('should allow writing to the data object', function(){ test('should allow writing to the data object', function(){
require('../jspsych.js');
require('../plugins/jspsych-html-keyboard-response.js');
return (new Promise(function(resolve, reject){ return (new Promise(function(resolve, reject){
var promise_data = {}; var promise_data = {};
@ -193,9 +184,7 @@ describe('on_trial_finish (experiment level)', function(){
describe('on_data_update', function(){ describe('on_data_update', function(){
test('should get an object containing the trial data', function(){ test('should get an object containing the trial data', function(){
require('../jspsych.js');
require('../plugins/jspsych-html-keyboard-response.js');
return (new Promise(function(resolve, reject){ return (new Promise(function(resolve, reject){
var promise_data = {}; var promise_data = {};
@ -224,9 +213,7 @@ describe('on_data_update', function(){
}); });
test('should contain data added with on_finish (trial level)', function(){ test('should contain data added with on_finish (trial level)', function(){
require('../jspsych.js');
require('../plugins/jspsych-html-keyboard-response.js');
return (new Promise(function(resolve, reject){ return (new Promise(function(resolve, reject){
var promise_data = {}; var promise_data = {};
@ -258,9 +245,7 @@ describe('on_data_update', function(){
}); });
test('should contain data added with on_trial_finish (experiment level)', function(){ test('should contain data added with on_trial_finish (experiment level)', function(){
require('../jspsych.js');
require('../plugins/jspsych-html-keyboard-response.js');
return (new Promise(function(resolve, reject){ return (new Promise(function(resolve, reject){
var promise_data = {}; var promise_data = {};
@ -295,9 +280,7 @@ describe('on_data_update', function(){
describe('on_trial_start', function(){ describe('on_trial_start', function(){
test('should get an object containing the trial properties', function(){ test('should get an object containing the trial properties', function(){
require('../jspsych.js');
require('../plugins/jspsych-html-keyboard-response.js');
return (new Promise(function(resolve, reject){ return (new Promise(function(resolve, reject){
var promise_data = {}; var promise_data = {};
@ -326,9 +309,7 @@ describe('on_trial_start', function(){
}); });
test('should allow modification of the trial properties', function(){ test('should allow modification of the trial properties', function(){
require('../jspsych.js');
require('../plugins/jspsych-html-keyboard-response.js');
var trial = { var trial = {
type: 'html-keyboard-response', type: 'html-keyboard-response',
stimulus: 'hello' stimulus: 'hello'

View File

@ -1,4 +1,4 @@
const root = '../'; const root = '../../';
require(root + 'jspsych.js'); require(root + 'jspsych.js');

View File

@ -1,5 +1,5 @@
const root = '../'; const root = '../../';
const utils = require('./testing-utils.js'); const utils = require('../testing-utils.js');
beforeEach(function(){ beforeEach(function(){
require(root + 'jspsych.js'); require(root + 'jspsych.js');

View File

@ -1,5 +1,5 @@
const root = '../'; const root = '../../';
const utils = require('./testing-utils.js'); const utils = require('../testing-utils.js');
beforeEach(function(){ beforeEach(function(){
require(root + 'jspsych.js'); require(root + 'jspsych.js');

View File

@ -1,5 +1,5 @@
const root = '../'; const root = '../../';
const utils = require('./testing-utils.js'); const utils = require('../testing-utils.js');
beforeEach(function(){ beforeEach(function(){
require(root + 'jspsych.js'); require(root + 'jspsych.js');