Merge branch 'dev' of https://git.verdnatura.es/salix into dev
This commit is contained in:
commit
dc0cd5c539
|
@ -56,17 +56,16 @@ module.exports = function(Client) {
|
|||
}
|
||||
}
|
||||
|
||||
Client.app.models.Address.find(filter, function(err, instances) {
|
||||
Client.app.models.Address.find(filter, function(err, results) {
|
||||
if (err)
|
||||
return callback(err, null);
|
||||
response('find', instances);
|
||||
response('find', results);
|
||||
});
|
||||
|
||||
Client.app.models.Address.count(filter.where, function(err, total) {
|
||||
Client.app.models.Address.count(filter.where, function(err, result) {
|
||||
if (err)
|
||||
return callback(err, null);
|
||||
response('total', total);
|
||||
response('total', result);
|
||||
});
|
||||
};
|
||||
|
||||
};
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
import app from '../../../../server/server';
|
||||
import {catchErrors} from '../../../../../../services/utils/jasmineHelpers';
|
||||
|
||||
describe('Client addresses', () => {
|
||||
it('should call the addressesList method and receive total results and results of 2 as it has only 2 addresses', done => {
|
||||
let id = 1;
|
||||
let params = {
|
||||
page: 10,
|
||||
size: 30
|
||||
};
|
||||
|
||||
let callback = (error, result) => {
|
||||
if (error) return catchErrors(done)(error);
|
||||
|
||||
expect(result).toEqual(jasmine.objectContaining({
|
||||
total: 2
|
||||
}));
|
||||
done();
|
||||
};
|
||||
app.models.Client.addressesList(id, params, callback);
|
||||
});
|
||||
});
|
|
@ -3,7 +3,7 @@ import {catchErrors} from '../../../../../../services/utils/jasmineHelpers';
|
|||
import restoreFixtures from '../../../../../../services/db/testing_fixtures';
|
||||
|
||||
describe('Client Create', () => {
|
||||
let fixturesToApply = {tables: ['`account`.`user`', '`vn`.`client`'], inserts: [
|
||||
let fixturesToApply = {tables: ['`account`.`user`', '`vn2008`.`Clientes`', '`vn2008`.`Consignatarios`'], inserts: [
|
||||
`INSERT INTO account.user(id,name,password,role,active,email)
|
||||
VALUES
|
||||
(1, 'BruceWayne', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'BruceWayne@verdnatura.es'),
|
||||
|
@ -18,6 +18,19 @@ describe('Client Create', () => {
|
|||
(10, 'JessicaJones', 'ac754a330530832ba1bf7687f577da91', 9, 1, 'JessicaJones@verdnatura.es'),
|
||||
(11, 'Cyborg', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'cyborg@verdnatura.es');
|
||||
|
||||
INSERT INTO salix.Address(id, consignee, street, city, postcode, provinceFk, phone, mobile, isEnabled, isDefaultAddress, clientFk, defaultAgencyFk, longitude, latitude, isEqualizated)
|
||||
VALUES
|
||||
(1, 'Bruce Wayne', 'The Bat cave', 'Silla', 46460, 1, NULL, NULL, 1, 1, 1, 2, NULL, NULL, 1),
|
||||
(2, 'Petter Parker', 'NY roofs', 'Silla', 46460, 1, NULL, NULL, 1, 1, 2, 2, NULL, NULL, 1),
|
||||
(3, 'Clark Kenn', 'The phone box', 'Silla', 46460, 1, NULL, NULL, 1, 1, 3, 2, NULL, NULL, 1),
|
||||
(4, 'Tony Stark', 'Stark tower', 'Silla', 46460, 1, NULL, NULL, 1, 1, 4, 2, NULL, NULL, 1),
|
||||
(5, 'Max Eisenhardt', 'The plastic cell', 'Silla', 46460, 1, NULL, NULL, 1, 1, 5, 2, NULL, NULL, 1),
|
||||
(6, 'David Charles Haller', 'Many places', 'Silla', 46460, 1, NULL, NULL, 1, 1, 6, 2, NULL, NULL, 1),
|
||||
(7, 'Hank Pym', 'Your pocket', 'Silla', 46460, 1, NULL, NULL, 1, 1, 7, 2, NULL, NULL, 1),
|
||||
(8, 'Charles Xavier', 'Cerebro', 'Silla', 46460, 1, NULL, NULL, 1, 1, 8, 2, NULL, NULL, 1),
|
||||
(9, 'Bruce Banner', 'Somewhere in Thailand', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 1),
|
||||
(10,'Jessica Jones', 'Luke Cages Bar', 'Silla', 46460, 1, NULL, NULL, 1, 1, 10, 2, NULL, NULL, 1);
|
||||
|
||||
INSERT INTO vn.client(id,name,fi,socialName,contact,street,city,postcode,phone,mobile,fax,isRelevant,email,iban,dueDay,accountingAccount,isEqualizated,provinceFk,hasToInvoice,credit,countryFk,isActive,gestdocFk,quality,payMethodFk,created,isToBeMailed,contactChannelFk,hasSepaVnl,hasCoreVnl,hasCoreVnh,riskCalculated,clientTypeFk,mailAddress,cplusTerIdNifFk,hasToInvoiceByAddress,isTaxDataChecked,isFreezed,creditInsurance,isCreatedAsServed,hasInvoiceSimplified,salesPersonFk,isVies,eypbc)
|
||||
VALUES
|
||||
(1, 'Bruce Wayne', '74451390E', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceWayne@verdnatura.es', NULL, 0, 1234567890, 1, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 1, 0, 1 ),
|
||||
|
@ -30,6 +43,7 @@ describe('Client Create', () => {
|
|||
(8, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'CharlesXavier@verdnatura.es', NULL, 0, 1234567890, 1, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 4, 0, 1 ),
|
||||
(9, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceBanner@verdnatura.es', NULL, 0, 1234567890, 1, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 4, 0, 1 ),
|
||||
(10, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'JessicaJones@verdnatura.es', NULL, 0, 1234567890, 1, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 4, 0, 1 );`
|
||||
|
||||
]};
|
||||
|
||||
beforeEach(done => {
|
||||
|
|
|
@ -23,7 +23,7 @@ let insertFixtures = (inserts, callback) => {
|
|||
|
||||
let truncate = (tables, callback) => {
|
||||
let truncatesSQL = tables.reduce((accumulator, currentValue, i) => {
|
||||
let sql = 'DELETE FROM ' + currentValue + '; ';
|
||||
let sql = 'TRUNCATE TABLE ' + currentValue + '; ';
|
||||
return (`${accumulator}${sql}`);
|
||||
}, '');
|
||||
|
||||
|
|
Loading…
Reference in New Issue