Skip to content

Commit

Permalink
fix test types
Browse files Browse the repository at this point in the history
  • Loading branch information
paweltomaszewskisaucelabs committed Sep 25, 2024
1 parent 445c9c4 commit e048195
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions visual-js/visual/src/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import { getFullPageConfig, parseRegionsForAPI } from './utils';
import { RegionIn } from './graphql/__generated__/graphql';
import { FullPageScreenshotOptions } from './types';

const configDelay: FullPageScreenshotOptions = {
type MockElement = { elementId: string };

const configDelay: FullPageScreenshotOptions<MockElement> = {
delayAfterScrollMs: 1500,
};

const configDelayBig: FullPageScreenshotOptions = {
const configDelayBig: FullPageScreenshotOptions<MockElement> = {
delayAfterScrollMs: 5000,
};

Expand Down Expand Up @@ -94,15 +96,19 @@ describe('utils', () => {
const local = {
scrollElement: Promise.resolve({ elementId: elementId }),
};
expect(await getFullPageConfig(main, local)).toEqual({
expect(
await getFullPageConfig(main, local, (el) => el.elementId),
).toEqual({
scrollElement: elementId,
});
});
test('with scrollElement when scrollElement is an object', async () => {
const elementId = 'elementId';
const main = { scrollElement: { elementId: elementId } };
const local = {};
expect(await getFullPageConfig(main, local)).toEqual({
expect(
await getFullPageConfig(main, local, (el) => el.elementId),
).toEqual({
scrollElement: elementId,
});
});
Expand Down

0 comments on commit e048195

Please sign in to comment.