Download spectrum/cypress/integration/user_spec.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.58 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/cypress/integration/user_spec.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/spectrum/cypress/integration/user_spec.js
-
curl -L -o user_spec.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/cypress/integration/user_spec.js
1.58 kB
| import data from '../../shared/testing/data'; | |
| const user = data.users[1]; | |
| const communities = data.communities; | |
| const channels = data.channels; | |
| const threads = data.threads; | |
| const publicAuthoredThreads = threads.filter(thread => { | |
| const community = communities.find( | |
| community => community.id === thread.communityId | |
| ); | |
| const channel = channels.find(channel => channel.id === thread.channelId); | |
| return ( | |
| thread.creatorId === user.id && !community.isPrivate && !channel.isPrivate | |
| ); | |
| }); | |
| describe('User View', () => { | |
| it('should render', () => { | |
| cy.visit(`/users/${user.username}`); | |
| cy.get('[data-cy="user-view"]').should('be.visible'); | |
| cy.contains(user.username); | |
| cy.contains(user.name); | |
| cy.contains(user.description); | |
| cy.contains(user.website); | |
| cy.get('[data-cy="thread-feed"]').should('be.visible'); | |
| publicAuthoredThreads.forEach(thread => { | |
| cy.contains(thread.content.title); | |
| }); | |
| }); | |
| it('should list the public communities a user is a member of, including their rep in that community', () => { | |
| cy.visit(`/users/${user.username}`); | |
| cy.get('[data-cy="user-view"]').should('be.visible'); | |
| const usersCommunities = data.usersCommunities.filter( | |
| ({ userId }) => userId === user.id | |
| ); | |
| const communityIds = usersCommunities.map(({ communityId }) => communityId); | |
| const communities = data.communities.filter( | |
| ({ id, isPrivate }) => communityIds.includes(id) && isPrivate !== true | |
| ); | |
| communities.forEach(community => { | |
| cy.contains(community.name); | |
| }); | |
| }); | |
| }); | |