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