@cedarstudios/cedarmaps
Version:
A node.js and browser JavaScript client to CedarMaps services.
36 lines (29 loc) • 680 B
JavaScript
const test = require('ava')
const index = require('../index')
const validExports = [
'distance',
'direction',
'tile',
'forwardGeocoding',
'reverseGeocoding',
'Constants'
]
test('Should export a function', t => {
t.is(typeof index, 'function')
})
test('Should fail when not providing an API key', t => {
t.throws(() => index(), Error)
})
test('Should not accept none string API key', t => {
t.throws(() => index(123), Error)
})
test('Should export valid properties', t => {
t.plan(validExports.length)
const exportedObjects = index('123')
const keys = Object.keys(exportedObjects)
keys.forEach(key => {
if (validExports.includes(key)) {
t.pass()
}
})
})