I would like to test a filter function I wrote which return a date formatted using Intl.DateTimeFormat(\'en-GB\', options):
// module \"date.js\"
export default
In package.json add the intl
package
"intl": "*",
In the jest.config.js
module.exports = {
moduleNameMapper: {
Intl: '/node_modules/intl/'
}
};
Then in Date.spec.js
describe(`Date by locale`, () => {
beforeAll(() => { global.Intl = require('intl'); });
// Add your tests here.
// Add a temporary console.log to verify the correct output
}