fix(store): drop the replaced archive when the new one cannot be written
This commit is contained in:
1 parent
e5e2211476
commit
a37c50b9ee
4 files changed
+23
-5
No files matched your search
@@ -301,6 +301,16 @@ describe('the draft mirror', () => {
|
||||
expect(sessionStorage.getItem(DRAFT_KEY)).toBe('{"unread":true}')
|
||||
})
|
||||
|
||||
it('never leaves the replaced archive beside a new draft when the archive write is refused', () => {
|
||||
const first = minimalReport(sheet, { conclusion: 'first' })
|
||||
store().hydrateImport({ report: first, archive: archiveEnvelope(sheet, first) }, sheet)
|
||||
refuseWrites((key) => key === ARCHIVE_KEY)
|
||||
const second = minimalReport(sheet, { conclusion: 'second' })
|
||||
store().hydrateImport({ report: second, archive: archiveEnvelope(sheet, second) }, sheet)
|
||||
expect(sessionStorage.getItem(ARCHIVE_KEY)).toBeNull()
|
||||
expect(JSON.parse(sessionStorage.getItem(DRAFT_KEY)!).conclusion).toBe('second')
|
||||
})
|
||||
|
||||
it('a deletion request is ignored while a report is open', () => {
|
||||
store().initReport(newDraft(), sheet.sheet.ref, sheet)
|
||||
store().discardSessionText('draft')
|
||||
|
||||
Reference in new issue
Block a user