UNPKG

trailpack-proxy-cart

Version:

eCommerce - Trailpack for Proxy Engine

65 lines (55 loc) 2.01 kB
'use strict' /* global describe, it */ const assert = require('assert') const supertest = require('supertest') const _ = require('lodash') describe('Admin User TransactionController', () => { let adminUser, userID, customerID before((done) => { adminUser = supertest.agent(global.app.packs.express.server) // Login as Admin adminUser .post('/auth/local') .set('Accept', 'application/json') //set header for this test .send({username: 'admin', password: 'admin1234'}) .expect(200) .end((err, res) => { assert.ok(res.body.user.id) assert.ok(res.body.user.current_customer_id) userID = res.body.user.id customerID = res.body.user.current_customer_id done(err) }) }) it('should exist', () => { assert(global.app.api.controllers['TransactionController']) }) it.skip('should create a transaction',() => { }) it.skip('should update a transaction',() => { }) it.skip('should retry a transaction',() => { }) it.skip('should destroy a transaction',() => { }) it('It should get transactions', (done) => { adminUser .get('/transactions') .expect(200) .end((err, res) => { assert.ok(res.headers['x-pagination-total']) assert.ok(res.headers['x-pagination-pages']) assert.ok(res.headers['x-pagination-page']) assert.ok(res.headers['x-pagination-limit']) assert.ok(res.headers['x-pagination-offset']) assert.ok(res.headers['x-pagination-sort']) assert.equal(_.isNumber(parseInt(res.headers['x-pagination-total'])), true) assert.equal(_.isNumber(parseInt(res.headers['x-pagination-offset'])), true) assert.equal(_.isNumber(parseInt(res.headers['x-pagination-limit'])), true) assert.equal(_.isNumber(parseInt(res.headers['x-pagination-page'])), true) assert.equal(_.isNumber(parseInt(res.headers['x-pagination-pages'])), true) assert.ok(res.body) done(err) }) }) })