From d1d6ce474ba211af86a5ea7d5bfe66753a0a6605 Mon Sep 17 00:00:00 2001 From: TobenderZephyr Date: Sat, 10 Apr 2021 20:14:29 +0200 Subject: [PATCH] jest throws no errors --- __tests__/functions/CountOccurences.js | 8 +++++--- __tests__/functions/Roll.js | 16 ++++++++++------ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/__tests__/functions/CountOccurences.js b/__tests__/functions/CountOccurences.js index 80dcf7d..d5cefb2 100644 --- a/__tests__/functions/CountOccurences.js +++ b/__tests__/functions/CountOccurences.js @@ -1,4 +1,6 @@ -const CountOccurrences = require('@dsabot/CountOccurences'); +const { + CountOccurences +} = require('../../functions/CountOccurences'); test('Counting Occurences', () => { - expect(CountOccurrences([1, 2, 3, 4, 1],1)).toBe(2); - }); \ No newline at end of file + expect(CountOccurences([1, 2, 3, 4, 1], 1)).toBe(2); +}); \ No newline at end of file diff --git a/__tests__/functions/Roll.js b/__tests__/functions/Roll.js index 350dd6d..9dc7eb8 100644 --- a/__tests__/functions/Roll.js +++ b/__tests__/functions/Roll.js @@ -1,10 +1,14 @@ -const Roll = require('@dsabot/Roll'); +const { + roll +} = require('../../functions/Roll'); -describe('Beware of a misunderstanding! A sequence of dice rolls', () => { - const expected = [1,2,3,4,5,6]; - it('matches even with an unexpected number 7', () => { - expect(Roll(1,6)).not.toEqual( +describe('rolling dice', () => { + const expected = [1, 2, 3, 4, 5, 6]; + it('contain only numbers from 1 to 6', () => { + expect(roll(100, 6).dice).toEqual( expect.arrayContaining(expected), ); }); -}); \ No newline at end of file +}); + +//todo: return sum \ No newline at end of file