Passed
Push — feature/application-translatio... ( f58ce9...2578af )
by Tristan
07:53
created

resources/assets/js/helpers/setupTests.ts   A

Complexity

Total Complexity 1
Complexity/F 0

Size

Lines of Code 20
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 1
mnd 1
bc 1
fnc 0
bpm 0
cpm 0
noi 0
1
/**
2
 * Setup to run before any tests that require react-intl
3
 * support, see https://testing-library.com/docs/example-react-intl#configuring-react-intl-polyfills
4
 */
5
import IntlPolyfill from "intl";
6
import "intl/locale-data/jsonp/en";
7
import "intl/locale-data/jsonp/fr";
8
9
const setupTests = (): void => {
10
  // https://formatjs.io/guides/runtime-environments/#server
11
  if (global.Intl) {
12
    Intl.NumberFormat = IntlPolyfill.NumberFormat;
13
    Intl.DateTimeFormat = IntlPolyfill.DateTimeFormat;
14
  } else {
15
    global.Intl = IntlPolyfill;
16
  }
17
};
18
19
setupTests();
20