Last active
March 1, 2021 10:24
-
-
Save EileenJuergens/3c7973eb5acb09441c824d8c9344ca8f to your computer and use it in GitHub Desktop.
KPi Card test content
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe("<KPICard />", () => { | |
beforeEach(() => { | |
mountedComponentMobile = mountComponentMobile(mockedProps); | |
mountedComponentWeb = mountComponentWeb(mockedProps); | |
}); | |
it("should be defined", () => { | |
expect(mountedComponentMobile).toBeDefined(); | |
expect(mountedComponentMobile.type()).toEqual(KPICard); | |
expect(mountedComponentWeb).toBeDefined(); | |
expect(mountedComponentWeb.type()).toEqual(KPICard); | |
}); | |
it("should properly render accepted props", () => { | |
Object.keys(mockedProps).forEach((propName) => ( | |
expect(mountedComponentMobile.prop(propName)).toEqual(mockedProps[propName]) | |
)); | |
Object.keys(mockedProps).forEach((propName) => ( | |
expect(mountedComponentWeb.prop(propName)).toEqual(mockedProps[propName]) | |
)); | |
}); | |
it("should display the correct title", () => { | |
expect(mountedComponentMobile.find(".kpi-card__mobile__title").text()).toBe("Income"); | |
expect(mountedComponentWeb.find(".kpi-card__web__title").text()).toBe("Income"); | |
}); | |
it("should display the correctly value", () => { | |
expect(mountedComponentMobile.find(".kpi-card__mobile__value").text()).toBe("103.82k £"); | |
expect(mountedComponentWeb.find(".kpi-card__web__value").text()).toBe("103.82k £"); | |
}); | |
it("should render icon in web view", () => { | |
expect(mountedComponentMobile.find(Icon).length).toEqual(0); | |
expect(mountedComponentWeb.find(Icon).length).toEqual(1); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment