0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Added fixture path utility to e2e-framework

- Always want to be able to safely get a fixture path without needing the path util
- Means tests can be moved around more easily
This commit is contained in:
Hannah Wolfe 2022-03-21 11:07:21 +00:00
parent 25e5cb46de
commit 3784d79682
No known key found for this signature in database
GPG key ID: AB586C3B5AE5C037
2 changed files with 6 additions and 3 deletions

View file

@ -42,7 +42,7 @@ describe('Authentication API', function () {
const requestMock = nock('https://api.github.com')
.get('/repos/tryghost/dawn/zipball')
.query(true)
.replyWithFile(200, __dirname + '/../../../utils/fixtures/themes/valid.zip');
.replyWithFile(200, fixtureManager.getPathForFixture('themes/valid.zip'));
await agent
.post('authentication/setup')
@ -166,7 +166,7 @@ describe('Authentication API', function () {
const requestMock = nock('https://api.github.com')
.get('/repos/tryghost/casper/zipball')
.query(true)
.replyWithFile(200, __dirname + '/../../../utils/fixtures/themes/valid.zip');
.replyWithFile(200, fixtureManager.getPathForFixture('themes/valid.zip'));
await cleanAgent
.post('authentication/setup')

View file

@ -271,7 +271,10 @@ module.exports = {
get: getFixture,
getCurrentOwnerUser: fixtureUtils.getCurrentOwnerUser,
init: initFixtures,
restore: resetData
restore: resetData,
getPathForFixture: (fixturePath) => {
return path.join(__dirname, 'fixtures', fixturePath);
}
},
matchers: {
anyString: any(String),