refactor test #649
This commit is contained in:
parent
7a0dad9db3
commit
1002b39694
|
@ -1,19 +1,24 @@
|
|||
const app = require(`${servicesDir}/client/server/server`);
|
||||
const restoreFixtures = require(`${servicesDir}/db/testing_fixtures`);
|
||||
|
||||
describe('Client Create', () => {
|
||||
let sqlStatements = {deletes: `
|
||||
DELETE FROM vn.address WHERE nickname = 'Wade';
|
||||
DELETE FROM vn.client WHERE name = 'Wade';
|
||||
DELETE FROM account.user WHERE name = 'Deadpool';
|
||||
`, inserts: ``, updates: ``};
|
||||
const clientName = 'Wade';
|
||||
const AccountName = 'Deadpool';
|
||||
/* beforeAll(async() => {
|
||||
let address = await app.models.Address.findOne({where: {nickname: clientName}});
|
||||
let client = await app.models.Client.findOne({where: {name: clientName}});
|
||||
let account = await app.models.Account.findOne({where: {name: AccountName}});
|
||||
await app.models.Address.destroyById(address.id);
|
||||
await app.models.Client.destroyById(client.id);
|
||||
await app.models.Account.destroyById(account.id);
|
||||
}); */
|
||||
|
||||
beforeAll(() => {
|
||||
restoreFixtures(sqlStatements);
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
restoreFixtures(sqlStatements);
|
||||
afterAll(async() => {
|
||||
let address = await app.models.Address.findOne({where: {nickname: clientName}});
|
||||
let client = await app.models.Client.findOne({where: {name: clientName}});
|
||||
let account = await app.models.Account.findOne({where: {name: AccountName}});
|
||||
await app.models.Address.destroyById(address.id);
|
||||
await app.models.Client.destroyById(client.id);
|
||||
await app.models.Account.destroyById(account.id);
|
||||
});
|
||||
|
||||
let newAccount = {
|
||||
|
|
Loading…
Reference in New Issue