wordreference-definition-api
Version:
Scrap word definitions from http://www.wordreference.com
27 lines (24 loc) • 921 B
JavaScript
const { wrDefinition } = require('./../index')
const expect = require('expect')
const definition = wrDefinition()
describe('Node tests (maybe browser in the future)', function() {
this.timeout(10000)
it('Should be empty array', async () => {
let data = await definition.define('antedakdjskdjsad')
expect(data).toHaveLength(0)
})
it('Should catch the error', async () => {
let data = await definition.define(undefined)
.catch(() => true)
expect(data).toBe(true)
})
it('Should be valid definition for booleans', async () => {
let data = await definition.define(true)
let data2 = await definition.define(false)
expect(data).not.toHaveLength(0)
expect(data2).not.toHaveLength(0)
})
it('Should not throw an error for number', async () => {
await definition.define(10)
})
})