-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.test.js
More file actions
26 lines (21 loc) · 770 Bytes
/
script.test.js
File metadata and controls
26 lines (21 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const googleSearch = require('./script');
dbMock = ['dog.com', 'cheesepuff.com', 'disney.com', 'dogpictures.com'];
describe('googleSearch', () => {
it('is a silly test', () => {
expect('hello').toBe('hello');
});
it('is searching google', () => {
expect(googleSearch('testtest', dbMock)).toEqual([]);
expect(googleSearch('dog', dbMock)).toEqual([
'dog.com',
'dogpictures.com'
]);
});
it('work with undefined and null input', () => {
expect(googleSearch(undefined, dbMock)).toEqual([]);
expect(googleSearch(null, dbMock)).toEqual([]);
});
it('does not return more than 3 matches', () => {
expect(googleSearch('.com', dbMock).length).toEqual(3);
});
});