mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-12 23:35:58 +00:00
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:
parent
ee3a85f70f
commit
0f74273b5b
@ -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' })
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -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 => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user