-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.js
53 lines (45 loc) · 1.29 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* global describe, it */
const assert = require('chai').assert
const wikiquote = require('./')
describe('wikiquote', () => {
it('should run tests', () => {
return assert(1 !== 2 && wikiquote !== undefined)
})
it('should search for people', () => {
return wikiquote.searchPeople('steve jobs')
.then(pages => {
assert(pages[0].title === 'Steve Jobs')
})
})
it('should get a random quote', () => {
return wikiquote.getRandomQuote('Steve Jobs')
.then(quote => {
assert(quote.length > 0)
})
})
it('should search by title', () => {
return wikiquote.searchByTitle('Steve Jobs')
.then(page => {
assert(page[0].title === 'Steve Jobs')
})
})
it('should get page sections', () => {
return wikiquote.getPageSections('Steve Jobs')
.then(sections => {
assert(sections.title === 'Steve Jobs')
assert(sections.sections.length > 0)
})
})
it('should search wikiquote', () => {
return wikiquote.search('Classical economics')
.then(results => {
assert(results[0].title === 'Classical economics')
})
})
it('should list quotes given a page title', () => {
return wikiquote.list('Adam Smith')
.then(results => {
assert(results.length > 0)
})
})
})