Skip to content

Commit

Permalink
Adds tests for changes made on FileUploadItem.vue
Browse files Browse the repository at this point in the history
  • Loading branch information
akolson committed Sep 6, 2022
1 parent 4783389 commit c491ac0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
v-if="fileDisplay"
class="notranslate"
:text="formattedFileDisplay"
data-test="file-link"
@click="openFileDialog"
/>
<ActionLink
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@ function makeWrapper(props = {}, file = {}) {

describe('fileUploadItem', () => {
describe('render', () => {
it("'Unknown filename' should be displayed if original_filename is 'file'", () => {
let file = {
id: 'file-1',
original_filename: 'file',
};
let wrapper = makeWrapper({}, file);
expect(wrapper.find('[data-test="file-link"]').text()).toBe('Unknown filename');
});
it("original_filename should be displayed if its value is not 'file'", () => {
let file = {
id: 'file-1',
original_filename: 'SomeFileName',
};
let wrapper = makeWrapper({}, file);
expect(wrapper.find('[data-test="file-link"]').text()).toBe('SomeFileName');
});
it('should show a status error if the file has an error', () => {
let wrapper = makeWrapper({}, { error: true });
expect(wrapper.find('[data-test="status"]').exists()).toBe(true);
Expand Down

0 comments on commit c491ac0

Please sign in to comment.