forked from snowplow/snowplow-javascript-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbrowser_props.test.ts
More file actions
27 lines (23 loc) · 965 Bytes
/
Copy pathbrowser_props.test.ts
File metadata and controls
27 lines (23 loc) · 965 Bytes
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
import { floorDimensionFields, getBrowserProperties } from '../src/helpers/browser_props';
describe('Browser props', () => {
it('floorDimensionFields correctly floors dimension type values', () => {
const testDimensions = '100x100';
expect(floorDimensionFields(testDimensions)).toEqual(testDimensions);
});
it('floorDimensionFields correctly floors dimension type values with fractional numbers', () => {
const testFractionalDimensions = '100.2x100.1';
expect(floorDimensionFields(testFractionalDimensions)).toEqual('100x100');
});
describe('#getBrowserProperties', () => {
describe('with undefined document', () => {
beforeAll(() => {
// @ts-expect-error
document = undefined;
});
it('does not invoke the resize observer if the document is null', () => {
const browserProperties = getBrowserProperties();
expect(browserProperties).not.toEqual(null);
});
});
});
});