Chore: miscellaneous frontend testing

This commit is contained in:
shamoon
2024-02-23 23:36:03 -08:00
parent 4c6c976f63
commit 966eb00de0
11 changed files with 126 additions and 12 deletions

View File

@@ -118,4 +118,18 @@ describe('SelectComponent', () => {
tick(3000)
expect(clearSpy).toHaveBeenCalled()
}))
it('should emit filtered documents', () => {
component.value = 10
component.items = items
const emitSpy = jest.spyOn(component.filterDocuments, 'emit')
component.onFilterDocuments()
expect(emitSpy).toHaveBeenCalledWith([items[2]])
})
it('should return the correct filter button title', () => {
component.title = 'Tag'
const expectedTitle = `Filter documents with this ${component.title}`
expect(component.filterButtonTitle).toEqual(expectedTitle)
})
})

View File

@@ -169,4 +169,12 @@ describe('TagsComponent', () => {
expect(component.getTag(2)).toEqual(tags[1])
expect(component.getTag(4)).toBeUndefined()
})
it('should emit filtered documents', () => {
component.value = [10]
component.tags = tags
const emitSpy = jest.spyOn(component.filterDocuments, 'emit')
component.onFilterDocuments()
expect(emitSpy).toHaveBeenCalledWith([tags[2]])
})
})