/
index.test.tsx
44 lines (38 loc) · 1.39 KB
/
index.test.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import React from "react";
import { render, screen } from "../../test-utils";
import AirportIllustration from "..";
import { SIZE_OPTIONS } from "../../primitives/IllustrationPrimitive";
import SPACINGS_AFTER from "../../common/getSpacingToken/consts";
import defaultTheme from "../../defaultTheme";
const name = "BGYFastTrack";
const dataTest = "test";
describe(`AirportIllustration of ${name}`, () => {
beforeEach(() => {
render(
<AirportIllustration
size={SIZE_OPTIONS.EXTRASMALL}
name={name}
dataTest="test"
spaceAfter={SPACINGS_AFTER.NORMAL}
/>,
);
});
it("should have passed props", () => {
expect(screen.getByRole("img")).toHaveAttribute("alt", name);
expect(screen.getByRole("img")).toHaveAttribute("data-test", dataTest);
});
it("should render proper image", () => {
expect(screen.getByRole("img").getAttribute("src")).toMatchInlineSnapshot(
`"//images.kiwi.com/illustrations/0x90/BGYFastTrack-Q85.png"`,
);
expect(screen.getByRole("img").getAttribute("srcset")).toMatchInlineSnapshot(
`"//images.kiwi.com/illustrations/0x180/BGYFastTrack-Q85.png 2x, //images.kiwi.com/illustrations/0x270/BGYFastTrack-Q85.png 3x"`,
);
});
it("should have margin-bottom", () => {
expect(getComputedStyle(screen.getByRole("img"))).toHaveProperty(
"margin-bottom",
defaultTheme.orbit.spaceSmall,
);
});
});