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/others/test.js
1126 views
1
import { expect } from 'chai';
2
import { wikipedia, jadwalTV, jadwalTVNow, mediafiredl, gempa, gempaNow, tsunami, lyrics, kbbi, nameFreeFire, bioskopNow, bioskop } from './index.js';
3
describe('Others', () => {
4
// TODO
5
describe('Minecraft', () => {
6
// it('Minecraft java', done => {
7
// statusJava('moelsmp2.mcalias.com', 25566).then(res => {
8
// expect(res).to.be.an('object')
9
// expect(res.ip).to.be.a('string')
10
// expect(res.port).to.be.a('number')
11
// expect(res.description).to.be.a('string')
12
// expect(res.descriptionText).to.be.a('string')
13
// expect(res.players).to.be.an('object')
14
// expect(res.players.max).to.be.a('number')
15
// expect(res.players.online).to.be.a('number')
16
// expect(res.players.sample).to.be.an('array')
17
// expect(res.version).to.be.an('object')
18
// expect(res.version.name).to.be.a('string')
19
// expect(res.version.protocol).to.be.a('number')
20
// expect(res.favicon).to.be.a('string')
21
// return done()
22
// }).catch(done)
23
// })
24
});
25
it('Wikipedia', (done) => {
26
wikipedia('Minecraft', 'en').then(res => {
27
expect(res).to.be.an('object');
28
expect(res.title).to.be.a('string');
29
expect(res.img).to.be.a('string');
30
expect(res.articles).to.be.a('string');
31
return done();
32
}).catch(done);
33
});
34
describe('Jadwal TV', () => {
35
it('Jadwal TV', done => {
36
jadwalTV('RCTI').then(res => {
37
expect(res).to.be.an('object');
38
expect(res.channel).to.be.a('string');
39
expect(res.result).to.be.an('array');
40
expect(res.result).to.have.lengthOf.at.least(1);
41
return done();
42
}).catch(done);
43
});
44
it('Jadwal TV NOW', done => {
45
jadwalTVNow().then(res => {
46
expect(res).to.be.an('object');
47
Object.keys(res).forEach(key => {
48
expect(key).to.be.a('string');
49
expect(res[key]).to.be.an('array');
50
expect(res[key]).to.have.lengthOf.at.least(2);
51
});
52
return done();
53
}).catch(done);
54
});
55
});
56
describe('Mediafire', () => {
57
it('Mediafire Download', done => {
58
mediafiredl('https://www.mediafire.com/file/gpeiucmm1xo6ln0/hello_world.mp4/file').then(res => {
59
expect(res).to.be.an('object');
60
expect(res.url).to.be.a('string');
61
expect(res.url2).to.be.a('string');
62
expect(res.filename).to.be.a('string');
63
expect(res.filetype).to.be.a('string');
64
expect(res.ext).to.be.a('string');
65
expect(res.aploud).to.be.a('string');
66
expect(res.filesizeH).to.be.a('string');
67
expect(res.filesize).to.be.a('number');
68
return done();
69
}).catch(done);
70
});
71
});
72
describe('Gempa', () => {
73
it('Gempa', done => {
74
gempa().then(res => {
75
expect(res).to.be.an('array');
76
res.forEach(({ date, locate, magnitude, depth, location, warning }) => {
77
expect(date).to.be.a('string');
78
expect(locate).to.be.a('string');
79
expect(magnitude).to.be.a('string');
80
expect(depth).to.be.a('string');
81
expect(location).to.be.a('string');
82
expect(warning).to.be.an('array');
83
warning.forEach(s => expect(s).to.be.a('string'));
84
});
85
return done();
86
}).catch(done);
87
});
88
it('Gempa Now', done => {
89
gempaNow().then(res => {
90
expect(res).to.be.an('array');
91
res.forEach(({ date, latitude, longitude, magnitude, depth, location }) => {
92
expect(date).to.be.a('string');
93
expect(latitude).to.be.a('string');
94
expect(longitude).to.be.a('string');
95
expect(magnitude).to.be.a('string');
96
expect(depth).to.be.a('string');
97
expect(location).to.be.a('string');
98
});
99
return done();
100
}).catch(done);
101
});
102
});
103
it('Tsunami', (done) => {
104
tsunami().then(res => {
105
expect(res).to.be.an('array');
106
res.forEach(({ date, locate, magnitude, depth, location }) => {
107
expect(date).to.be.a('string');
108
expect(locate).to.be.a('string');
109
expect(magnitude).to.be.a('string');
110
expect(depth).to.be.a('string');
111
expect(location).to.be.a('string');
112
});
113
return done();
114
}).catch(done);
115
});
116
describe('Lyrics', () => {
117
it('Lyrics', done => {
118
lyrics('rick astley never gonna give you up').then(res => {
119
expect(res).to.be.an('object');
120
expect(res.title).to.be.a('string');
121
expect(res.author).to.be.a('string');
122
expect(res.lyrics).to.be.a('string');
123
expect(res.link).to.be.a('string');
124
return done();
125
}).catch(done);
126
});
127
// it('Lyrics V2', done => {
128
// lyricsv2('never gonna give you up').then(res => {
129
// expect(res.title).to.be.a('string')
130
// expect(res.author).to.be.a('string')
131
// expect(res.lyrics).to.be.a('string')
132
// expect(res.link).to.be.a('string')
133
// return done()
134
// }).catch(done)
135
// })
136
});
137
it('KBBI', done => {
138
kbbi('halo').then(res => {
139
expect(res).to.be.an('array');
140
res.forEach(({ index, title, means }) => {
141
expect(index).to.be.a('number');
142
expect(title).to.be.a('string');
143
expect(means).to.be.an('array');
144
means.forEach((mean) => expect(mean).to.be.a('string'));
145
});
146
return done();
147
}).catch(done);
148
});
149
it('ID Free Fire', done => {
150
nameFreeFire('821587717').then(res => {
151
expect(res).to.be.an('object');
152
expect(res.username).to.be.a('string');
153
expect(res.id).to.be.a('string');
154
return done();
155
}).catch(done);
156
});
157
describe('Bioskop', () => {
158
it('Bioskop now', done => {
159
bioskopNow().then(res => {
160
expect(res).to.be.an('array');
161
expect(res).to.have.lengthOf.at.least(1);
162
res.forEach(({ title, img, url, genre, duration, playingAt }) => {
163
expect(title).to.be.a('string');
164
expect(img).to.be.a('string');
165
expect(url).to.be.a('string');
166
expect(genre).to.be.a('string');
167
expect(duration).to.be.a('string');
168
expect(playingAt).to.be.a('string');
169
});
170
return done();
171
}).catch(done);
172
});
173
it('Bioskop', done => {
174
bioskop().then(res => {
175
expect(res).to.be.an('array');
176
expect(res).to.have.lengthOf.at.least(1);
177
res.forEach(({ title, img, url, genre, duration, release, director, cast }) => {
178
expect(title).to.be.a('string');
179
expect(img).to.be.a('string');
180
expect(url).to.be.a('string');
181
expect(genre).to.be.a('string');
182
expect(duration).to.be.a('string');
183
expect(release).to.be.a('string');
184
expect(director).to.be.a('string');
185
expect(cast).to.be.an('string');
186
});
187
return done();
188
}).catch(done);
189
});
190
});
191
});
192
//# sourceMappingURL=test.js.map
193