relevant-urban
Advanced tools
Comparing version 1.2.1 to 1.2.2
{ | ||
"name": "relevant-urban", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "Urban Dictionary API wrapper made for everyone with useful methods using promises and snekfetch", | ||
@@ -21,3 +21,4 @@ "main": "urban.js", | ||
"lint": "eslint urban.js test/test.js", | ||
"check": "node test/test.js" | ||
"lint:fix": "eslint --fix urban.js test/test.js", | ||
"check": "ava -v" | ||
}, | ||
@@ -24,0 +25,0 @@ "repository": { |
const urban = require('../urban.js'); | ||
const line = '\n' + '-'.repeat(40); | ||
const test = require('ava'); | ||
const print = urBan => console.log( | ||
`${urBan.id} | ${urBan.word}\n\n${urBan.definition}` + | ||
line); | ||
test('Fetching random urban definition', t => urban.random() | ||
.then(d =>t.truthy(d)) | ||
.catch(e => t.falsy(e))); | ||
console.log(line); | ||
test('Fetching \'hello\' urban definition', t => urban('hello') | ||
.then(d =>t.truthy(d)) | ||
.catch(e => t.falsy(e))); | ||
urban.random() | ||
.then(print); | ||
test('Fetching \'fsiojgjsgjsgihsghghjsh\' urban definition', t => urban('fsiojgjsgjsgihsghghjsh') | ||
.then(d =>t.falsy(d)) | ||
.catch(e => t.falsy(e))); | ||
urban('hello') | ||
.then(print); | ||
test('Fetching random specific urban definition', t => urban.random('hello') | ||
.then(d =>t.truthy(d)) | ||
.catch(e => t.falsy(e))); | ||
urban.all('hello') | ||
.then(u => print(u[0])); | ||
urban.random('hello') | ||
.then(print); | ||
test('Fetching all specific urban definitions', t => urban.all('hello') | ||
.then(d =>t.true(typeof d == 'object')) | ||
.catch(e => t.falsy(e))); |
@@ -8,3 +8,3 @@ const snekfetch = require('snekfetch'); | ||
.then(res => res.body) | ||
.then(body => body.result_type == 'no_results' ? null : body); | ||
.then(body => body.result_type == 'no_results' ? Promise.reject(null) : body); | ||
} | ||
@@ -18,3 +18,3 @@ | ||
sounds: body.sounds | ||
}) : null); | ||
}) : Promise.reject(null)); | ||
} | ||
@@ -28,3 +28,3 @@ | ||
sounds: body.sounds | ||
}) : null); | ||
}) : Promise.reject(null)); | ||
} | ||
@@ -41,3 +41,3 @@ | ||
sounds: body.sounds | ||
}) : null); | ||
}) : Promise.reject(null)); | ||
} | ||
@@ -44,0 +44,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8608
151