-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreport.test.js
34 lines (32 loc) · 911 Bytes
/
report.test.js
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
27
28
29
30
31
32
33
34
const {sortPages} = require('./report');
const {test, expect} = require('@jest/globals');
test('sortPages 2 pages', () => {
const input = {
'https://blog.boot.dev/path': 1,
'https://blog.boot.dev': 3
}
const actual = sortPages(input)
const expected = [
['https://blog.boot.dev', 3],
['https://blog.boot.dev/path', 1]
]
expect(actual).toEqual(expected)
})
test('sortPages 5 pages', () => {
const input = {
'https://blog.boot.dev/path': 1,
'https://blog.boot.dev': 3,
'https://blog.boot.dev/path2': 5,
'https://blog.boot.dev/path3': 2,
'https://blog.boot.dev/path4': 9
}
const actual = sortPages(input)
const expected = [
['https://blog.boot.dev/path4', 9],
['https://blog.boot.dev/path2', 5],
['https://blog.boot.dev', 3],
['https://blog.boot.dev/path3', 2],
['https://blog.boot.dev/path', 1]
]
expect(actual).toEqual(expected)
})