Skip to content

Commit 8701892

Browse files
committed
Refactor deprecated substr method, use isUnitTest method from environmentServer
1 parent ae2b874 commit 8701892

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

‎src/components/scripts/utils/__tests__/dataSubjectId.spec.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('DataSubjectId Management', () => {
99
localStorage.clear()
1010
document.cookie.split(";").forEach((c) => {
1111
const eqPos = c.indexOf("=")
12-
const name = eqPos > -1 ? c.substr(0, eqPos) : c
12+
const name = eqPos > -1 ? c.slice(0, eqPos) : c
1313
document.cookie = `${name.trim()}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/`
1414
})
1515
})

‎src/integrations/FaviconGenerator/__tests__/index.spec.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import sharp, { type Metadata } from 'sharp'
33
import toIco from 'to-ico'
44
import { writeFile, mkdir } from 'fs/promises'
55
import { existsSync } from 'fs'
6+
import { isUnitTest } from '@lib/config/environmentServer'
67

78
// Mock external dependencies before any imports
89
vi.mock('sharp')
@@ -50,7 +51,7 @@ describe('FaviconGenerator Integration', () => {
5051
afterAll(() => {
5152
// Force process exit after a brief delay to allow cleanup
5253
setTimeout(() => {
53-
if (process.env.VITEST) {
54+
if (isUnitTest()) {
5455
process.exit(0)
5556
}
5657
}, 100)

0 commit comments

Comments
 (0)