From b4c9a0b0d65d8e23baf6a44ecb260649dd3d1e9c Mon Sep 17 00:00:00 2001 From: Becky Gilbert Date: Fri, 16 Oct 2020 17:14:22 -0700 Subject: [PATCH] wrap expected errors in anonymous function --- tests/jsPsych.data/datacollection.test.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/jsPsych.data/datacollection.test.js b/tests/jsPsych.data/datacollection.test.js index 6bc80984..f6160e26 100644 --- a/tests/jsPsych.data/datacollection.test.js +++ b/tests/jsPsych.data/datacollection.test.js @@ -68,8 +68,12 @@ describe('DataCollection', function(){ expect(jsPsych.data.get().first(3).count()).toBe(3); expect(jsPsych.data.get().first(2).values()[1].rt).toBe(200); expect(jsPsych.data.get().first().count()).toBe(1); - expect(jsPsych.data.get().first(-1)).toThrow(); - expect(jsPsych.data.get().first(0)).toThrow(); + expect(() => { + jsPsych.data.get().first(-1) + }).toThrow(); + expect(() => { + jsPsych.data.get().first(0) + }).toThrow(); expect(jsPsych.data.get().filter({foo: "bar"}).first(1).count()).toBe(0); var n = jsPsych.data.get().count(); var too_many = n+1; @@ -79,8 +83,12 @@ describe('DataCollection', function(){ expect(jsPsych.data.get().last(2).count(2)).toBe(2); expect(jsPsych.data.get().last(2).values()[0].rt).toBe(400); expect(jsPsych.data.get().last().count()).toBe(1); - expect(jsPsych.data.get().last(-1)).toThrow(); - expect(jsPsych.data.get().last(0)).toThrow(); + expect(() => { + jsPsych.data.get().last(-1) + }).toThrow(); + expect(() => { + jsPsych.data.get().last(0) + }).toThrow(); expect(jsPsych.data.get().filter({foo: "bar"}).last(1).count()).toBe(0); var n = jsPsych.data.get().count(); var too_many = n+1;