Skip to content

Commit

Permalink
tersify test assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
tsullivan committed Oct 26, 2021
1 parent a881cf1 commit eb72498
Showing 1 changed file with 11 additions and 27 deletions.
38 changes: 11 additions & 27 deletions x-pack/plugins/reporting/server/lib/layouts/preserve_layout.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,12 @@ import { PreserveLayout } from './preserve_layout';

it('preserve layout uses default layout selectors', () => {
const testPreserveLayout = new PreserveLayout({ width: 16, height: 16 });
expect(testPreserveLayout.getCssOverridesPath()).toMatch(
`x-pack/plugins/reporting/server/lib/layouts/preserve_layout.css`
);
expect(testPreserveLayout.getBrowserViewport()).toMatchInlineSnapshot(`
Object {
"height": 32,
"width": 32,
}
`);
expect(testPreserveLayout.getBrowserZoom()).toMatchInlineSnapshot(`2`);
expect(testPreserveLayout.getPdfImageSize()).toMatchInlineSnapshot(`
Object {
"height": 16,
"width": 16,
}
`);
expect(testPreserveLayout.getPdfPageOrientation()).toMatchInlineSnapshot(`undefined`);

expect(testPreserveLayout.getCssOverridesPath()).toMatch(`layouts/preserve_layout.css`);
expect(testPreserveLayout.getBrowserViewport()).toMatchObject({ height: 32, width: 32 });
expect(testPreserveLayout.getBrowserZoom()).toBe(2);
expect(testPreserveLayout.getPdfImageSize()).toMatchObject({ height: 16, width: 16 });
expect(testPreserveLayout.getPdfPageOrientation()).toBe(undefined);
expect(
testPreserveLayout.getPdfPageSize({
pageMarginTop: 27,
Expand All @@ -35,13 +24,7 @@ it('preserve layout uses default layout selectors', () => {
headingHeight: 82,
subheadingHeight: 96,
})
).toMatchInlineSnapshot(`
Object {
"height": 382,
"width": 176,
}
`);

).toMatchObject({ height: 382, width: 176 });
expect(testPreserveLayout.selectors).toMatchInlineSnapshot(`
Object {
"itemsCountAttribute": "data-shared-items-count",
Expand All @@ -52,16 +35,17 @@ it('preserve layout uses default layout selectors', () => {
"timefilterDurationAttribute": "data-shared-timefilter-duration",
}
`);
expect(testPreserveLayout.groupCount).toMatchInlineSnapshot(`1`);
expect(testPreserveLayout.height).toMatchInlineSnapshot(`16`);
expect(testPreserveLayout.width).toMatchInlineSnapshot(`16`);
expect(testPreserveLayout.groupCount).toBe(1);
expect(testPreserveLayout.height).toBe(16);
expect(testPreserveLayout.width).toBe(16);
});

it('preserve layout allows customizable selectors', () => {
const testPreserveLayout = new PreserveLayout(
{ width: 16, height: 16 },
{ renderComplete: '[great-test-selectors]' }
);

expect(testPreserveLayout.selectors).toMatchInlineSnapshot(`
Object {
"itemsCountAttribute": "data-shared-items-count",
Expand Down

0 comments on commit eb72498

Please sign in to comment.