lol-api-client
Version:
A Node client for interfacing with the League of Legends API
49 lines (41 loc) • 927 B
JavaScript
const Champions = require('../lib/champions')
require('dotenv').config({ silent: true })
const champions = new Champions(process.env['RIOT_API_KEY'], 'na')
exports.getAll = function (test) {
champions.getAll()
.then((data) => {
test.ok(data)
test.done()
})
}
exports.getById = {
failsOnInvalidChampionId (test) {
champions.getById(9999999)
.catch((error) => {
test.ok(error)
test.done()
})
},
valid (test) {
champions.getById(266)
.then((champion) => {
test.ok(champion)
test.done()
})
}
}
exports.getAllStaticData = function (test) {
champions.getAllStaticData()
.then((data) => {
test.ok(data['data']['Aatrox'])
test.done()
})
}
exports.getStaticDataById = function (test) {
champions.getStaticDataById(266)
.then((data) => {
test.equal(data.name, 'Aatrox')
test.done()
})
}