diff --git a/client/components/__test__/FileNode.test.jsx b/client/components/__test__/FileNode.test.jsx index 756652a3..d4496496 100644 --- a/client/components/__test__/FileNode.test.jsx +++ b/client/components/__test__/FileNode.test.jsx @@ -2,7 +2,6 @@ import React from 'react'; import { shallow } from 'enzyme'; import { FileNode } from '../../modules/IDE/components/FileNode'; -beforeAll(() => {}); describe('', () => { let component; let props = {}; @@ -17,7 +16,7 @@ describe('', () => { const getUpdatedName = () => getState().updatedName; describe('with valid props, regardless of filetype', () => { - [''].forEach((fileType) => { + ['folder', 'file'].forEach((fileType) => { beforeEach(() => { props = { ...props, @@ -39,6 +38,24 @@ describe('', () => { }; component = shallow(); }); + + describe('when changing name', () => { + beforeEach(() => { + input = component.find('.sidebar__file-item-input'); + renameTriggerButton = component + .find('.sidebar__file-item-option') + .first(); + component.setState({ isEditing: true }); + }); + + describe('to an empty name', () => { + const newName = ''; + beforeEach(() => changeName(newName)); + + it('should not save', () => expect(props.updateFileName).not.toHaveBeenCalled()); + it('should reset name', () => expect(getUpdatedName()).toEqual(props.name)); + }); + }); }); }); @@ -88,15 +105,6 @@ describe('', () => { // Failure Scenarios - describe('to an empty filename', () => { - const newName = ''; - beforeEach(() => changeName(newName)); - - - it('should not save', () => expect(props.updateFileName).not.toHaveBeenCalled()); - it('should reset name', () => expect(getUpdatedName()).toEqual(props.name)); - }); - describe('to an extensionless filename', () => { const newName = 'extensionless'; beforeEach(() => changeName(newName)); diff --git a/client/components/__test__/Toolbar.test.jsx b/client/components/__test__/Toolbar.test.jsx new file mode 100644 index 00000000..ffb47169 --- /dev/null +++ b/client/components/__test__/Toolbar.test.jsx @@ -0,0 +1,9 @@ +import React from 'react'; +import { shallow } from 'enzyme'; +import { Toolbar } from '../../modules/IDE/components/Toolbar'; + +describe('', () => { + describe('with valid props', () => { + it('renders', () => expect(true).toEqual(true)); + }); +});