Fix query builder/test

This commit is contained in:
mattwr18 2019-10-01 20:57:45 +02:00
parent 3dee2137d4
commit 478f6fef1c
3 changed files with 9 additions and 3 deletions

View File

@ -30,7 +30,7 @@ export const getBlockedByUsers = async context => {
.relationship(userModel.relationships().get('blocked')) .relationship(userModel.relationships().get('blocked'))
.to('blocked', userModel) .to('blocked', userModel)
.where('blocked.id', context.user.id) .where('blocked.id', context.user.id)
.where('blocked.user', 'user') .where('blocked.role', 'user')
.return('user') .return('user')
blockedByUsers = await blockedByUsers.execute() blockedByUsers = await blockedByUsers.execute()
blockedByUsers = blockedByUsers.records.map(r => r.get('user').properties) blockedByUsers = blockedByUsers.records.map(r => r.get('user').properties)

View File

@ -5,7 +5,7 @@ import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps'
let lastReportTitle let lastReportTitle
let davidIrvingPostTitle = 'The Truth about the Holocaust' let davidIrvingPostTitle = 'The Truth about the Holocaust'
let davidIrvingPostSlug = 'the-truth-about-the-holocaust' let davidIrvingPostSlug = 'the-truth-about-the-holocaust'
let davidIrvingName = 'David Irving' let annoyingUserWhoBlockedModeratorTitle = 'Fake news'
const savePostTitle = $post => { const savePostTitle = $post => {
return $post return $post
@ -139,6 +139,12 @@ Then('I see all the reported posts including the one from above', () => {
}) })
}) })
Then('I see all the reported posts including from the user who blocked me', () => {
cy.get('table tbody').within(() => {
cy.contains('tr', annoyingUserWhoBlockedModeratorTitle)
})
})
Then('each list item links to the post page', () => { Then('each list item links to the post page', () => {
cy.contains(davidIrvingPostTitle).click() cy.contains(davidIrvingPostTitle).click()
cy.location('pathname').should('contain', '/post') cy.location('pathname').should('contain', '/post')

View File

@ -67,7 +67,7 @@ Feature: Report and Moderate
And I am logged in And I am logged in
When I click on the avatar menu in the top right corner When I click on the avatar menu in the top right corner
And I click on "Moderation" And I click on "Moderation"
Then I see all the reported posts including the one from above Then I see all the reported posts including from the user who blocked me
And each list item links to the post page And each list item links to the post page
Scenario: Normal user can't see the moderation page Scenario: Normal user can't see the moderation page