feat(pages): add /application/guilds/join
(#2)
This commit is contained in:
@ -6,3 +6,8 @@ export const guild = {
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString()
|
||||
}
|
||||
|
||||
export const guild2 = {
|
||||
...guild,
|
||||
name: 'app'
|
||||
}
|
||||
|
33
cypress/fixtures/guilds/public/get.ts
Normal file
33
cypress/fixtures/guilds/public/get.ts
Normal file
@ -0,0 +1,33 @@
|
||||
import { Handler } from '../../handler'
|
||||
|
||||
import { guild, guild2 } from '../guild'
|
||||
|
||||
export const getGuildsPublicEmptyHandler: Handler = {
|
||||
method: 'GET',
|
||||
url: '/guilds/public',
|
||||
response: {
|
||||
statusCode: 200,
|
||||
body: []
|
||||
}
|
||||
}
|
||||
|
||||
export const getGuildsPublicHandler: Handler = {
|
||||
method: 'GET',
|
||||
url: '/guilds/public',
|
||||
response: {
|
||||
statusCode: 200,
|
||||
body: [
|
||||
{ ...guild, membersCount: 1 },
|
||||
{ ...guild2, membersCount: 1 }
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
export const getGuildsPublicSearchHandler: Handler = {
|
||||
method: 'GET',
|
||||
url: '/guilds/public',
|
||||
response: {
|
||||
statusCode: 200,
|
||||
body: [{ ...guild2, membersCount: 1 }]
|
||||
}
|
||||
}
|
55
cypress/integration/pages/application/guilds/join.spec.ts
Normal file
55
cypress/integration/pages/application/guilds/join.spec.ts
Normal file
@ -0,0 +1,55 @@
|
||||
import {
|
||||
getGuildsPublicEmptyHandler,
|
||||
getGuildsPublicHandler,
|
||||
getGuildsPublicSearchHandler
|
||||
} from '../../../../fixtures/guilds/public/get'
|
||||
import { authenticationHandlers } from '../../../../fixtures/handler'
|
||||
|
||||
describe('Pages > /application/guilds/join', () => {
|
||||
beforeEach(() => {
|
||||
cy.task('stopMockServer')
|
||||
})
|
||||
|
||||
it('should shows no guild if there are no public guilds', () => {
|
||||
cy.task('startMockServer', [
|
||||
...authenticationHandlers,
|
||||
getGuildsPublicEmptyHandler
|
||||
]).setCookie('refreshToken', 'refresh-token')
|
||||
cy.visit('/application/guilds/join')
|
||||
cy.get('.guilds-list').children().should('have.length', 0)
|
||||
})
|
||||
|
||||
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-list').children().should('have.length', 1)
|
||||
cy.get('[data-testid=progress-spinner]').should('be.visible')
|
||||
})
|
||||
|
||||
it('should shows all the guilds', () => {
|
||||
cy.task('startMockServer', [
|
||||
...authenticationHandlers,
|
||||
getGuildsPublicHandler
|
||||
]).setCookie('refreshToken', 'refresh-token')
|
||||
cy.visit('/application/guilds/join')
|
||||
cy.get('.guilds-list').children().should('have.length', 2)
|
||||
cy.get('.guilds-list [data-cy=guild-name]:first').should(
|
||||
'have.text',
|
||||
'GuildExample'
|
||||
)
|
||||
})
|
||||
|
||||
it('should shows the searched guild', () => {
|
||||
cy.task('startMockServer', [
|
||||
...authenticationHandlers,
|
||||
getGuildsPublicSearchHandler
|
||||
]).setCookie('refreshToken', 'refresh-token')
|
||||
cy.visit('/application/guilds/join')
|
||||
cy.get('[data-cy=search-guild-input]').type('app')
|
||||
cy.get('.guilds-list').children().should('have.length', 1)
|
||||
cy.get('.guilds-list [data-cy=guild-name]:first').should('have.text', 'app')
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user