mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
Added db reset to new e2e framework
- Ensure that the DB is always reset between tests - We assume that the DB will be torn down and rebuilt between tests - Without this, previous tests clobber the current tests, and it's not possible to tell when running files in isolation which makes developing really tricky
This commit is contained in:
parent
f1b71f7fd7
commit
82d2228bca
2 changed files with 4 additions and 5 deletions
|
@ -20,10 +20,6 @@ describe('Authentication API canary', function () {
|
||||||
agent = await framework.getAgent('/ghost/api/canary/admin/');
|
agent = await framework.getAgent('/ghost/api/canary/admin/');
|
||||||
});
|
});
|
||||||
|
|
||||||
after(async function () {
|
|
||||||
await framework.resetDb();
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
emailStub = framework.stubMail();
|
emailStub = framework.stubMail();
|
||||||
});
|
});
|
||||||
|
|
|
@ -45,6 +45,9 @@ const startGhost = async () => {
|
||||||
server: false
|
server: false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Ensure the DB state
|
||||||
|
await resetDb();
|
||||||
|
|
||||||
return boot(defaults);
|
return boot(defaults);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -105,7 +108,7 @@ const getFixture = (type, index = 0) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const resetDb = async () => {
|
const resetDb = async () => {
|
||||||
await db.teardown();
|
await db.reset();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue