mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Fix lint and cypress
This commit is contained in:
parent
f9c42ab2a5
commit
910f122087
@ -935,132 +935,252 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
|
||||
await Factory.buildList('user', 30)
|
||||
|
||||
await Factory.buildList( 'post', 30, {
|
||||
image: faker.image.unsplash.objects(),
|
||||
}, {
|
||||
categoryIds: ['cat1'],
|
||||
author: jennyRostock,
|
||||
})
|
||||
await Factory.buildList(
|
||||
'post',
|
||||
30,
|
||||
{
|
||||
image: faker.image.unsplash.objects(),
|
||||
},
|
||||
{
|
||||
categoryIds: ['cat1'],
|
||||
author: jennyRostock,
|
||||
},
|
||||
)
|
||||
|
||||
await Factory.buildList('comment', 6, {}, {
|
||||
author: jennyRostock,
|
||||
postId: 'p2',
|
||||
})
|
||||
await Factory.buildList(
|
||||
'comment',
|
||||
6,
|
||||
{},
|
||||
{
|
||||
author: jennyRostock,
|
||||
postId: 'p2',
|
||||
},
|
||||
)
|
||||
|
||||
await Factory.buildList('comment', 4, {}, {
|
||||
author: jennyRostock,
|
||||
postId: 'p15',
|
||||
})
|
||||
await Factory.buildList(
|
||||
'comment',
|
||||
4,
|
||||
{},
|
||||
{
|
||||
author: jennyRostock,
|
||||
postId: 'p15',
|
||||
},
|
||||
)
|
||||
|
||||
await Factory.buildList( 'comment', 2, {}, {
|
||||
author: jennyRostock,
|
||||
postId: 'p4',
|
||||
})
|
||||
await Factory.buildList(
|
||||
'comment',
|
||||
2,
|
||||
{},
|
||||
{
|
||||
author: jennyRostock,
|
||||
postId: 'p4',
|
||||
},
|
||||
)
|
||||
|
||||
await Factory.buildList('post', 21, {
|
||||
image: faker.image.unsplash.buildings(),
|
||||
}, {
|
||||
author: peterLustig,
|
||||
})
|
||||
await Factory.buildList(
|
||||
'post',
|
||||
21,
|
||||
{
|
||||
image: faker.image.unsplash.buildings(),
|
||||
},
|
||||
{
|
||||
author: peterLustig,
|
||||
},
|
||||
)
|
||||
|
||||
await Factory.buildList('comment', 3, {}, {
|
||||
author: peterLustig,
|
||||
postId: 'p4',
|
||||
})
|
||||
await Factory.buildList(
|
||||
'comment',
|
||||
3,
|
||||
{},
|
||||
{
|
||||
author: peterLustig,
|
||||
postId: 'p4',
|
||||
},
|
||||
)
|
||||
|
||||
await Factory.buildList('comment', 5, {}, {
|
||||
author: peterLustig,
|
||||
postId: 'p14',
|
||||
})
|
||||
await Factory.buildList(
|
||||
'comment',
|
||||
5,
|
||||
{},
|
||||
{
|
||||
author: peterLustig,
|
||||
postId: 'p14',
|
||||
},
|
||||
)
|
||||
|
||||
await Factory.buildList('comment', 6, {}, {
|
||||
author: peterLustig,
|
||||
postId: 'p0',
|
||||
})
|
||||
await Factory.buildList(
|
||||
'comment',
|
||||
6,
|
||||
{},
|
||||
{
|
||||
author: peterLustig,
|
||||
postId: 'p0',
|
||||
},
|
||||
)
|
||||
|
||||
await Factory.buildList( 'post', 11, {
|
||||
image: faker.image.unsplash.food(),
|
||||
}, {
|
||||
author: dewey,
|
||||
})
|
||||
await Factory.buildList(
|
||||
'post',
|
||||
11,
|
||||
{
|
||||
image: faker.image.unsplash.food(),
|
||||
},
|
||||
{
|
||||
author: dewey,
|
||||
},
|
||||
)
|
||||
|
||||
await Factory.buildList( 'comment', 7, {}, {
|
||||
author: dewey,
|
||||
postId: 'p2',
|
||||
})
|
||||
await Factory.buildList(
|
||||
'comment',
|
||||
7,
|
||||
{},
|
||||
{
|
||||
author: dewey,
|
||||
postId: 'p2',
|
||||
},
|
||||
)
|
||||
|
||||
await Factory.buildList( 'comment', 5, {}, {
|
||||
author: dewey,
|
||||
postId: 'p6',
|
||||
})
|
||||
await Factory.buildList(
|
||||
'comment',
|
||||
5,
|
||||
{},
|
||||
{
|
||||
author: dewey,
|
||||
postId: 'p6',
|
||||
},
|
||||
)
|
||||
|
||||
await Factory.buildList( 'comment', 2, {}, {
|
||||
author: dewey,
|
||||
postId: 'p9',
|
||||
})
|
||||
await Factory.buildList(
|
||||
'comment',
|
||||
2,
|
||||
{},
|
||||
{
|
||||
author: dewey,
|
||||
postId: 'p9',
|
||||
},
|
||||
)
|
||||
|
||||
await Factory.buildList('post', 16, {
|
||||
image: faker.image.unsplash.technology(),
|
||||
}, {
|
||||
author: louie,
|
||||
})
|
||||
await Factory.buildList(
|
||||
'post',
|
||||
16,
|
||||
{
|
||||
image: faker.image.unsplash.technology(),
|
||||
},
|
||||
{
|
||||
author: louie,
|
||||
},
|
||||
)
|
||||
|
||||
await Factory.buildList('comment', 4, {}, {
|
||||
postId: 'p1',
|
||||
author: louie,
|
||||
})
|
||||
await Factory.buildList(
|
||||
'comment',
|
||||
4,
|
||||
{},
|
||||
{
|
||||
postId: 'p1',
|
||||
author: louie,
|
||||
},
|
||||
)
|
||||
|
||||
await Factory.buildList('comment', 8, {}, {
|
||||
author: louie,
|
||||
postId: 'p10',
|
||||
})
|
||||
await Factory.buildList(
|
||||
'comment',
|
||||
8,
|
||||
{},
|
||||
{
|
||||
author: louie,
|
||||
postId: 'p10',
|
||||
},
|
||||
)
|
||||
|
||||
await Factory.buildList('comment', 5, {}, {
|
||||
author: louie,
|
||||
postId: 'p13',
|
||||
})
|
||||
await Factory.buildList(
|
||||
'comment',
|
||||
5,
|
||||
{},
|
||||
{
|
||||
author: louie,
|
||||
postId: 'p13',
|
||||
},
|
||||
)
|
||||
|
||||
await Factory.buildList('post', 45, {
|
||||
image: faker.image.unsplash.people(),
|
||||
}, {
|
||||
author: bobDerBaumeister,
|
||||
})
|
||||
await Factory.buildList(
|
||||
'post',
|
||||
45,
|
||||
{
|
||||
image: faker.image.unsplash.people(),
|
||||
},
|
||||
{
|
||||
author: bobDerBaumeister,
|
||||
},
|
||||
)
|
||||
|
||||
await Factory.buildList('comment', 2, {}, {
|
||||
author: bobDerBaumeister,
|
||||
postId: 'p2',
|
||||
})
|
||||
await Factory.buildList(
|
||||
'comment',
|
||||
2,
|
||||
{},
|
||||
{
|
||||
author: bobDerBaumeister,
|
||||
postId: 'p2',
|
||||
},
|
||||
)
|
||||
|
||||
await Factory.buildList( 'comment', 3, {}, {
|
||||
author: bobDerBaumeister,
|
||||
postId: 'p12',
|
||||
})
|
||||
await Factory.buildList(
|
||||
'comment',
|
||||
3,
|
||||
{},
|
||||
{
|
||||
author: bobDerBaumeister,
|
||||
postId: 'p12',
|
||||
},
|
||||
)
|
||||
|
||||
await Factory.buildList( 'comment', 7, {}, {
|
||||
author: bobDerBaumeister,
|
||||
postId: 'p13',
|
||||
})
|
||||
await Factory.buildList(
|
||||
'comment',
|
||||
7,
|
||||
{},
|
||||
{
|
||||
author: bobDerBaumeister,
|
||||
postId: 'p13',
|
||||
},
|
||||
)
|
||||
|
||||
await Factory.buildList( 'post', 8, {
|
||||
image: faker.image.unsplash.nature(),
|
||||
}, {
|
||||
author: huey,
|
||||
})
|
||||
await Factory.buildList(
|
||||
'post',
|
||||
8,
|
||||
{
|
||||
image: faker.image.unsplash.nature(),
|
||||
},
|
||||
{
|
||||
author: huey,
|
||||
},
|
||||
)
|
||||
|
||||
await Factory.buildList('comment', 6, {}, {
|
||||
author: huey,
|
||||
postId: 'p0',
|
||||
})
|
||||
await Factory.buildList(
|
||||
'comment',
|
||||
6,
|
||||
{},
|
||||
{
|
||||
author: huey,
|
||||
postId: 'p0',
|
||||
},
|
||||
)
|
||||
|
||||
await Factory.buildList( 'comment', 8, {}, {
|
||||
author: huey,
|
||||
postId: 'p13',
|
||||
})
|
||||
await Factory.buildList(
|
||||
'comment',
|
||||
8,
|
||||
{},
|
||||
{
|
||||
author: huey,
|
||||
postId: 'p13',
|
||||
},
|
||||
)
|
||||
|
||||
await Factory.buildList('comment', 9, {}, {
|
||||
author: huey,
|
||||
postId: 'p15',
|
||||
})
|
||||
await Factory.buildList(
|
||||
'comment',
|
||||
9,
|
||||
{},
|
||||
{
|
||||
author: huey,
|
||||
postId: 'p15',
|
||||
},
|
||||
)
|
||||
|
||||
await Factory.build('donations')
|
||||
/* eslint-disable-next-line no-console */
|
||||
|
||||
@ -42,26 +42,18 @@ Given("I am logged in as the muted user", () => {
|
||||
});
|
||||
|
||||
Given("we have a selection of categories", () => {
|
||||
cy.createCategories("cat0", "just-for-fun");
|
||||
cy.factory().build('category', { id: "cat0", slug: "just-for-fun" });
|
||||
});
|
||||
|
||||
Given("we have a selection of tags and categories as well as posts", () => {
|
||||
cy.createCategories("cat12", "cat121", "cat122")
|
||||
.factory()
|
||||
.build("tag", {
|
||||
id: "Ecology"
|
||||
})
|
||||
.build("tag", {
|
||||
id: "Nature"
|
||||
})
|
||||
.build("tag", {
|
||||
id: "Democracy"
|
||||
});
|
||||
|
||||
cy.factory()
|
||||
.build("user", {
|
||||
id: 'a1'
|
||||
})
|
||||
.build('category', { id: 'cat12', name: "Just For Fun", icon: "smile", })
|
||||
.build('category', { id: 'cat121', name: "Happiness & Values", icon: "heart-o"})
|
||||
.build('category', { id: 'cat122', name: "Health & Wellbeing", icon: "medkit"})
|
||||
.build("tag", { id: "Ecology" })
|
||||
.build("tag", { id: "Nature" })
|
||||
.build("tag", { id: "Democracy" })
|
||||
.build("user", { id: 'a1' })
|
||||
.build("post", {}, {
|
||||
authorId: 'a1',
|
||||
tagIds: ["Ecology", "Nature", "Democracy"],
|
||||
@ -71,20 +63,14 @@ Given("we have a selection of tags and categories as well as posts", () => {
|
||||
authorId: 'a1',
|
||||
tagIds: ["Nature", "Democracy"],
|
||||
categoryIds: ["cat121"]
|
||||
});
|
||||
|
||||
cy.factory()
|
||||
.build("user", {
|
||||
id: 'a2'
|
||||
})
|
||||
.build("user", { id: 'a2' })
|
||||
.build("post", {}, {
|
||||
authorId: 'a2',
|
||||
tagIds: ['Nature', 'Democracy'],
|
||||
categoryIds: ["cat12"]
|
||||
});
|
||||
cy.factory()
|
||||
})
|
||||
.build("post", {}, {
|
||||
authorId: narratorParams.id,
|
||||
tagIds: ['Democracy'],
|
||||
categoryIds: ["cat122"]
|
||||
})
|
||||
@ -95,12 +81,12 @@ Given("we have the following user accounts:", table => {
|
||||
cy.factory().build("user", {
|
||||
...params,
|
||||
...termsAndConditionsAgreedVersion
|
||||
});
|
||||
}, params);
|
||||
});
|
||||
});
|
||||
|
||||
Given("I have a user account", () => {
|
||||
cy.factory().build("user", narratorParams);
|
||||
cy.factory().build("user", narratorParams, loginCredentials);
|
||||
});
|
||||
|
||||
Given("my user account has the role {string}", role => {
|
||||
@ -197,16 +183,16 @@ Given("we have the following posts in our database:", table => {
|
||||
icon: "smile"
|
||||
})
|
||||
|
||||
table.hashes().forEach(({
|
||||
...postAttributes
|
||||
}, i) => {
|
||||
postAttributes = {
|
||||
...postAttributes,
|
||||
deleted: Boolean(postAttributes.deleted),
|
||||
disabled: Boolean(postAttributes.disabled),
|
||||
pinned: Boolean(postAttributes.pinned),
|
||||
}
|
||||
cy.factory().build("post", postAttributes, { categoryIds: ['cat-456'] });
|
||||
table.hashes().forEach((attributesOrOptions, i) => {
|
||||
cy.factory().build("post", {
|
||||
...attributesOrOptions,
|
||||
deleted: Boolean(attributesOrOptions.deleted),
|
||||
disabled: Boolean(attributesOrOptions.disabled),
|
||||
pinned: Boolean(attributesOrOptions.pinned),
|
||||
}, {
|
||||
...attributesOrOptions,
|
||||
categoryIds: ['cat-456']
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
@ -476,13 +462,11 @@ Given("I follow the user {string}", name => {
|
||||
});
|
||||
|
||||
Given('"Spammy Spammer" wrote a post {string}', title => {
|
||||
cy.createCategories("cat21")
|
||||
.factory()
|
||||
cy.factory()
|
||||
.build("post", {
|
||||
title,
|
||||
}, {
|
||||
authorId: 'annoying-user',
|
||||
categoryIds: ["cat21"]
|
||||
});
|
||||
});
|
||||
|
||||
@ -500,13 +484,11 @@ Then("nobody is following the user profile anymore", () => {
|
||||
});
|
||||
|
||||
Given("I wrote a post {string}", title => {
|
||||
cy.createCategories(`cat213`, title)
|
||||
.factory()
|
||||
cy.factory()
|
||||
.build("post", {
|
||||
title,
|
||||
}, {
|
||||
authorId: narratorParams.id,
|
||||
categoryIds: ["cat213"]
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -75,27 +75,6 @@ Cypress.Commands.add("openPage", page => {
|
||||
cy.visit(`/${page}`);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("createCategories", (id, slug) => {
|
||||
cy.factory()
|
||||
.build("category", {
|
||||
id: `${id}`,
|
||||
name: "Just For Fun",
|
||||
slug: `${slug}`,
|
||||
icon: "smile"
|
||||
})
|
||||
.build("category", {
|
||||
id: `${id}1`,
|
||||
name: "Happiness & Values",
|
||||
icon: "heart-o"
|
||||
})
|
||||
.build("category", {
|
||||
id: `${id}2`,
|
||||
name: "Health & Wellbeing",
|
||||
icon: "medkit"
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Cypress.Commands.add(
|
||||
'authenticateAs',
|
||||
async ({email, password}) => {
|
||||
|
||||
@ -40,8 +40,8 @@ Cypress.Commands.add('factory', () => {
|
||||
Cypress.Commands.add(
|
||||
'build',
|
||||
{ prevSubject: true },
|
||||
async (factory, node, properties, options) => {
|
||||
await Factory.build(node, properties, options)
|
||||
async (factory, name, atrributes, options) => {
|
||||
await Factory.build(name, atrributes, options)
|
||||
return factory
|
||||
}
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user