forked from marcbachmann/npm-module-search
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
21 lines (17 loc) · 903 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
var assert = require('assert')
var npmSearch = require('./')
npmSearch.search('test', function (err, modules) {
assert(err == null, 'Error is null')
assert(Array.isArray(modules), 'Expect search to return an array')
var module = modules[0]
assert(typeof module.name === 'string', 'Expect name to be defined')
assert(typeof module.version === 'string', 'Expect version to be defined')
assert(typeof module.author === 'string', 'Expect author to be a string')
assert(typeof module.description === 'string', 'Expect description to be a string')
assert(typeof module.stars === 'number', 'Expect stars to be a number')
})
npmSearch.search('test', {limit: 26}, function (err, modules) {
assert(Array.isArray(modules), 'Expect search to return an array')
assert(modules.length === 26, 'Expect exact limit count')
})
process.on('exit', function () { console.log('Executed all tests') })