Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions app/src/tests/components/Snackbar.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import MessageSnackbar from '../../components/Snackbar';
import Adapter from 'enzyme-adapter-react-16';
import Enzyme from 'enzyme';

Enzyme.configure({ adapter: new Adapter() });

describe('Testing SnackBar', () => {

it('should render as expected', function() {
const tree = MessageSnackbar({notification_text: 'test'}, {handleClose: () => jest.fn()}, {variant: "success" });
expect(tree).toMatchSnapshot();
});
});
13 changes: 13 additions & 0 deletions app/src/tests/components/StorySnackBar.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import MessageSnackbar from '../../components/StorySnackbar';
import Adapter from 'enzyme-adapter-react-16';
import Enzyme from 'enzyme';

Enzyme.configure({ adapter: new Adapter() });

describe('Testing StorySnackBar', () => {

it('should render as expected', function() {
const tree = MessageSnackbar({notification_text: 'test'}, {handleClose: () => jest.fn()}, {variant: "success" });
expect(tree).toMatchSnapshot();
});
});
8 changes: 6 additions & 2 deletions app/src/tests/ducks/stories.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,21 @@ describe('get story method', () => {
})
})

describe('validate content method', () => {
describe('warn about two intents problem', () => {
it('should warn about two intents problem', () => {
let content = [{ id: 1, type: 'utter' }, { id: 1, type: 'intent' }, { id: 2, type: 'intent' }];
expect(validationContent(content)).toEqual(message.story.two_intents)
})
})
})

describe('warn about starting with intents problem', () => {
it('should warn about starting with intents problem', () => {
let content = [{ id: 1, type: 'utter' }, { id: 1, type: 'intent' }, { id: 1, type: 'utter' }];
expect(validationContent(content)).toEqual(message.story.first_element)
})
})

describe('return a empty string when everything is fine', () => {
it('should return a empty string when everything is fine', () => {
let content = [{ id: 1, type: 'intent' }, { id: 1, type: 'utter' }];
expect(validationContent(content)).toEqual('')
Expand Down
2 changes: 2 additions & 0 deletions app/src/tests/ducks/utters.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ describe('add utter content method', () => {
new_state.old_content = [['', '']]
expect(addUtterContent(INITIAL_STATE)).toEqual(new_state);
})
})

describe('add utter to state in alternatives', () => {
it('should add utter to state in alternatives', () => {
let state = clone(INITIAL_STATE);
state.multiple_alternatives = true
Expand Down