Fix discard goes to wrong version content

This commit is contained in:
shamoon
2026-02-12 11:15:31 -08:00
parent c7c9845806
commit 472021b803
2 changed files with 13 additions and 1 deletions

View File

@@ -688,6 +688,18 @@ describe('DocumentDetailComponent', () => {
expect(navigateSpy).toHaveBeenCalledWith(['404'], { replaceUrl: true })
})
it('discard should request the currently selected version', () => {
initNormally()
const getSpy = jest.spyOn(documentService, 'get')
getSpy.mockClear()
getSpy.mockReturnValueOnce(of(doc))
component.selectedVersionId = 10
component.discard()
expect(getSpy).toHaveBeenCalledWith(component.documentId, 10)
})
it('should 404 on invalid id', () => {
const navigateSpy = jest.spyOn(router, 'navigate')
jest