Skip to content

Commit

Permalink
improved coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
ErykKul committed Jul 2, 2024
1 parent 429b1ca commit b63bfb8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export function UploadedFiles({
if (res.saved) {
const files = filesToAddTagsTo.map((file) => {
res.tags.forEach((t) => {
if (!file.tags.some((x) => x === t)) file.tags.push(t)
if (!file.tags.includes(t)) file.tags.push(t)
})
return file
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ export function AddTagsModal({ show, availableTags, setTagOptions, update }: Add
<Col sm={9} className={styles.tags}>
<div className={styles.tags_select} title={t('addTags.selectTags')}>
{tagsToAdd.map((o) => (
<span key={o} onClick={() => setTagsToAdd(tagsToAdd.filter((x) => x !== o))}>
<span
key={o}
onClick={() => setTagsToAdd(tagsToAdd.filter((x) => x !== o))}
data-testid="tag-to-add">
<Badge variant="primary">
{o}
<X />
Expand Down Expand Up @@ -97,7 +100,8 @@ export function AddTagsModal({ show, availableTags, setTagOptions, update }: Add
key={o}
onClick={() => {
if (!tagsToAdd.includes(o)) setTagsToAdd([...tagsToAdd, o])
}}>
}}
data-testid={o}>
<Badge variant="secondary">
{o}
<Plus />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,8 @@ describe('UploadDatasetFiles', () => {
cy.findByTestId('add-custom-tag').click()
cy.findByText('Hello, World!').should('exist')
cy.findByText('Hello, World!').click()
cy.findByText('Hello, World!').click()
cy.get('input[placeholder="Add new custom file tag..."]').first().type('Hello, World 2!{enter}')
cy.get('input[type=text]').first().type('Hello, World!')
cy.get('input[placeholder="File path"]').first().type('Hello, World!')
cy.get('textarea').first().type('Hello, World!')
Expand Down Expand Up @@ -509,6 +511,11 @@ describe('UploadDatasetFiles', () => {
cy.findByText('Edit files').first().click()
cy.findByText('Add tags').first().click()
cy.findByTitle('Custom tag').type('Hello, World 3!{enter}')
cy.findByTestId('tag-to-add').first().click()
cy.findByTestId('Data').click()
cy.findByTestId('Data').click()
cy.findByTestId('Data').click()
cy.findByTestId('Hello, World 3!').click()
cy.findByTitle('Save Changes').click()
})
})

0 comments on commit b63bfb8

Please sign in to comment.