-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.js
39 lines (32 loc) · 880 Bytes
/
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
35
36
37
38
39
const {describe} = require('riteway');
const {formatPlace, formatPrice} = require('./sogral-scraper');
const given = 'some samples';
const should = 'return the expected output';
describe('formatPlace', async (assert) => {
const nameSamples = [
"mahdia",
"El Azizia",
"CONSTANTINE /PALMA", "CONSTANTINE/ ALI MENDJELI", "CONSTANTINE/SAHRAOUI TAHAR",
"ANNABA/AZZABA",
];
assert({
given,
should,
actual: nameSamples.map(formatPlace),
expected: [
"MAHDIA",
"EL AZIZIA",
"CONSTANTINE / PALMA", "CONSTANTINE / ALI MENDJELI", "CONSTANTINE / SAHRAOUI TAHAR",
"ANNABA / AZZABA",
]
});
});
describe('formatPrice', async (assert) => {
const priceSamples = ["1830 DA DA", "340.00 DA", "150 DA"];
assert({
given,
should,
actual: priceSamples.map(formatPrice),
expected: [1830, 340, 150]
});
});