2024-01-15 22:26:50 +00:00
|
|
|
import vueSnapshotSerializer from 'jest-serializer-vue'
|
|
|
|
import { expect, vi } from 'vitest'
|
|
|
|
import Axios from 'axios'
|
|
|
|
|
2022-10-09 10:53:10 +00:00
|
|
|
declare global {
|
|
|
|
interface Window {
|
2024-02-25 19:32:53 +00:00
|
|
|
BASE_URL: string
|
|
|
|
MAILER_CONFIGURED: boolean
|
2024-03-30 16:49:25 +00:00
|
|
|
SSO_PROVIDERS: string[]
|
2024-02-25 19:32:53 +00:00
|
|
|
createLemonSqueezy: () => void
|
2022-10-09 10:53:10 +00:00
|
|
|
}
|
|
|
|
|
2024-01-15 22:26:50 +00:00
|
|
|
interface LemonSqueezy {
|
|
|
|
Url: {
|
2024-02-25 19:32:53 +00:00
|
|
|
Open: () => void
|
2024-01-15 22:26:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-05-12 13:21:14 +00:00
|
|
|
|
|
|
|
expect.addSnapshotSerializer(vueSnapshotSerializer)
|
2022-07-10 14:19:11 +00:00
|
|
|
|
|
|
|
global.ResizeObserver = global.ResizeObserver ||
|
|
|
|
vi.fn().mockImplementation(() => ({
|
|
|
|
disconnect: vi.fn(),
|
|
|
|
observe: vi.fn(),
|
|
|
|
unobserve: vi.fn()
|
|
|
|
}))
|
2022-07-22 16:59:28 +00:00
|
|
|
|
2024-01-15 22:26:50 +00:00
|
|
|
|
|
|
|
global.LemonSqueezy = {
|
|
|
|
Url: {
|
|
|
|
Open: vi.fn()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-18 15:31:36 +00:00
|
|
|
HTMLMediaElement.prototype.load = vi.fn()
|
|
|
|
HTMLMediaElement.prototype.play = vi.fn()
|
|
|
|
HTMLMediaElement.prototype.pause = vi.fn()
|
2022-07-24 11:47:18 +00:00
|
|
|
|
2022-11-18 15:31:36 +00:00
|
|
|
HTMLDialogElement.prototype.show = vi.fn(function mock () {
|
|
|
|
this.open = true
|
|
|
|
})
|
|
|
|
|
|
|
|
HTMLDialogElement.prototype.showModal = vi.fn(function mock () {
|
|
|
|
this.open = true
|
|
|
|
})
|
|
|
|
|
|
|
|
HTMLDialogElement.prototype.close = vi.fn(function mock () {
|
|
|
|
this.open = false
|
|
|
|
})
|
2022-10-27 21:19:26 +00:00
|
|
|
|
2022-10-09 10:53:10 +00:00
|
|
|
window.BASE_URL = 'http://test/'
|
2024-02-25 19:32:53 +00:00
|
|
|
window.MAILER_CONFIGURED = true
|
2024-03-30 16:49:25 +00:00
|
|
|
window.SSO_PROVIDERS = []
|
2024-02-25 19:32:53 +00:00
|
|
|
|
2024-01-15 22:26:50 +00:00
|
|
|
window.createLemonSqueezy = vi.fn()
|
2022-10-09 10:53:10 +00:00
|
|
|
|
|
|
|
Axios.defaults.adapter = vi.fn()
|
2024-09-05 10:30:56 +00:00
|
|
|
|
|
|
|
Object.assign(navigator, {
|
|
|
|
clipboard: {
|
|
|
|
writeText: vi.fn()
|
|
|
|
}
|
|
|
|
})
|