overleaf/services/web/test/frontend/features/chat/components/stubs.js
Timothée Alby 420aa4a657 Merge pull request #3232 from overleaf/ta-file-tree-react
React File Tree

GitOrigin-RevId: fb3141ba8cd9ca0d68e87edb74764a360144c8fe
2020-11-27 03:05:05 +00:00

39 lines
869 B
JavaScript

import sinon from 'sinon'
import { resetChatStore } from '../../../../../frontend/js/features/chat/store/chat-store-effect'
export function stubUIConfig() {
window.uiConfig = {
chatMessageBorderSaturation: '85%',
chatMessageBorderLightness: '40%',
chatMessageBgSaturation: '85%',
chatMessageBgLightness: '40%'
}
}
export function tearDownUIConfigStubs() {
delete window.uiConfig
}
export function stubMathJax() {
window.MathJax = {
Hub: {
Queue: sinon.stub(),
config: { tex2jax: { inlineMath: [['$', '$']] } }
}
}
}
export function tearDownMathJaxStubs() {
delete window.MathJax
}
export function stubChatStore({ user }) {
window._ide = { socket: { on: sinon.stub(), off: sinon.stub() } }
window.user = user
resetChatStore()
}
export function tearDownChatStore() {
delete window._ide
delete window.user
}