Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MR414N-ID
GitHub Repository: MR414N-ID/botku2
Path: blob/master/node_modules/@bochilteam/scraper/lib/esm/news/test.js
1126 views
1
import { expect } from 'chai';
2
import { cnbindonesia, antaranews, kompas, suaracom, liputan6, merdeka } from './index.js';
3
describe('News', () => {
4
it('CNB indonesia', (done) => {
5
cnbindonesia().then(data => {
6
expect(data).to.be.an('array');
7
expect(data).to.have.length.at.least(1);
8
data.forEach(({ title, link, image, label, date }) => {
9
expect(title).to.be.a('string');
10
expect(link).to.be.a('string');
11
expect(image).to.be.a('string');
12
expect(label).to.be.a('string');
13
expect(date).to.be.a('string');
14
});
15
return done();
16
}).catch(done);
17
});
18
it('antaranews', (done) => {
19
antaranews().then(data => {
20
expect(data).to.be.an('array');
21
expect(data).to.have.length.at.least(1);
22
data.forEach(({ title, link, image, label, date }) => {
23
expect(title).to.be.a('string');
24
expect(link).to.be.a('string');
25
expect(image).to.be.a('string');
26
expect(label).to.be.a('string');
27
expect(date).to.be.a('string');
28
});
29
return done();
30
}).catch(done);
31
});
32
it('kompas', (done) => {
33
kompas().then(data => {
34
expect(data).to.be.an('array');
35
data.forEach(({ title, link, image, label, date }) => {
36
expect(title).to.be.a('string');
37
expect(link).to.be.a('string');
38
expect(image).to.be.a('string');
39
expect(label).to.be.a('string');
40
expect(date).to.be.a('string');
41
});
42
return done();
43
}).catch(done);
44
});
45
it('Suara.com', (done) => {
46
suaracom().then(data => {
47
expect(data).to.be.an('array');
48
data.forEach(({ title, link, image, description, date }) => {
49
expect(title).to.be.a('string');
50
expect(link).to.be.a('string');
51
expect(image).to.be.a('string');
52
expect(description).to.be.a('string');
53
expect(date).to.be.a('string');
54
});
55
return done();
56
}).catch(done);
57
});
58
it('Liputan6', (done) => {
59
liputan6().then(data => {
60
expect(data).to.be.an('array');
61
data.forEach(({ title, link, image, description, label, date }) => {
62
expect(title).to.be.a('string');
63
expect(link).to.be.a('string');
64
expect(image).to.be.a('string');
65
expect(description).to.be.a('string');
66
expect(label).to.be.a('string');
67
expect(date).to.be.a('string');
68
});
69
return done();
70
}).catch(done);
71
});
72
it('Merdeka', (done) => {
73
merdeka().then(data => {
74
expect(data).to.be.an('array');
75
data.forEach(({ title, link, image, label, date }) => {
76
expect(title).to.be.a('string');
77
expect(link).to.be.a('string');
78
expect(image).to.be.a('string');
79
expect(label).to.be.a('string');
80
expect(date).to.be.a('string');
81
});
82
return done();
83
}).catch(done);
84
});
85
});
86
//# sourceMappingURL=test.js.map
87