fix: Fixes issue where lock screen would not use previously active theme (#2372)

This commit is contained in:
Mo
2023-07-26 15:50:08 -05:00
committed by GitHub
parent 86fc4c684d
commit d268c02ab3
88 changed files with 1118 additions and 716 deletions

View File

@@ -0,0 +1,58 @@
import { ActiveThemeList } from './ActiveThemeList'
import { ItemManagerInterface } from '@standardnotes/services'
import { Uuid } from '@standardnotes/domain-core'
describe('ActiveThemeList', () => {
let itemManager: ItemManagerInterface
let list: ActiveThemeList
beforeEach(() => {
itemManager = {} as ItemManagerInterface
itemManager.findItem = jest.fn()
list = new ActiveThemeList(itemManager)
})
it('should initialize with an empty list', () => {
expect(list.getList()).toEqual([])
})
it('should be empty initially', () => {
expect(list.isEmpty()).toBe(true)
})
it('should not have items that have not been added', () => {
const uuid = Uuid.create('00000000-0000-0000-0000-000000000000').getValue()
expect(list.has(uuid)).toBe(false)
})
it('should add an item to the list', () => {
const uuid = Uuid.create('00000000-0000-0000-0000-000000000000').getValue()
list.add(uuid)
expect(list.getList()).toContain(uuid)
expect(list.has(uuid)).toBe(true)
})
it('should not add a duplicate item to the list', () => {
const uuid = Uuid.create('00000000-0000-0000-0000-000000000000').getValue()
list.add(uuid)
list.add(uuid)
expect(list.getList()).toEqual([uuid])
})
it('should remove an item from the list', () => {
const uuid = Uuid.create('00000000-0000-0000-0000-000000000000').getValue()
list.add(uuid)
list.remove(uuid)
expect(list.getList()).not.toContain(uuid)
expect(list.has(uuid)).toBe(false)
})
it('should clear the list', () => {
const uuid = Uuid.create('00000000-0000-0000-0000-000000000000').getValue()
list.add(uuid)
list.clear()
expect(list.getList()).toEqual([])
expect(list.has(uuid)).toBe(false)
})
})