* chore(deps-dev): bump prettier from 2.8.8 to 3.0.0 Bumps [prettier](https://github.com/prettier/prettier) from 2.8.8 to 3.0.0. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/2.8.8...3.0.0) --- updated-dependencies: - dependency-name: prettier dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * reformat all the things (prettier 3) * update tests to await calls to prettier.format() --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: chris48s <git@chris-shaw.dev>
60 lines
1.8 KiB
JavaScript
60 lines
1.8 KiB
JavaScript
import { expect } from 'chai'
|
|
import nock from 'nock'
|
|
import { cleanUpNockAfterEach, defaultContext } from '../test-helpers.js'
|
|
import Wheelmap from './wheelmap.service.js'
|
|
|
|
describe('Wheelmap', function () {
|
|
cleanUpNockAfterEach()
|
|
|
|
const token = 'abc123'
|
|
const config = { private: { wheelmap_token: token } }
|
|
|
|
function createMock({ nodeId, wheelchair }) {
|
|
const scope = nock('https://wheelmap.org')
|
|
.get(`/api/nodes/${nodeId}`)
|
|
.query({ api_key: token })
|
|
|
|
if (wheelchair) {
|
|
return scope.reply(200, { node: { wheelchair } })
|
|
} else {
|
|
return scope.reply(404)
|
|
}
|
|
}
|
|
|
|
it('node with accessibility', async function () {
|
|
const nodeId = '26699541'
|
|
const scope = createMock({ nodeId, wheelchair: 'yes' })
|
|
expect(
|
|
await Wheelmap.invoke(defaultContext, config, { nodeId }),
|
|
).to.deep.equal({ message: 'yes', color: 'brightgreen' })
|
|
scope.done()
|
|
})
|
|
|
|
it('node with limited accessibility', async function () {
|
|
const nodeId = '2034868974'
|
|
const scope = createMock({ nodeId, wheelchair: 'limited' })
|
|
expect(
|
|
await Wheelmap.invoke(defaultContext, config, { nodeId }),
|
|
).to.deep.equal({ message: 'limited', color: 'yellow' })
|
|
scope.done()
|
|
})
|
|
|
|
it('node without accessibility', async function () {
|
|
const nodeId = '-147495158'
|
|
const scope = createMock({ nodeId, wheelchair: 'no' })
|
|
expect(
|
|
await Wheelmap.invoke(defaultContext, config, { nodeId }),
|
|
).to.deep.equal({ message: 'no', color: 'red' })
|
|
scope.done()
|
|
})
|
|
|
|
it('node not found', async function () {
|
|
const nodeId = '0'
|
|
const scope = createMock({ nodeId })
|
|
expect(
|
|
await Wheelmap.invoke(defaultContext, config, { nodeId }),
|
|
).to.deep.equal({ message: 'node not found', color: 'red', isError: true })
|
|
scope.done()
|
|
})
|
|
})
|