Fakultas Ilmu Komputer UI

Commit d4a1d22d authored by Nabilah Adani's avatar Nabilah Adani
Browse files

[RED] change test for information export pdf

parent 3310736c
Pipeline #79827 failed with stages
in 1 minute and 25 seconds
......@@ -7,18 +7,22 @@ const dummyImage = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASoAAAEsCAYAAA
describe('<ExportPDFButton />', () => {
it('should render correctly', () => {
shallow(<ExportPDFButton
png={dummyImage}
type={''}
selectedKey={''}
dataType={''}
chartType={true}
information={''}
clickable={false} />);
})
it('should call downloadAsPDF', () => {
const mod = require('../../utilities/utils');
jest.spyOn(mod, 'downloadAsPDF');
const btn = shallow(<ExportPDFButton
png={dummyImage}
type={''}
selectedKey={''}
dataType={''}
chartType={true}
information={''}
clickable={false} />);
btn.find('Button').simulate('click');
expect(mod.downloadAsPDF).toHaveBeenCalled();
......
......@@ -48,7 +48,7 @@ describe('<Statistic />', () => {
}
};
it('render diagram statistics without crashing', () => {
it('render diagram statistics without crashing', () => {
mount(
<AppContext.Provider value={testProps}>
<Statistic
......@@ -60,7 +60,7 @@ describe('<Statistic />', () => {
);
});
it('render table statistics without crashing', () => {
it('render table statistics without crashing', () => {
mount(
<AppContext.Provider value={testProps}>
<Statistic
......@@ -72,7 +72,7 @@ describe('<Statistic />', () => {
);
});
it('render table age statistics without crashing', () => {
it('render table age statistics without crashing', () => {
mount(
<AppContext.Provider value={testProps}>
<Statistic
......@@ -84,8 +84,7 @@ describe('<Statistic />', () => {
);
});
it('render sex stats chart successfully', () => {
mount(
it('render sex stats chart successfully', () => {
<AppContext.Provider value={testProps}>
<Statistic
isTable={false}
......@@ -96,7 +95,7 @@ describe('<Statistic />', () => {
);
});
it('render kasus in time range stats chart successfully', () => {
it('render kasus in time range stats chart successfully', () => {
mount(
<AppContext.Provider value={testProps}>
<Statistic
......@@ -108,7 +107,7 @@ describe('<Statistic />', () => {
);
});
it('sets ignoreDateRange state after clicking ignoreDateRange button', () => {
it('sets ignoreDateRange Statistics state after clicking ignoreDateRange button', () => {
const wrapper = mount(<Statistic
isTable={false}
type={StatisticType.Date}
......@@ -118,9 +117,22 @@ describe('<Statistic />', () => {
expect(wrapper.find(Checkbox).props().isChecked).toBe(false);
wrapper.find(Checkbox).simulate('click');
expect(wrapper.find(Checkbox).props().isChecked).toBe(true);
})
});
it('sets ignoreDateRangeFilter age after clicking ignoreDateRange button', () => {
const wrapper = mount(<Statistic
isTable={false}
type={StatisticType.Age}
data={statisticData.age}
/>);
expect(wrapper.find(Checkbox).props().isChecked).toBe(false);
wrapper.find(Checkbox).simulate('click');
expect(wrapper.find(Checkbox).props().isChecked).toBe(true);
});
it('render table district in time range stats chart successfully', () => {
it('render table district in time range stats chart successfully', () => {
mount(
<AppContext.Provider value={testProps}>
<Statistic
......@@ -132,7 +144,7 @@ describe('<Statistic />', () => {
);
});
it('sets ignoreDateRangeTable false state after clicking ignoreDateRangeTable button', () => {
it('sets ignoreDateRangeTable false state after clicking ignoreDateRangeTable button', () => {
const wrapper = mount(<Statistic
isTable={true}
type={StatisticType.Date}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment