Let post factory create default category

- since we have factories that ensure a post has a category created, we
  don't need extra code to create a category before the post
This commit is contained in:
mattwr18 2020-02-18 10:36:34 +01:00
parent ee3a85f70f
commit 0f74273b5b
3 changed files with 2 additions and 15 deletions

View File

@ -13,7 +13,7 @@ function createUser (slug) {
return Factory.build('user', {
name: slug,
}, {
password: '1234'
password: '1234',
email: 'example@test.org',
})
// await login({ email: 'example@test.org', password: '1234' })

View File

@ -109,7 +109,7 @@ Then("I add all required fields", () => {
.get(".editor .ProseMirror")
.type('new post content')
.get(".base-button")
.contains("Just for Fun")
.contains("Global Peace & Nonviolence")
.click()
.get('.ds-flex-item > .ds-form-item .ds-select ')
.click()

View File

@ -238,17 +238,6 @@ Given("we have the following comments in our database:", table => {
});
Given("we have the following posts in our database:", table => {
cy.factory().build('category', {
id: `cat-456`,
name: "Just For Fun",
slug: `just-for-fun`,
icon: "smile"
}).then(categoryJson => {
return new Cypress.Promise((resolve, _reject) => {
return categoryJson.toJson().then(category => resolve(category))
})
})
.then(category => {
table.hashes().forEach((attributesOrOptions, i) => {
cy.factory().build("post", {
...attributesOrOptions,
@ -257,10 +246,8 @@ Given("we have the following posts in our database:", table => {
pinned: Boolean(attributesOrOptions.pinned),
}, {
...attributesOrOptions,
categoryIds: category.id
});
})
})
})
Then("I see a success message:", message => {