fixed console warn tests

This commit is contained in:
Becky Gilbert 2020-10-16 18:37:57 -07:00
parent 5050d636a4
commit 76946122e8
2 changed files with 6 additions and 4 deletions

View File

@ -153,6 +153,8 @@ describe('image-button-response', function(){
});
test('should show console warning when trial duration is null and response ends trial is false', function() {
const spy = jest.spyOn(console, 'warn').mockImplementation();
var trial = {
type: 'image-button-response',
stimulus: '../media/blue.png',
@ -166,8 +168,7 @@ describe('image-button-response', function(){
auto_preload: false
});
spy = jest.spyOn(console, 'warn').mockImplementation();
expect(console.warn).toHaveBeenCalledWith("The experiment may be stuck in a loop. Try setting a trial duration or set response_ends_trial to true.");
expect(spy).toHaveBeenCalled();
spy.mockRestore();
});
});

View File

@ -126,6 +126,8 @@ describe('image-keyboard-response', function(){
test('should show console warning when trial duration is null and response ends trial is false', function() {
const spy = jest.spyOn(console, 'warn').mockImplementation();
var trial = {
type: 'image-keyboard-response',
stimulus: '../media/blue.png',
@ -139,8 +141,7 @@ describe('image-keyboard-response', function(){
auto_preload: false
});
spy = jest.spyOn(console, 'warn').mockImplementation();
expect(console.warn).toHaveBeenCalledWith("The experiment may be stuck in a loop. Try setting a trial duration or set response_ends_trial to true.");
expect(spy).toHaveBeenCalled();
spy.mockRestore();
});
});