feat: initial commit — tcb_devportal Next.js app
Some checks failed
homelab-k8s-services/tcb_devportal/pipeline/head There was a failure building this commit
Some checks failed
homelab-k8s-services/tcb_devportal/pipeline/head There was a failure building this commit
Includes Helm chart (tcb-devportal), Jenkinsfile with homelab CI pipeline, and Next.js app source.
This commit is contained in:
52
jest.setup.js
Normal file
52
jest.setup.js
Normal file
@@ -0,0 +1,52 @@
|
||||
/* eslint-disable @typescript-eslint/no-require-imports -- Jest setup runs in Node with CommonJS */
|
||||
require('@testing-library/jest-dom')
|
||||
|
||||
process.env.NEXT_PUBLIC_BACK_END_DOMAIN =
|
||||
process.env.NEXT_PUBLIC_BACK_END_DOMAIN || 'http://localhost/api/v1'
|
||||
process.env.NEXT_PUBLIC_TIME_OUT_API =
|
||||
process.env.NEXT_PUBLIC_TIME_OUT_API || '60000'
|
||||
|
||||
if (
|
||||
(typeof globalThis.crypto === 'undefined' ||
|
||||
typeof globalThis.crypto.randomUUID !== 'function') &&
|
||||
typeof require('crypto').randomUUID === 'function'
|
||||
) {
|
||||
const nodeCrypto = require('crypto')
|
||||
globalThis.crypto = globalThis.crypto || {}
|
||||
globalThis.crypto.randomUUID = nodeCrypto.randomUUID.bind(nodeCrypto)
|
||||
}
|
||||
|
||||
const mockLocalStorage = {
|
||||
getItem: jest.fn(),
|
||||
setItem: jest.fn(),
|
||||
removeItem: jest.fn(),
|
||||
clear: jest.fn(),
|
||||
}
|
||||
global.localStorage = mockLocalStorage
|
||||
if (typeof window !== 'undefined') {
|
||||
window.localStorage = mockLocalStorage
|
||||
}
|
||||
|
||||
class MockResizeObserver {
|
||||
observe = jest.fn()
|
||||
unobserve = jest.fn()
|
||||
disconnect = jest.fn()
|
||||
}
|
||||
|
||||
class MockBroadcastChannel {
|
||||
postMessage = jest.fn()
|
||||
close = jest.fn()
|
||||
onmessage = null
|
||||
}
|
||||
|
||||
global.ResizeObserver = global.ResizeObserver || MockResizeObserver
|
||||
global.BroadcastChannel = global.BroadcastChannel || MockBroadcastChannel
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
window.ResizeObserver = window.ResizeObserver || MockResizeObserver
|
||||
window.BroadcastChannel = window.BroadcastChannel || MockBroadcastChannel
|
||||
}
|
||||
|
||||
if (!Element.prototype.scrollIntoView) {
|
||||
Element.prototype.scrollIntoView = jest.fn()
|
||||
}
|
||||
Reference in New Issue
Block a user