mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-04-08 11:54:12 +00:00
Basic test suite for Canvas
This commit is contained in:
parent
719c8d199d
commit
612bb5e605
33
lib/models/_canvas.spec.coffee
Normal file
33
lib/models/_canvas.spec.coffee
Normal file
@ -0,0 +1,33 @@
|
||||
nock = require('nock')
|
||||
url = require('url')
|
||||
|
||||
chai = require('chai')
|
||||
chaiAsPromised = require('chai-as-promised')
|
||||
expect = chai.expect
|
||||
chai.use(chaiAsPromised)
|
||||
|
||||
canvas = require('./_canvas')
|
||||
config = require('../config')
|
||||
|
||||
URI =
|
||||
application: url.resolve(config.apiPrefix, 'application')
|
||||
|
||||
RESPONSE =
|
||||
applications:
|
||||
d: [
|
||||
{ id: 1 }
|
||||
{ id: 2 }
|
||||
]
|
||||
|
||||
describe 'Canvas:', ->
|
||||
|
||||
beforeEach ->
|
||||
nock(config.remoteUrl)
|
||||
.get(URI.application)
|
||||
.reply(200, RESPONSE.applications)
|
||||
|
||||
it 'should construct the correct url', ->
|
||||
promise = canvas.get
|
||||
resource: 'application'
|
||||
|
||||
expect(promise).to.become(RESPONSE.applications.d)
|
@ -22,7 +22,8 @@
|
||||
"mocha-notifier-reporter": "~0.1.0",
|
||||
"gulp-coffeelint": "~0.4.0",
|
||||
"nock": "~0.48.2",
|
||||
"mock-fs": "~2.3.2"
|
||||
"mock-fs": "~2.3.2",
|
||||
"chai-as-promised": "~4.1.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"request": "~2.47.0",
|
||||
|
Loading…
x
Reference in New Issue
Block a user