Merge with dev
This commit is contained in:
commit
cba0645f92
|
@ -1,6 +1,6 @@
|
||||||
import app from '../../../server/server';
|
const app = require('../../../server/server');
|
||||||
import routes from '../routes';
|
const routes = require('../routes');
|
||||||
import restoreFixtures from '../../../../../services/db/testing_fixtures';
|
const restoreFixtures = require('../../../../../services/db/testing_fixtures');
|
||||||
|
|
||||||
describe('Auth routes', () => {
|
describe('Auth routes', () => {
|
||||||
let fixturesToApply = {tables: ['`salix`.`user`'], inserts: [
|
let fixturesToApply = {tables: ['`salix`.`user`'], inserts: [
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import totalGreuge from '../total';
|
const totalGreuge = require('../total');
|
||||||
import {catchErrors} from '../../../../../../services/utils/jasmineHelpers';
|
const catchErrors = require('../../../../../../services/utils/jasmineHelpers').catchErrors;
|
||||||
|
|
||||||
describe('Greuge totalGreuge()', () => {
|
describe('Greuge totalGreuge()', () => {
|
||||||
it('should call the sumAmount method', done => {
|
it('should call the sumAmount method', done => {
|
||||||
|
|
|
@ -32,11 +32,10 @@ let truncate = (tables, callback) => {
|
||||||
|
|
||||||
connection.connect();
|
connection.connect();
|
||||||
|
|
||||||
export default function restoreFixtures(fixturesToApply, callback) {
|
module.exports = function restoreFixtures(fixturesToApply, callback) {
|
||||||
connection.query('SET FOREIGN_KEY_CHECKS = 0', () => {
|
connection.query('SET FOREIGN_KEY_CHECKS = 0', () => {
|
||||||
truncate(fixturesToApply.tables, () => {
|
truncate(fixturesToApply.tables, () => {
|
||||||
insertFixtures(fixturesToApply.inserts, callback);
|
insertFixtures(fixturesToApply.inserts, callback);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import app from '../../../../server/server';
|
const app = require('../../../../server/server');
|
||||||
import {catchErrors} from '../../../../../../services/utils/jasmineHelpers';
|
const catchErrors = require('../../../../../../services/utils/jasmineHelpers').catchErrors;
|
||||||
import restoreFixtures from '../../../../../../services/db/testing_fixtures';
|
const restoreFixtures = require('../../../../../../services/db/testing_fixtures');
|
||||||
|
|
||||||
describe('Client addressesPropagateRe', () => {
|
describe('Client addressesPropagateRe', () => {
|
||||||
let fixturesToApply = {tables: ['`account`.`user`', '`vn2008`.`Clientes`', '`vn2008`.`Consignatarios`'], inserts: [
|
let fixturesToApply = {tables: ['`account`.`user`', '`vn2008`.`Clientes`', '`vn2008`.`Consignatarios`'], inserts: [
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import app from '../../../../server/server';
|
const app = require('../../../../server/server');
|
||||||
import {catchErrors} from '../../../../../../services/utils/jasmineHelpers';
|
const catchErrors = require('../../../../../../services/utils/jasmineHelpers').catchErrors;
|
||||||
|
|
||||||
describe('Client card', () => {
|
describe('Client card', () => {
|
||||||
it('should call the card() method to receive a formated card of Bruce Wayne', done => {
|
it('should call the card() method to receive a formated card of Bruce Wayne', done => {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import app from '../../../../server/server';
|
const app = require('../../../../server/server');
|
||||||
import {catchErrors} from '../../../../../../services/utils/jasmineHelpers';
|
const catchErrors = require('../../../../../../services/utils/jasmineHelpers').catchErrors;
|
||||||
import restoreFixtures from '../../../../../../services/db/testing_fixtures';
|
const restoreFixtures = require('../../../../../../services/db/testing_fixtures');
|
||||||
|
|
||||||
describe('Client Create', () => {
|
describe('Client Create', () => {
|
||||||
let fixturesToApply = {tables: ['`account`.`user`', '`vn2008`.`Clientes`', '`vn2008`.`Consignatarios`'], inserts: [
|
let fixturesToApply = {tables: ['`account`.`user`', '`vn2008`.`Clientes`', '`vn2008`.`Consignatarios`'], inserts: [
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import app from '../../../../server/server';
|
const app = require('../../../../server/server');
|
||||||
import {catchErrors} from '../../../../../../services/utils/jasmineHelpers';
|
const catchErrors = require('../../../../../../services/utils/jasmineHelpers').catchErrors;
|
||||||
|
|
||||||
describe('Client hasCustomerRole', () => {
|
describe('Client hasCustomerRole', () => {
|
||||||
it('should call the hasCustomerRole() method with a customer id', done => {
|
it('should call the hasCustomerRole() method with a customer id', done => {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import app from '../../../../server/server';
|
const app = require('../../../../server/server');
|
||||||
import {catchErrors} from '../../../../../../services/utils/jasmineHelpers';
|
const catchErrors = require('../../../../../../services/utils/jasmineHelpers');
|
||||||
|
|
||||||
describe('Client addresses', () => {
|
describe('Client addresses', () => {
|
||||||
it('should call the listAddresses method and receive total results and items', done => {
|
it('should call the listAddresses method and receive total results and items', done => {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import app from '../../../../server/server';
|
const app = require('../../../../server/server');
|
||||||
import {catchErrors} from '../../../../../../services/utils/jasmineHelpers';
|
const catchErrors = require('../../../../../../services/utils/jasmineHelpers').catchErrors;
|
||||||
|
|
||||||
describe('Client listWorkers', () => {
|
describe('Client listWorkers', () => {
|
||||||
it('should call the listWorkers()', done => {
|
it('should call the listWorkers()', done => {
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
const app = require('../../../../server/server');
|
||||||
|
const catchErrors = require('../../../../../../services/utils/jasmineHelpers').catchErrors;
|
||||||
|
|
||||||
|
describe('Client activeSalesPerson', () => {
|
||||||
|
it('should call the activeSalesPerson() method with limit of 1', done => {
|
||||||
|
let filter = {
|
||||||
|
limit: 1
|
||||||
|
};
|
||||||
|
|
||||||
|
let callback = (error, result) => {
|
||||||
|
if (error) return catchErrors(done)(error);
|
||||||
|
|
||||||
|
expect(result.length).toEqual(1);
|
||||||
|
done();
|
||||||
|
};
|
||||||
|
|
||||||
|
app.models.Client.activeSalesPerson(filter, callback);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should call the activeSalesPerson() method with no limit and receive all 3 salesPersons', done => {
|
||||||
|
let filter = {
|
||||||
|
};
|
||||||
|
|
||||||
|
let callback = (error, result) => {
|
||||||
|
if (error) return catchErrors(done)(error);
|
||||||
|
|
||||||
|
expect(result.length).toEqual(3);
|
||||||
|
done();
|
||||||
|
};
|
||||||
|
|
||||||
|
app.models.Client.activeSalesPerson(filter, callback);
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,8 +1,8 @@
|
||||||
export function catchErrors(done) {
|
module.exports.catchErrors = function(done) {
|
||||||
return error => {
|
return error => {
|
||||||
if (error instanceof Error) {
|
if (error instanceof Error) {
|
||||||
return done.fail(error.stack);
|
return done.fail(error.stack);
|
||||||
}
|
}
|
||||||
return done.fail(JSON.stringify(error));
|
return done.fail(JSON.stringify(error));
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
require('babel-core/register')({presets: ['es2015']});
|
|
||||||
|
|
||||||
process.env.NODE_ENV = 'test';
|
process.env.NODE_ENV = 'test';
|
||||||
|
|
||||||
process.on('warning', warning => {
|
process.on('warning', warning => {
|
||||||
|
|
Loading…
Reference in New Issue