Skip to content

Instantly share code, notes, and snippets.

@yellowred
Created September 28, 2016 04:46
Show Gist options
  • Save yellowred/d8e40d280d852f946dfa1ce507f9d797 to your computer and use it in GitHub Desktop.
Save yellowred/d8e40d280d852f946dfa1ce507f9d797 to your computer and use it in GitHub Desktop.
loopback save array of records BDD
'use strict'
const chakram = require('chakram')
const expect = chakram.expect
const Promise = require('bluebird')
let config = {
API_URL: process.env.API_URL ? process.env.API_URL : 'http://0.0.0.0:3015/api/',
headers: null
}
describe('financials', () => {
it('should save a bunch of financials', () => {
return Promise.coroutine(function * () {
const body = [
{ amount: 100, date: "2016-08-10 10:30:05", rate: 1, uuid: "AA-BB-CC"},
{ amount: 200, date: "2016-08-10 10:50:05", rate: 1, uuid: "AA-BB-CC"},
]
const res = yield chakram.post(
config.API_URL + 'financials',
body,
{headers: config.headers}
)
expect(res).to.have.status(200)
})()
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment