chore: better Prettier config for easier reviews
This commit is contained in:
@ -1,45 +1,45 @@
|
||||
import { getChannelWithChannelIdHandler } from '../../../../fixtures/channels/[channelId]/get'
|
||||
import { getGuildsHandler } from '../../../../fixtures/guilds/get'
|
||||
import { getGuildMemberWithGuildIdHandler } from '../../../../fixtures/guilds/[guildId]/get'
|
||||
import { channelExample } from '../../../../fixtures/channels/channel'
|
||||
import { guildExample } from '../../../../fixtures/guilds/guild'
|
||||
import { postGuildsHandler } from '../../../../fixtures/guilds/post'
|
||||
import { authenticationHandlers } from '../../../../fixtures/handler'
|
||||
import { getChannelWithChannelIdHandler } from "../../../../fixtures/channels/[channelId]/get"
|
||||
import { getGuildsHandler } from "../../../../fixtures/guilds/get"
|
||||
import { getGuildMemberWithGuildIdHandler } from "../../../../fixtures/guilds/[guildId]/get"
|
||||
import { channelExample } from "../../../../fixtures/channels/channel"
|
||||
import { guildExample } from "../../../../fixtures/guilds/guild"
|
||||
import { postGuildsHandler } from "../../../../fixtures/guilds/post"
|
||||
import { authenticationHandlers } from "../../../../fixtures/handler"
|
||||
|
||||
describe('Pages > /application/guilds/create', () => {
|
||||
describe("Pages > /application/guilds/create", () => {
|
||||
beforeEach(() => {
|
||||
cy.task('stopMockServer')
|
||||
cy.task("stopMockServer")
|
||||
})
|
||||
|
||||
it('should succeeds and create the guild', () => {
|
||||
cy.task('startMockServer', [
|
||||
it("should succeeds and create the guild", () => {
|
||||
cy.task("startMockServer", [
|
||||
...authenticationHandlers,
|
||||
postGuildsHandler,
|
||||
getGuildsHandler,
|
||||
getGuildMemberWithGuildIdHandler,
|
||||
getChannelWithChannelIdHandler
|
||||
]).setCookie('refreshToken', 'refresh-token')
|
||||
cy.visit('/application/guilds/create')
|
||||
cy.get('[data-cy=application-title]').should('have.text', 'Create a Guild')
|
||||
cy.get('#error-name').should('not.exist')
|
||||
cy.get('[data-cy=input-name]').type(guildExample.name)
|
||||
cy.get('[data-cy=submit]').click()
|
||||
cy.location('pathname').should(
|
||||
'eq',
|
||||
`/application/${guildExample.id}/${channelExample.id}`
|
||||
getChannelWithChannelIdHandler,
|
||||
]).setCookie("refreshToken", "refresh-token")
|
||||
cy.visit("/application/guilds/create")
|
||||
cy.get("[data-cy=application-title]").should("have.text", "Create a Guild")
|
||||
cy.get("#error-name").should("not.exist")
|
||||
cy.get("[data-cy=input-name]").type(guildExample.name)
|
||||
cy.get("[data-cy=submit]").click()
|
||||
cy.location("pathname").should(
|
||||
"eq",
|
||||
`/application/${guildExample.id}/${channelExample.id}`,
|
||||
)
|
||||
})
|
||||
|
||||
it('should fails with internal api server error', () => {
|
||||
cy.task('startMockServer', [...authenticationHandlers]).setCookie(
|
||||
'refreshToken',
|
||||
'refresh-token'
|
||||
it("should fails with internal api server error", () => {
|
||||
cy.task("startMockServer", [...authenticationHandlers]).setCookie(
|
||||
"refreshToken",
|
||||
"refresh-token",
|
||||
)
|
||||
cy.visit('/application/guilds/create')
|
||||
cy.get('#error-name').should('not.exist')
|
||||
cy.get('[data-cy=input-name]').type(guildExample.name)
|
||||
cy.get('[data-cy=submit]').click()
|
||||
cy.get('#message').should('have.text', 'Error: Internal Server Error.')
|
||||
cy.visit("/application/guilds/create")
|
||||
cy.get("#error-name").should("not.exist")
|
||||
cy.get("[data-cy=input-name]").type(guildExample.name)
|
||||
cy.get("[data-cy=submit]").click()
|
||||
cy.get("#message").should("have.text", "Error: Internal Server Error.")
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -1,81 +1,81 @@
|
||||
import { guildExample, guildExample2 } from '../../../../fixtures/guilds/guild'
|
||||
import { guildExample, guildExample2 } from "../../../../fixtures/guilds/guild"
|
||||
import {
|
||||
getGuildsPublicEmptyHandler,
|
||||
getGuildsPublicHandler,
|
||||
getGuildsPublicSearchHandler
|
||||
} from '../../../../fixtures/guilds/public/get'
|
||||
import { authenticationHandlers } from '../../../../fixtures/handler'
|
||||
import { API_URL } from '../../../../../tools/api'
|
||||
getGuildsPublicSearchHandler,
|
||||
} from "../../../../fixtures/guilds/public/get"
|
||||
import { authenticationHandlers } from "../../../../fixtures/handler"
|
||||
import { API_URL } from "../../../../../tools/api"
|
||||
|
||||
describe('Pages > /application/guilds/join', () => {
|
||||
describe("Pages > /application/guilds/join", () => {
|
||||
beforeEach(() => {
|
||||
cy.task('stopMockServer')
|
||||
cy.task("stopMockServer")
|
||||
})
|
||||
|
||||
it('should shows all the guilds', () => {
|
||||
cy.task('startMockServer', [
|
||||
it("should shows all the guilds", () => {
|
||||
cy.task("startMockServer", [
|
||||
...authenticationHandlers,
|
||||
getGuildsPublicHandler
|
||||
]).setCookie('refreshToken', 'refresh-token')
|
||||
getGuildsPublicHandler,
|
||||
]).setCookie("refreshToken", "refresh-token")
|
||||
cy.intercept(`${API_URL}${getGuildsPublicHandler.url}*`).as(
|
||||
'getGuildsPublicHandler'
|
||||
"getGuildsPublicHandler",
|
||||
)
|
||||
cy.visit('/application/guilds/join')
|
||||
cy.wait(['@getGuildsPublicHandler']).then(() => {
|
||||
cy.get('[data-cy=application-title]').should('have.text', 'Join a Guild')
|
||||
cy.get('.guilds-public-list').children().should('have.length', 2)
|
||||
cy.get('.guilds-public-list [data-cy=guild-name]:first').should(
|
||||
'have.text',
|
||||
guildExample.name
|
||||
cy.visit("/application/guilds/join")
|
||||
cy.wait(["@getGuildsPublicHandler"]).then(() => {
|
||||
cy.get("[data-cy=application-title]").should("have.text", "Join a Guild")
|
||||
cy.get(".guilds-public-list").children().should("have.length", 2)
|
||||
cy.get(".guilds-public-list [data-cy=guild-name]:first").should(
|
||||
"have.text",
|
||||
guildExample.name,
|
||||
)
|
||||
cy.get('.guilds-public-list [data-cy=guild-name]:last').should(
|
||||
'have.text',
|
||||
guildExample2.name
|
||||
cy.get(".guilds-public-list [data-cy=guild-name]:last").should(
|
||||
"have.text",
|
||||
guildExample2.name,
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
it('should shows the searched guild', () => {
|
||||
cy.task('startMockServer', [
|
||||
it("should shows the searched guild", () => {
|
||||
cy.task("startMockServer", [
|
||||
...authenticationHandlers,
|
||||
getGuildsPublicSearchHandler
|
||||
]).setCookie('refreshToken', 'refresh-token')
|
||||
cy.visit('/application/guilds/join')
|
||||
getGuildsPublicSearchHandler,
|
||||
]).setCookie("refreshToken", "refresh-token")
|
||||
cy.visit("/application/guilds/join")
|
||||
cy.intercept(`${API_URL}${getGuildsPublicHandler.url}*`).as(
|
||||
'getGuildsPublicHandler'
|
||||
"getGuildsPublicHandler",
|
||||
)
|
||||
cy.wait(['@getGuildsPublicHandler']).then(() => {
|
||||
cy.get('[data-cy=search-guild-input]').type(guildExample2.name)
|
||||
cy.get('.guilds-public-list').children().should('have.length', 1)
|
||||
cy.get('.guilds-public-list [data-cy=guild-name]:first').should(
|
||||
'have.text',
|
||||
guildExample2.name
|
||||
cy.wait(["@getGuildsPublicHandler"]).then(() => {
|
||||
cy.get("[data-cy=search-guild-input]").type(guildExample2.name)
|
||||
cy.get(".guilds-public-list").children().should("have.length", 1)
|
||||
cy.get(".guilds-public-list [data-cy=guild-name]:first").should(
|
||||
"have.text",
|
||||
guildExample2.name,
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
it('should shows no guild if there are no public guilds', () => {
|
||||
cy.task('startMockServer', [
|
||||
it("should shows no guild if there are no public guilds", () => {
|
||||
cy.task("startMockServer", [
|
||||
...authenticationHandlers,
|
||||
getGuildsPublicEmptyHandler
|
||||
]).setCookie('refreshToken', 'refresh-token')
|
||||
getGuildsPublicEmptyHandler,
|
||||
]).setCookie("refreshToken", "refresh-token")
|
||||
cy.intercept(`${API_URL}${getGuildsPublicEmptyHandler.url}*`).as(
|
||||
'getGuildsPublicEmptyHandler'
|
||||
"getGuildsPublicEmptyHandler",
|
||||
)
|
||||
cy.visit('/application/guilds/join')
|
||||
cy.wait('@getGuildsPublicEmptyHandler').then(() => {
|
||||
cy.get('.guilds-public-list').children().should('have.length', 0)
|
||||
cy.visit("/application/guilds/join")
|
||||
cy.wait("@getGuildsPublicEmptyHandler").then(() => {
|
||||
cy.get(".guilds-public-list").children().should("have.length", 0)
|
||||
})
|
||||
})
|
||||
|
||||
it('should shows loader with internal api server error', () => {
|
||||
cy.task('startMockServer', [...authenticationHandlers]).setCookie(
|
||||
'refreshToken',
|
||||
'refresh-token'
|
||||
it("should shows loader with internal api server error", () => {
|
||||
cy.task("startMockServer", [...authenticationHandlers]).setCookie(
|
||||
"refreshToken",
|
||||
"refresh-token",
|
||||
)
|
||||
cy.visit('/application/guilds/join')
|
||||
cy.get('.guilds-public-list').children().should('have.length', 1)
|
||||
cy.get('[data-cy=progress-spinner]').should('be.visible')
|
||||
cy.visit("/application/guilds/join")
|
||||
cy.get(".guilds-public-list").children().should("have.length", 1)
|
||||
cy.get("[data-cy=progress-spinner]").should("be.visible")
|
||||
})
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user