fix(tracker): fix unit tests

This commit is contained in:
nick-delirium 2023-11-30 17:32:33 +01:00
parent 5c4f1ea609
commit feed02ff10
5 changed files with 8 additions and 6 deletions

Binary file not shown.

View file

@ -1,7 +1,7 @@
{
"name": "@openreplay/tracker-assist",
"description": "Tracker plugin for screen assistance through the WebRTC",
"version": "7.0.0",
"version": "7.0.0-beta.1",
"keywords": [
"WebRTC",
"assistance",

View file

@ -1 +1 @@
export const pkgVersion = '7.0.0'
export const pkgVersion = '7.0.0-beta.1'

View file

@ -1,7 +1,7 @@
{
"name": "@openreplay/tracker",
"description": "The OpenReplay tracker main package",
"version": "11.0.1-9",
"version": "11.0.0-beta.1",
"keywords": [
"logging",
"replay"

View file

@ -20,13 +20,14 @@ describe('UserTestManager', () => {
beforeEach(() => {
document.body.innerHTML = ''
mockAppInstance = {
sessionStorage: { getItem: () => null },
localStorage: { getItem: () => null, setItem: () => null, removeItem: () => null },
timestamp: () => 0,
options: {
ingestPoint: 'https://localhost:3000/i',
},
getSessionID: () => 1111,
}
userTestManager = new UserTestManager(mockAppInstance as unknown as mockApp)
userTestManager = new UserTestManager(mockAppInstance as unknown as mockApp, 'testkey')
})
test('should create a greeting', () => {
@ -41,7 +42,6 @@ describe('UserTestManager', () => {
{ task_id: 1, allow_typing: false, title: 'Task1', description: 'Task1 Description' },
])
expect(document.body.innerHTML).toContain('Desc1')
expect(document.body.innerHTML).toContain('Task1')
})
test('should create a title section', () => {
@ -56,9 +56,11 @@ describe('UserTestManager', () => {
})
test('should create tasks section', () => {
jest.useFakeTimers()
const tasksSection = userTestManager.createTasksSection([
{ title: 'Task1', description: 'Desc1', task_id: 1, allow_typing: false },
])
jest.runAllTimers()
expect(tasksSection).toBeDefined()
expect(tasksSection.innerHTML).toContain('Task1')
expect(tasksSection.innerHTML).toContain('Desc1')