Download spectrum/cypress/integration/channel/settings/delete_spec.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.48 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/cypress/integration/channel/settings/delete_spec.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/spectrum/cypress/integration/channel/settings/delete_spec.js
-
curl -L -o delete_spec.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/cypress/integration/channel/settings/delete_spec.js
1.48 kB
| import data from '../../../../shared/testing/data'; | |
| const channel = data.channels[0]; | |
| const privateChannel = data.channels[1]; | |
| const community = data.communities.find( | |
| community => community.id === channel.communityId | |
| ); | |
| const privateCommunity = data.communities.find( | |
| community => community.id === privateChannel.communityId | |
| ); | |
| const { userId: ownerInChannelId } = data.usersChannels.find( | |
| ({ channelId, isOwner }) => channelId === channel.id && isOwner | |
| ); | |
| const { userId: ownerInPrivateChannelId } = data.usersChannels.find( | |
| ({ channelId, isOwner }) => channelId === privateChannel.id && isOwner | |
| ); | |
| describe('deleting general channel', () => { | |
| beforeEach(() => { | |
| cy.auth(ownerInChannelId).then(() => | |
| cy.visit(`/${community.slug}/${channel.slug}/settings`) | |
| ); | |
| }); | |
| it('should not allow general channel to be deleted', () => { | |
| cy.get('[data-cy="channel-overview"]').should('be.visible'); | |
| cy.get('[data-cy="delete-channel-button"]').should('not.be.visible'); | |
| }); | |
| }); | |
| describe('deleting a channel', () => { | |
| beforeEach(() => { | |
| cy.auth(ownerInPrivateChannelId).then(() => | |
| cy.visit(`/${privateCommunity.slug}/${privateChannel.slug}/settings`) | |
| ); | |
| }); | |
| it('should delete a channel', () => { | |
| cy.get('[data-cy="channel-overview"]').should('be.visible'); | |
| cy.get('[data-cy="delete-channel-button"]') | |
| .should('be.visible') | |
| .click(); | |
| cy.get('[data-cy="delete-button"]').should('be.visible'); | |
| }); | |
| }); | |