1
0
Fork 0
mirror of https://github.com/betagouv/mon-entreprise synced 2025-02-20 18:55:02 +00:00
mon-entreprise/mon-entreprise/test/componentTestSetup.js
Maxime Quandalle 81ecef7021 ⬆ MAJ du React adapter Enzyme
Utilisation d'un fork en attendant que React 17 soit supporté par
Enzyme.

J'ai essayé rapidement la librairie
https://testing-library.com/docs/react-testing-library/migrate-from-enzyme
vers laquelle certains utilisateurs d'Enzyme semblent maintenant se
tourner, mais la migration est non triviale (alors même que nous n'avons
qu'un seul fichier qui utilise les tests Enzyme !)
2020-11-20 12:08:21 +01:00

16 lines
555 B
JavaScript

import chai from 'chai'
import Enzyme from 'enzyme'
// We use a fork of the React adapter because the official one doesn't support
// React 17 yet. See https://github.com/enzymejs/enzyme/issues/2429
import Adapter from '@wojtekmaj/enzyme-adapter-react-17'
import sinonChai from 'sinon-chai'
chai.use(sinonChai)
Enzyme.configure({ adapter: new Adapter() })
// Setup Intl in "en" and "fr" for testing
// var localesMyAppSupports = ['en', 'fr']
global.Intl = require('intl')
require('intl/locale-data/jsonp/en.js')
require('intl/locale-data/jsonp/fr.js')