UNPKG

1.14 kBJavaScriptView Raw
1import testRangedFeatureHelpers from './helpers/testRangedFeatureHelpers';
2import cssSerialiser from './helpers/cssSerialiser';
3import { RANGED_FEATURES } from '../features';
4
5import {
6 queryThrowsIfMissingBreakpoint,
7 queryReturnsCorrectValueSingleBreakpoint,
8 queryReturnsCorrectValueWithTwoBreakpoints,
9 queryThrowsIfMissingEitherBreakpoint,
10 queryThrowsWithBothBreakpointsTheSame,
11} from './sharedTests/rangedFeatureHelpers';
12
13expect.addSnapshotSerializer(cssSerialiser);
14
15const singleArgumentSharedTest = [
16 queryThrowsIfMissingBreakpoint,
17 queryReturnsCorrectValueSingleBreakpoint,
18];
19
20describe('ranged feature helpers', () => {
21 for (const feature of RANGED_FEATURES) {
22 testRangedFeatureHelpers(feature.name, {
23 tests: {
24 above: [...singleArgumentSharedTest],
25 below: [...singleArgumentSharedTest],
26 between: [
27 queryReturnsCorrectValueWithTwoBreakpoints,
28 queryThrowsIfMissingEitherBreakpoint,
29 queryThrowsWithBothBreakpointsTheSame,
30 ],
31 at: [...singleArgumentSharedTest],
32 atBreakpoint: [...singleArgumentSharedTest],
33 },
34 });
35 }
36});