forked from 15Dkatz/official_joke_api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
21 lines (18 loc) · 616 Bytes
/
Copy pathtest.js
File metadata and controls
21 lines (18 loc) · 616 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const { randomJoke, randomTen, jokeById } = require('./handler');
console.log('randomJoke', randomJoke());
console.log('randomTen', randomTen());
it('should render the joke with an id of 1', () => {
expect(jokeById(1)).toEqual(
{
"id": 1,
"type": "general",
"setup": "What did the fish say when it hit the wall?",
"punchline": "Dam."
}
);
});
it('should return undefined with an invalid id', () => {
expect(jokeById('one')).toEqual(undefined);
expect(jokeById('1')).toEqual(undefined);
expect(jokeById()).toEqual(undefined);
});