chore: vault tests refactors and lint (#2374)
This commit is contained in:
@@ -8,16 +8,21 @@ import {
|
||||
import { PayloadManager } from './PayloadManager'
|
||||
import { InternalEventBusInterface } from '@standardnotes/services'
|
||||
import { ContentType } from '@standardnotes/domain-core'
|
||||
import { LoggerInterface } from '@standardnotes/utils'
|
||||
|
||||
describe('payload manager', () => {
|
||||
let payloadManager: PayloadManager
|
||||
let internalEventBus: InternalEventBusInterface
|
||||
let logger: LoggerInterface
|
||||
|
||||
beforeEach(() => {
|
||||
internalEventBus = {} as jest.Mocked<InternalEventBusInterface>
|
||||
internalEventBus.publish = jest.fn()
|
||||
|
||||
payloadManager = new PayloadManager(internalEventBus)
|
||||
logger = {} as jest.Mocked<LoggerInterface>
|
||||
logger.debug = jest.fn()
|
||||
|
||||
payloadManager = new PayloadManager(logger, internalEventBus)
|
||||
})
|
||||
|
||||
it('emitting a payload should emit as-is and not merge on top of existing payload', async () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ContentType } from '@standardnotes/domain-core'
|
||||
import { PayloadsChangeObserver, QueueElement, PayloadsChangeObserverCallback, EmitQueue } from './Types'
|
||||
import { removeFromArray, Uuids } from '@standardnotes/utils'
|
||||
import { LoggerInterface, removeFromArray, Uuids } from '@standardnotes/utils'
|
||||
import {
|
||||
DeltaFileImport,
|
||||
isDeletedPayload,
|
||||
@@ -42,7 +42,10 @@ export class PayloadManager extends AbstractService implements PayloadManagerInt
|
||||
public collection: PayloadCollection<FullyFormedPayloadInterface>
|
||||
private emitQueue: EmitQueue<FullyFormedPayloadInterface> = []
|
||||
|
||||
constructor(protected override internalEventBus: InternalEventBusInterface) {
|
||||
constructor(
|
||||
private logger: LoggerInterface,
|
||||
protected override internalEventBus: InternalEventBusInterface,
|
||||
) {
|
||||
super(internalEventBus)
|
||||
this.collection = new PayloadCollection()
|
||||
}
|
||||
@@ -183,7 +186,7 @@ export class PayloadManager extends AbstractService implements PayloadManagerInt
|
||||
continue
|
||||
}
|
||||
|
||||
this.log(
|
||||
this.logger.debug(
|
||||
'applying payload',
|
||||
apply.uuid,
|
||||
'globalDirtyIndexAtLastSync',
|
||||
|
||||
Reference in New Issue
Block a user