Skip to content

Commit

Permalink
Chore (ToastBody) migrate to RTL (#2710)
Browse files Browse the repository at this point in the history
  • Loading branch information
theinfiltrator7 committed Mar 21, 2023
1 parent 20a8753 commit d9568cf
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions src/__tests__/ToastBody.spec.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
import React from 'react';
import { shallow } from 'enzyme';
import { ToastBody } from '..';
import {
testForCustomClass,
testForCustomTag,
testForDefaultClass,
} from '../testUtils';

describe('ToastBody', () => {
it('should render with "toast-body" class', () => {
const wrapper = shallow(<ToastBody>Yo!</ToastBody>);

expect(wrapper.text()).toBe('Yo!');
expect(wrapper.hasClass('toast-body')).toBe(true);
testForDefaultClass(ToastBody, 'toast-body');
});

it('should render additional classes', () => {
const wrapper = shallow(<ToastBody className="other">Yo!</ToastBody>);

expect(wrapper.hasClass('other')).toBe(true);
expect(wrapper.hasClass('toast-body')).toBe(true);
testForCustomClass(ToastBody);
});

it('should render custom tag', () => {
const wrapper = shallow(<ToastBody tag="main">Yo!</ToastBody>);

expect(wrapper.text()).toBe('Yo!');
expect(wrapper.hasClass('toast-body')).toBe(true);
expect(wrapper.type()).toBe('main');
testForCustomTag(ToastBody);
});
});

0 comments on commit d9568cf

Please sign in to comment.