Fix: get highest ASN regardless of user (#4326)

This commit is contained in:
shamoon 2023-10-06 17:22:31 -07:00 committed by GitHub
parent a2bdd64ad0
commit f7f5d0efa6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 75 additions and 45 deletions

View file

@ -30,39 +30,9 @@ describe('NumberComponent', () => {
input = component.inputField.nativeElement
})
// TODO: why doesnt this work?
// it('should support use of input field', () => {
// expect(component.value).toBeUndefined()
// input.stepUp()
// console.log(input.value);
// input.dispatchEvent(new Event('change'))
// fixture.detectChanges()
// expect(component.value).toEqual('3')
// })
it('should support +1 ASN', () => {
const listAllSpy = jest.spyOn(documentService, 'listFiltered')
listAllSpy
.mockReturnValueOnce(
of({
count: 1,
all: [1],
results: [
{
id: 1,
archive_serial_number: 1000,
},
],
})
)
.mockReturnValueOnce(
of({
count: 0,
all: [],
results: [],
})
)
const nextAsnSpy = jest.spyOn(documentService, 'getNextAsn')
nextAsnSpy.mockReturnValueOnce(of(1001)).mockReturnValueOnce(of(1))
expect(component.value).toBeUndefined()
component.nextAsn()
expect(component.value).toEqual(1001)