overleaf/services/web/test/frontend/bootstrap.js
Miguel Serrano 3b1c4e19a4 Merge pull request #3300 from overleaf/msm-chat-react-store
React chat store

GitOrigin-RevId: 204009eb5798b02a41e621b33b05ef0cb9d10b15
2020-11-25 03:04:29 +00:00

29 lines
931 B
JavaScript

// Run babel on tests to allow support for import/export statements in Node
require('@babel/register')
// Load JSDOM to mock the DOM in Node
require('jsdom-global/register')
// Load sinon-chai assertions so expect(stubFn).to.have.been.calledWith('abc')
// has a nicer failure messages
const chai = require('chai')
chai.use(require('sinon-chai'))
window.i18n = { currentLangCode: 'en' }
require('../../frontend/js/i18n')
const moment = require('moment')
moment.updateLocale('en', {
calendar: {
lastDay: '[Yesterday]',
sameDay: '[Today]',
nextDay: '[Tomorrow]',
lastWeek: 'ddd, Do MMM YY',
nextWeek: 'ddd, Do MMM YY',
sameElse: 'ddd, Do MMM YY'
}
})
// node-fetch doesn't accept relative URL's: https://github.com/node-fetch/node-fetch/blob/master/docs/v2-LIMITS.md#known-differences
const fetch = require('node-fetch')
global.fetch = (url, ...options) => fetch('http://localhost' + url, ...options)