mirror of
https://github.com/empayre/fleet.git
synced 2024-11-07 01:15:22 +00:00
bcfac603f0
* added storybook * added avatar component * added button story * added dropdown button story * removed unused ellipsis component * cleaned up modal path * reorganized enroll secrets table file * added flash story; removed unused persistent flash * added fleet ace story * added checkbox story * added dropdown story * added input story * fixed storybook build * fixed avatar * added input with icon story * added radio button story * added select targets dropdown story * added slider story * added tooltip story * added info banner story * removed unused loaders; added spinner story * added modal story * removed unused NumberPill * added pagination story * lint fixes * added documentation to run * modified documentation * fixed corelayout test * fixed format for date-fns * fixed date format that breaks tests * wait for page
51 lines
1.4 KiB
JavaScript
51 lines
1.4 KiB
JavaScript
import { mount } from "enzyme";
|
|
|
|
import helpers from "test/helpers";
|
|
import { userStub } from "test/stubs";
|
|
import CoreLayout from "./CoreLayout";
|
|
|
|
const { connectedComponent, reduxMockStore } = helpers;
|
|
|
|
describe("CoreLayout - layouts", () => {
|
|
const store = {
|
|
app: { config: {} },
|
|
auth: { user: userStub },
|
|
notifications: {},
|
|
persistentFlash: {
|
|
showFlash: false,
|
|
message: "",
|
|
},
|
|
};
|
|
const mockStore = reduxMockStore(store);
|
|
|
|
it("renders the FlashMessage component when notifications are present", () => {
|
|
const storeWithNotifications = {
|
|
app: { config: {} },
|
|
auth: {
|
|
user: userStub,
|
|
},
|
|
notifications: {
|
|
alertType: "success",
|
|
isVisible: true,
|
|
message: "nice jerb!",
|
|
},
|
|
};
|
|
const mockStoreWithNotifications = reduxMockStore(storeWithNotifications);
|
|
const componentWithFlash = connectedComponent(CoreLayout, {
|
|
mockStore: mockStoreWithNotifications,
|
|
});
|
|
const componentWithoutFlash = connectedComponent(CoreLayout, {
|
|
mockStore,
|
|
});
|
|
|
|
const appWithFlash = mount(componentWithFlash);
|
|
const appWithoutFlash = mount(componentWithoutFlash);
|
|
|
|
expect(appWithFlash.length).toEqual(1);
|
|
expect(appWithoutFlash.length).toEqual(1);
|
|
|
|
expect(appWithFlash.find("FlashMessage").html()).toBeTruthy();
|
|
expect(appWithoutFlash.find("FlashMessage").html()).toBeFalsy();
|
|
});
|
|
});
|