Adding
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import { shallow } from "enzyme";
|
||||
import React from "react";
|
||||
import moment from "moment";
|
||||
import { IGoal } from "../../shared/models/Goal";
|
||||
import GoalTable from "./GoalTable";
|
||||
import Product2 from "../../shared/enumerations/Product";
|
||||
import { UserType } from "../../shared/models/Auditable";
|
||||
|
||||
describe("An associate views the goal audit table", () => {
|
||||
it("Displays a message when there is no data to load", () => {
|
||||
let wrapper = shallow(<GoalTable goals={undefined} />);
|
||||
expect(wrapper.find('[data-test="no-data-message"]').length).toBe(1);
|
||||
expect(wrapper.find("[data-test='autotable-container']").length).toBe(
|
||||
0
|
||||
);
|
||||
});
|
||||
|
||||
it("Displays a message when there is no data to load", () => {
|
||||
let wrapper = shallow(<GoalTable goals={[]} />);
|
||||
expect(wrapper.find('[data-test="no-data-message"]').length).toBe(1);
|
||||
expect(wrapper.find("[data-test='autotable-container']").length).toBe(
|
||||
0
|
||||
);
|
||||
});
|
||||
|
||||
it("Does not display message when there is data", () => {
|
||||
const goals: IGoal[] = [
|
||||
{
|
||||
id: 100,
|
||||
lastUpdatedByType: UserType.System,
|
||||
lastUpdatedBy: "Tester",
|
||||
lastUpdated: moment().utc(),
|
||||
createdByType: UserType.System,
|
||||
createdBy: "Tester1",
|
||||
created: moment().utc(),
|
||||
employeeId: "11771",
|
||||
departmentId: 56,
|
||||
product: Product2.Vehicle,
|
||||
startDate: moment().utc(),
|
||||
endDate: moment().utc(),
|
||||
value: 1
|
||||
}
|
||||
];
|
||||
let wrapper = shallow(<GoalTable goals={goals} />);
|
||||
expect(wrapper.find("[data-test='no-data-message']").length).toBe(0);
|
||||
expect(wrapper.find("[data-test='autotable-container']").length).toBe(
|
||||
1
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user