Chore: add coverage for missing lines in patch change

This commit is contained in:
shamoon 2025-04-22 23:33:11 -07:00
parent af95963c5f
commit 5a278381e3
No known key found for this signature in database

View File

@ -992,6 +992,44 @@ describe('DocumentDetailComponent', () => {
)
})
it('should correctly determine changed fields', () => {
initNormally()
expect(component['getChangedFields']()).toEqual({
id: doc.id,
})
component.documentForm.get('title').setValue('Foo Bar')
component.documentForm.get('permissions_form').setValue({
owner: 1,
set_permissions: {
view: {
users: [2],
groups: [],
},
change: {
users: [3],
groups: [],
},
},
})
component.documentForm.get('title').markAsDirty()
component.documentForm.get('permissions_form').markAsDirty()
expect(component['getChangedFields']()).toEqual({
id: doc.id,
title: 'Foo Bar',
owner: 1,
set_permissions: {
view: {
users: [2],
groups: [],
},
change: {
users: [3],
groups: [],
},
},
})
})
it('should show custom field errors', () => {
initNormally()
component.error = {