greuge filter backend unit test file

This commit is contained in:
Carlos Jimenez 2018-01-17 14:50:21 +01:00
parent 044786661a
commit 125c8019ed
1 changed files with 70 additions and 0 deletions

View File

@ -0,0 +1,70 @@
import app from '../../../../server/server';
import {catchErrors} from '../../../../../../services/utils/jasmineHelpers';
import {restoreFixtures} from '../../../../../../services/db/testing_fixtures';
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
describe('Greuge filter', () => {
beforeEach(() => {
restoreFixtures();
});
let params = {
page: 5,
size: 10,
order: 'DESC'
};
it('should call the filterParams method', () => {
app.models.Client.filterParams(params);
});
// it("should not find Deadpool as he's not created yet", done => {
// app.models.Account.findOne({where: {name: newAccountData.userName}})
// .then(account => {
// expect(account).toEqual(null);
// app.models.Client.findOne({where: {name: newAccountData.name}})
// .then(client => {
// expect(client).toEqual(null);
// done();
// });
// })
// .catch(catchErrors(done));
// });
// it('should not be able to create a user if exists', done => {
// app.models.Client.findOne({where: {name: 'Charles Xavier'}})
// .then(client => {
// let formerAccountData = {
// name: client.name,
// userName: client.userName,
// email: client.email,
// fi: client.fi,
// socialName: client.socialName
// };
// expect(app.models.Client.createUserProfile(formerAccountData)).toBeFalsy();
// done();
// });
// });
// awaiting for fixtures
// it('should create a new account', done => {
// app.models.Client.createUserProfile(data => {
// app.models.Account.findOne({where: {name: data.userName}})
// .then(account => {
// expect(account.name).toEqual(data.userName);
// app.models.Client.findOne({where: {name: data.name}})
// .then(client => {
// expect(client.id).toEqual(account.id);
// expect(client.name).toEqual(data.name);
// expect(client.email).toEqual(data.email);
// expect(client.fi).toEqual(data.fi);
// expect(client.socialName).toEqual(data.socialName);
// done();
// });
// })
// .catch(catchErrors(done));
// });
// });
});