Remove greeter snapshot test
This commit is contained in:
parent
cd24e2bfc5
commit
78425f1115
3 changed files with 29 additions and 25 deletions
|
@ -94,8 +94,9 @@ export const getDateString = (
|
||||||
weekdays: Array<string>,
|
weekdays: Array<string>,
|
||||||
months: Array<string>,
|
months: Array<string>,
|
||||||
format: string,
|
format: string,
|
||||||
|
date?: Date,
|
||||||
) => {
|
) => {
|
||||||
const currentDate = new Date();
|
const currentDate = date ? date : new Date();
|
||||||
|
|
||||||
const weekday = weekdays[currentDate.getDay()];
|
const weekday = weekdays[currentDate.getDay()];
|
||||||
const day = currentDate.getDate();
|
const day = currentDate.getDate();
|
||||||
|
|
|
@ -1,26 +1,5 @@
|
||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`Greeter snapshot test with properties 1`] = `
|
|
||||||
<body>
|
|
||||||
<div>
|
|
||||||
<div
|
|
||||||
class="sc-bczRLJ kimCm"
|
|
||||||
>
|
|
||||||
<h3
|
|
||||||
class="sc-dkzDqf jtvEMe"
|
|
||||||
>
|
|
||||||
Wednesday, April 20th 2022
|
|
||||||
</h3>
|
|
||||||
<h1
|
|
||||||
class="sc-gsnTZi cdSBOi"
|
|
||||||
>
|
|
||||||
Good afternoon!
|
|
||||||
</h1>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`Greeter snapshot test without properties 1`] = `
|
exports[`Greeter snapshot test without properties 1`] = `
|
||||||
<body>
|
<body>
|
||||||
<div />
|
<div />
|
||||||
|
|
|
@ -3,6 +3,7 @@ import Greeter, {
|
||||||
IGreeterProps,
|
IGreeterProps,
|
||||||
isBetween,
|
isBetween,
|
||||||
getExtension,
|
getExtension,
|
||||||
|
getDateString,
|
||||||
} from "../../components/greeter";
|
} from "../../components/greeter";
|
||||||
|
|
||||||
const props: IGreeterProps = {
|
const props: IGreeterProps = {
|
||||||
|
@ -98,9 +99,32 @@ it("getExtension test", () => {
|
||||||
expect(getExtension(31)).toEqual("st");
|
expect(getExtension(31)).toEqual("st");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Greeter snapshot test with properties", () => {
|
it("getDateString Test", () => {
|
||||||
const { baseElement } = render(<Greeter greeter={{ greeter: props }} />);
|
let dates: [Date] = [
|
||||||
expect(baseElement).toMatchSnapshot();
|
new Date("2022-04-04T00:00:00"),
|
||||||
|
new Date("2022-04-05T00:00:00"),
|
||||||
|
new Date("2022-04-06T00:00:00"),
|
||||||
|
new Date("2022-04-07T00:00:00"),
|
||||||
|
new Date("2022-04-08T00:00:00"),
|
||||||
|
new Date("2022-04-09T00:00:00"),
|
||||||
|
new Date("2022-04-10T00:00:00"),
|
||||||
|
];
|
||||||
|
|
||||||
|
let results: [string] = [
|
||||||
|
"Monday, April 4th 2022",
|
||||||
|
"Tuesday, April 5th 2022",
|
||||||
|
"Wednesday, April 6th 2022",
|
||||||
|
"Thursday, April 7th 2022",
|
||||||
|
"Friday, April 8th 2022",
|
||||||
|
"Saturday, April 9th 2022",
|
||||||
|
"Sunday, April 10th 2022",
|
||||||
|
];
|
||||||
|
|
||||||
|
for (var i = 0; i < dates.length; i++) {
|
||||||
|
expect(
|
||||||
|
getDateString(props.days, props.months, props.dateformat, dates[i]),
|
||||||
|
).toEqual(results[i]);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Greeter snapshot test without properties", () => {
|
it("Greeter snapshot test without properties", () => {
|
||||||
|
|
Loading…
Reference in a new issue