Fixed test query using outdated author_id filter

refs https://github.com/TryGhost/Toolbox/issues/230

- The `author_id` column is gone, so is the support for filtering posts by single author's id. Using author's slug(s) is the closest alternative to achieve the same result
This commit is contained in:
Naz 2022-04-27 16:24:50 +08:00 committed by naz
parent 15951aa1d5
commit a372a84e82
2 changed files with 4 additions and 3 deletions

View File

@ -198,10 +198,11 @@ describe('User API', function () {
it('Can destroy an active user and transfer posts to the owner', async function () {
const userId = testUtils.getExistingData().users[1].id;
const userSlug = testUtils.getExistingData().users[1].slug;
const ownerId = testUtils.getExistingData().users[0].id;
const res = await request
.get(localUtils.API.getApiQuery(`posts/?filter=author_id:${userId}`))
.get(localUtils.API.getApiQuery(`posts/?filter=authors:${userSlug}`))
.set('Origin', config.get('url'))
.expect(200);
@ -243,7 +244,7 @@ describe('User API', function () {
.expect(404);
const res3 = await request
.get(localUtils.API.getApiQuery(`posts/?filter=author_id:${userId}`))
.get(localUtils.API.getApiQuery(`posts/?filter=authors:${userSlug}}`))
.set('Origin', config.get('url'))
.expect(200);

View File

@ -41,7 +41,7 @@ let totalBoots = 0;
const exposeFixtures = async () => {
const fixturePromises = {
roles: models.Role.findAll({columns: ['id']}),
users: models.User.findAll({columns: ['id', 'email']}),
users: models.User.findAll({columns: ['id', 'email', 'slug']}),
tags: models.Tag.findAll({columns: ['id']}),
apiKeys: models.ApiKey.findAll({withRelated: 'integration'})
};