tracker: fix jest config, update test cases

This commit is contained in:
nick-delirium 2025-03-17 11:44:58 +01:00 committed by Delirium
parent e7d309dadf
commit 829e1c8bde
4 changed files with 14 additions and 3 deletions

View file

@ -8,6 +8,14 @@ const config = {
moduleNameMapper: { moduleNameMapper: {
'(.+)\\.js': '$1', '(.+)\\.js': '$1',
}, },
globals: {
'ts-jest': {
tsConfig: {
target: 'es2020',
lib: ['DOM', 'ES2022'],
},
},
},
} }
export default config export default config

View file

@ -23,6 +23,9 @@ describe('Console logging module', () => {
safe: jest.fn((callback) => callback), safe: jest.fn((callback) => callback),
send: jest.fn(), send: jest.fn(),
attachStartCallback: jest.fn(), attachStartCallback: jest.fn(),
sanitizer: {
privateMode: false,
},
ticker: { ticker: {
attach: jest.fn(), attach: jest.fn(),
}, },

View file

@ -2,8 +2,8 @@ import { describe, expect, jest, afterEach, beforeEach, test } from '@jest/globa
import Sanitizer, { SanitizeLevel, Options, stringWiper } from '../main/app/sanitizer.js' import Sanitizer, { SanitizeLevel, Options, stringWiper } from '../main/app/sanitizer.js'
describe('stringWiper', () => { describe('stringWiper', () => {
test('should replace all characters with ', () => { test('should replace all characters with *', () => {
expect(stringWiper('Sensitive Data')).toBe('██████████████') expect(stringWiper('Sensitive Data')).toBe('**************')
}) })
}) })
@ -126,7 +126,7 @@ describe('Sanitizer', () => {
element.mockId = 1 element.mockId = 1
element.innerText = 'Sensitive Data' element.innerText = 'Sensitive Data'
const sanitizedText = sanitizer.getInnerTextSecure(element) const sanitizedText = sanitizer.getInnerTextSecure(element)
expect(sanitizedText).toEqual('██████████████') expect(sanitizedText).toEqual('**************')
}) })
test('should return empty string if node element does not exist', () => { test('should return empty string if node element does not exist', () => {