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('user', 30)
|
||||||
|
|
||||||
await Factory.buildList( 'post', 30, {
|
await Factory.buildList(
|
||||||
image: faker.image.unsplash.objects(),
|
'post',
|
||||||
}, {
|
30,
|
||||||
categoryIds: ['cat1'],
|
{
|
||||||
author: jennyRostock,
|
image: faker.image.unsplash.objects(),
|
||||||
})
|
},
|
||||||
|
{
|
||||||
|
categoryIds: ['cat1'],
|
||||||
|
author: jennyRostock,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
await Factory.buildList('comment', 6, {}, {
|
await Factory.buildList(
|
||||||
author: jennyRostock,
|
'comment',
|
||||||
postId: 'p2',
|
6,
|
||||||
})
|
{},
|
||||||
|
{
|
||||||
|
author: jennyRostock,
|
||||||
|
postId: 'p2',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
await Factory.buildList('comment', 4, {}, {
|
await Factory.buildList(
|
||||||
author: jennyRostock,
|
'comment',
|
||||||
postId: 'p15',
|
4,
|
||||||
})
|
{},
|
||||||
|
{
|
||||||
|
author: jennyRostock,
|
||||||
|
postId: 'p15',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
await Factory.buildList( 'comment', 2, {}, {
|
await Factory.buildList(
|
||||||
author: jennyRostock,
|
'comment',
|
||||||
postId: 'p4',
|
2,
|
||||||
})
|
{},
|
||||||
|
{
|
||||||
|
author: jennyRostock,
|
||||||
|
postId: 'p4',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
await Factory.buildList('post', 21, {
|
await Factory.buildList(
|
||||||
image: faker.image.unsplash.buildings(),
|
'post',
|
||||||
}, {
|
21,
|
||||||
author: peterLustig,
|
{
|
||||||
})
|
image: faker.image.unsplash.buildings(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
author: peterLustig,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
await Factory.buildList('comment', 3, {}, {
|
await Factory.buildList(
|
||||||
author: peterLustig,
|
'comment',
|
||||||
postId: 'p4',
|
3,
|
||||||
})
|
{},
|
||||||
|
{
|
||||||
|
author: peterLustig,
|
||||||
|
postId: 'p4',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
await Factory.buildList('comment', 5, {}, {
|
await Factory.buildList(
|
||||||
author: peterLustig,
|
'comment',
|
||||||
postId: 'p14',
|
5,
|
||||||
})
|
{},
|
||||||
|
{
|
||||||
|
author: peterLustig,
|
||||||
|
postId: 'p14',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
await Factory.buildList('comment', 6, {}, {
|
await Factory.buildList(
|
||||||
author: peterLustig,
|
'comment',
|
||||||
postId: 'p0',
|
6,
|
||||||
})
|
{},
|
||||||
|
{
|
||||||
|
author: peterLustig,
|
||||||
|
postId: 'p0',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
await Factory.buildList( 'post', 11, {
|
await Factory.buildList(
|
||||||
image: faker.image.unsplash.food(),
|
'post',
|
||||||
}, {
|
11,
|
||||||
author: dewey,
|
{
|
||||||
})
|
image: faker.image.unsplash.food(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
author: dewey,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
await Factory.buildList( 'comment', 7, {}, {
|
await Factory.buildList(
|
||||||
author: dewey,
|
'comment',
|
||||||
postId: 'p2',
|
7,
|
||||||
})
|
{},
|
||||||
|
{
|
||||||
|
author: dewey,
|
||||||
|
postId: 'p2',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
await Factory.buildList( 'comment', 5, {}, {
|
await Factory.buildList(
|
||||||
author: dewey,
|
'comment',
|
||||||
postId: 'p6',
|
5,
|
||||||
})
|
{},
|
||||||
|
{
|
||||||
|
author: dewey,
|
||||||
|
postId: 'p6',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
await Factory.buildList( 'comment', 2, {}, {
|
await Factory.buildList(
|
||||||
author: dewey,
|
'comment',
|
||||||
postId: 'p9',
|
2,
|
||||||
})
|
{},
|
||||||
|
{
|
||||||
|
author: dewey,
|
||||||
|
postId: 'p9',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
await Factory.buildList('post', 16, {
|
await Factory.buildList(
|
||||||
image: faker.image.unsplash.technology(),
|
'post',
|
||||||
}, {
|
16,
|
||||||
author: louie,
|
{
|
||||||
})
|
image: faker.image.unsplash.technology(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
author: louie,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
await Factory.buildList('comment', 4, {}, {
|
await Factory.buildList(
|
||||||
postId: 'p1',
|
'comment',
|
||||||
author: louie,
|
4,
|
||||||
})
|
{},
|
||||||
|
{
|
||||||
|
postId: 'p1',
|
||||||
|
author: louie,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
await Factory.buildList('comment', 8, {}, {
|
await Factory.buildList(
|
||||||
author: louie,
|
'comment',
|
||||||
postId: 'p10',
|
8,
|
||||||
})
|
{},
|
||||||
|
{
|
||||||
|
author: louie,
|
||||||
|
postId: 'p10',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
await Factory.buildList('comment', 5, {}, {
|
await Factory.buildList(
|
||||||
author: louie,
|
'comment',
|
||||||
postId: 'p13',
|
5,
|
||||||
})
|
{},
|
||||||
|
{
|
||||||
|
author: louie,
|
||||||
|
postId: 'p13',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
await Factory.buildList('post', 45, {
|
await Factory.buildList(
|
||||||
image: faker.image.unsplash.people(),
|
'post',
|
||||||
}, {
|
45,
|
||||||
author: bobDerBaumeister,
|
{
|
||||||
})
|
image: faker.image.unsplash.people(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
author: bobDerBaumeister,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
await Factory.buildList('comment', 2, {}, {
|
await Factory.buildList(
|
||||||
author: bobDerBaumeister,
|
'comment',
|
||||||
postId: 'p2',
|
2,
|
||||||
})
|
{},
|
||||||
|
{
|
||||||
|
author: bobDerBaumeister,
|
||||||
|
postId: 'p2',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
await Factory.buildList( 'comment', 3, {}, {
|
await Factory.buildList(
|
||||||
author: bobDerBaumeister,
|
'comment',
|
||||||
postId: 'p12',
|
3,
|
||||||
})
|
{},
|
||||||
|
{
|
||||||
|
author: bobDerBaumeister,
|
||||||
|
postId: 'p12',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
await Factory.buildList( 'comment', 7, {}, {
|
await Factory.buildList(
|
||||||
author: bobDerBaumeister,
|
'comment',
|
||||||
postId: 'p13',
|
7,
|
||||||
})
|
{},
|
||||||
|
{
|
||||||
|
author: bobDerBaumeister,
|
||||||
|
postId: 'p13',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
await Factory.buildList( 'post', 8, {
|
await Factory.buildList(
|
||||||
image: faker.image.unsplash.nature(),
|
'post',
|
||||||
}, {
|
8,
|
||||||
author: huey,
|
{
|
||||||
})
|
image: faker.image.unsplash.nature(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
author: huey,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
await Factory.buildList('comment', 6, {}, {
|
await Factory.buildList(
|
||||||
author: huey,
|
'comment',
|
||||||
postId: 'p0',
|
6,
|
||||||
})
|
{},
|
||||||
|
{
|
||||||
|
author: huey,
|
||||||
|
postId: 'p0',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
await Factory.buildList( 'comment', 8, {}, {
|
await Factory.buildList(
|
||||||
author: huey,
|
'comment',
|
||||||
postId: 'p13',
|
8,
|
||||||
})
|
{},
|
||||||
|
{
|
||||||
|
author: huey,
|
||||||
|
postId: 'p13',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
await Factory.buildList('comment', 9, {}, {
|
await Factory.buildList(
|
||||||
author: huey,
|
'comment',
|
||||||
postId: 'p15',
|
9,
|
||||||
})
|
{},
|
||||||
|
{
|
||||||
|
author: huey,
|
||||||
|
postId: 'p15',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
await Factory.build('donations')
|
await Factory.build('donations')
|
||||||
/* eslint-disable-next-line no-console */
|
/* 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", () => {
|
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", () => {
|
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()
|
cy.factory()
|
||||||
.build("user", {
|
.build('category', { id: 'cat12', name: "Just For Fun", icon: "smile", })
|
||||||
id: 'a1'
|
.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", {}, {
|
.build("post", {}, {
|
||||||
authorId: 'a1',
|
authorId: 'a1',
|
||||||
tagIds: ["Ecology", "Nature", "Democracy"],
|
tagIds: ["Ecology", "Nature", "Democracy"],
|
||||||
@ -71,20 +63,14 @@ Given("we have a selection of tags and categories as well as posts", () => {
|
|||||||
authorId: 'a1',
|
authorId: 'a1',
|
||||||
tagIds: ["Nature", "Democracy"],
|
tagIds: ["Nature", "Democracy"],
|
||||||
categoryIds: ["cat121"]
|
categoryIds: ["cat121"]
|
||||||
});
|
|
||||||
|
|
||||||
cy.factory()
|
|
||||||
.build("user", {
|
|
||||||
id: 'a2'
|
|
||||||
})
|
})
|
||||||
|
.build("user", { id: 'a2' })
|
||||||
.build("post", {}, {
|
.build("post", {}, {
|
||||||
authorId: 'a2',
|
authorId: 'a2',
|
||||||
tagIds: ['Nature', 'Democracy'],
|
tagIds: ['Nature', 'Democracy'],
|
||||||
categoryIds: ["cat12"]
|
categoryIds: ["cat12"]
|
||||||
});
|
})
|
||||||
cy.factory()
|
|
||||||
.build("post", {}, {
|
.build("post", {}, {
|
||||||
authorId: narratorParams.id,
|
|
||||||
tagIds: ['Democracy'],
|
tagIds: ['Democracy'],
|
||||||
categoryIds: ["cat122"]
|
categoryIds: ["cat122"]
|
||||||
})
|
})
|
||||||
@ -95,12 +81,12 @@ Given("we have the following user accounts:", table => {
|
|||||||
cy.factory().build("user", {
|
cy.factory().build("user", {
|
||||||
...params,
|
...params,
|
||||||
...termsAndConditionsAgreedVersion
|
...termsAndConditionsAgreedVersion
|
||||||
});
|
}, params);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Given("I have a user account", () => {
|
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 => {
|
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"
|
icon: "smile"
|
||||||
})
|
})
|
||||||
|
|
||||||
table.hashes().forEach(({
|
table.hashes().forEach((attributesOrOptions, i) => {
|
||||||
...postAttributes
|
cy.factory().build("post", {
|
||||||
}, i) => {
|
...attributesOrOptions,
|
||||||
postAttributes = {
|
deleted: Boolean(attributesOrOptions.deleted),
|
||||||
...postAttributes,
|
disabled: Boolean(attributesOrOptions.disabled),
|
||||||
deleted: Boolean(postAttributes.deleted),
|
pinned: Boolean(attributesOrOptions.pinned),
|
||||||
disabled: Boolean(postAttributes.disabled),
|
}, {
|
||||||
pinned: Boolean(postAttributes.pinned),
|
...attributesOrOptions,
|
||||||
}
|
categoryIds: ['cat-456']
|
||||||
cy.factory().build("post", postAttributes, { categoryIds: ['cat-456'] });
|
});
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -476,13 +462,11 @@ Given("I follow the user {string}", name => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Given('"Spammy Spammer" wrote a post {string}', title => {
|
Given('"Spammy Spammer" wrote a post {string}', title => {
|
||||||
cy.createCategories("cat21")
|
cy.factory()
|
||||||
.factory()
|
|
||||||
.build("post", {
|
.build("post", {
|
||||||
title,
|
title,
|
||||||
}, {
|
}, {
|
||||||
authorId: 'annoying-user',
|
authorId: 'annoying-user',
|
||||||
categoryIds: ["cat21"]
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -500,13 +484,11 @@ Then("nobody is following the user profile anymore", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Given("I wrote a post {string}", title => {
|
Given("I wrote a post {string}", title => {
|
||||||
cy.createCategories(`cat213`, title)
|
cy.factory()
|
||||||
.factory()
|
|
||||||
.build("post", {
|
.build("post", {
|
||||||
title,
|
title,
|
||||||
}, {
|
}, {
|
||||||
authorId: narratorParams.id,
|
authorId: narratorParams.id,
|
||||||
categoryIds: ["cat213"]
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -75,27 +75,6 @@ Cypress.Commands.add("openPage", page => {
|
|||||||
cy.visit(`/${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(
|
Cypress.Commands.add(
|
||||||
'authenticateAs',
|
'authenticateAs',
|
||||||
async ({email, password}) => {
|
async ({email, password}) => {
|
||||||
|
|||||||
@ -40,8 +40,8 @@ Cypress.Commands.add('factory', () => {
|
|||||||
Cypress.Commands.add(
|
Cypress.Commands.add(
|
||||||
'build',
|
'build',
|
||||||
{ prevSubject: true },
|
{ prevSubject: true },
|
||||||
async (factory, node, properties, options) => {
|
async (factory, name, atrributes, options) => {
|
||||||
await Factory.build(node, properties, options)
|
await Factory.build(name, atrributes, options)
|
||||||
return factory
|
return factory
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user