-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.test.mjs
31 lines (27 loc) · 914 Bytes
/
index.test.mjs
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
import { strictEqual } from 'node:assert'
import { describe, it } from 'node:test'
import countPackages from './index.mjs'
describe('2021/01', () => {
it('Ejemplo 01', () => {
const carriers = [
['dapelu', 5, ['midu', 'jelowing']],
['midu', 2, []],
['jelowing', 2, []],
]
// 5 de dapelu, 2 de midu y 2 de jelowing = 9
strictEqual(countPackages(carriers, 'dapelu'), 9)
})
it('Ejemplo 02', () => {
const carriers = [
['lolivier', 8, ['camila', 'jesuspoleo']],
['camila', 5, ['sergiomartinez', 'conchaasensio']],
['jesuspoleo', 4, []],
['sergiomartinez', 4, []],
['conchaasensio', 3, ['facundocapua', 'faviola']],
['facundocapua', 2, []],
['faviola', 1, []],
]
// 5 de camila, 4 de sergiomartinez, 3 de conchaasensio, 2 de facundocapua y 1 de faviola = 15
strictEqual(countPackages(carriers, 'camila'), 15)
})
})