From d8408adfe05c2fbe57637d4f7fe4ad82b99150d4 Mon Sep 17 00:00:00 2001 From: joan vicens Date: Thu, 21 Mar 2024 16:39:25 +0100 Subject: [PATCH] wip: overrider --- .../application/override/FileOverrider.ts | 36 +++++++++ .../virtual-drive/files/domain/File.ts | 21 ++++- .../files/domain/errors/FileNotFoundError.ts | 2 +- .../events/FileOverriddenDomainEvent.ts | 46 +++++++++++ .../domain/file-systems/RemoteFileSystem.ts | 2 + .../infrastructure/SDKRemoteFileSystem.ts | 7 ++ .../contents/domain/ContentsIdMother.ts | 2 +- .../EnvironmentContentFileUploader.test.ts | 12 +-- .../files/__mocks__/RemoteFileSystemMock.ts | 5 ++ .../__test-class__/FileCreatorTestClass.ts | 27 +++++++ .../FileToOverrideProviderTestClass.ts | 17 ++++ .../files/application/FileDeleter.test.ts | 2 +- .../CreateFileOnOfflineFileUploaded.test.ts | 40 ++++++++++ .../override/FileOverrider.test.ts | 80 +++++++++++++++++++ .../files/domain/FileSizeMother.ts | 4 + ...fflineContentsUploadedDomainEventMother.ts | 15 ++++ .../files/infrastructure/ServerFileMother.ts | 2 +- .../tree/application/Traverser.test.ts | 12 +-- 18 files changed, 315 insertions(+), 17 deletions(-) create mode 100644 src/context/virtual-drive/files/application/override/FileOverrider.ts create mode 100644 src/context/virtual-drive/files/domain/events/FileOverriddenDomainEvent.ts create mode 100644 tests/context/virtual-drive/files/__test-class__/FileCreatorTestClass.ts create mode 100644 tests/context/virtual-drive/files/__test-class__/FileToOverrideProviderTestClass.ts create mode 100644 tests/context/virtual-drive/files/application/event-subscribers/CreateFileOnOfflineFileUploaded.test.ts create mode 100644 tests/context/virtual-drive/files/application/override/FileOverrider.test.ts create mode 100644 tests/context/virtual-drive/files/domain/events/OfflineContentsUploadedDomainEventMother.ts diff --git a/src/context/virtual-drive/files/application/override/FileOverrider.ts b/src/context/virtual-drive/files/application/override/FileOverrider.ts new file mode 100644 index 000000000..b597538c2 --- /dev/null +++ b/src/context/virtual-drive/files/application/override/FileOverrider.ts @@ -0,0 +1,36 @@ +import { ContentsId } from '../../../contents/domain/ContentsId'; +import { EventBus } from '../../../shared/domain/EventBus'; +import { File } from '../../domain/File'; +import { FileRepository } from '../../domain/FileRepository'; +import { FileSize } from '../../domain/FileSize'; +import { FileNotFoundError } from '../../domain/errors/FileNotFoundError'; +import { RemoteFileSystem } from '../../domain/file-systems/RemoteFileSystem'; + +export class FileOverrider { + constructor( + private readonly repository: FileRepository, + private readonly rfs: RemoteFileSystem, + private readonly eventBus: EventBus + ) {} + + async run( + fileId: File['id'], + contentsId: File['contentsId'], + size: File['size'] + ): Promise { + const file = await this.repository.searchById(fileId); + + if (!file) { + throw new FileNotFoundError(fileId); + } + + const newContentsId = new ContentsId(contentsId); + const newSize = new FileSize(size); + + file.changeContents(newContentsId, newSize); + + this.rfs.override(file); + + this.eventBus.publish(file.pullDomainEvents()); + } +} diff --git a/src/context/virtual-drive/files/domain/File.ts b/src/context/virtual-drive/files/domain/File.ts index b6a142f61..a4875ce55 100644 --- a/src/context/virtual-drive/files/domain/File.ts +++ b/src/context/virtual-drive/files/domain/File.ts @@ -13,6 +13,7 @@ import { ContentsId } from '../../contents/domain/ContentsId'; import { FileMovedDomainEvent } from './events/FileMovedDomainEvent'; import { FileRenamedDomainEvent } from './events/FileRenamedDomainEvent'; import { FilePlaceholderId, createFilePlaceholderId } from './PlaceholderId'; +import { FileOverriddenDomainEvent } from './events/FileOverriddenDomainEvent'; export type FileAttributes = { id: number; @@ -32,7 +33,7 @@ export class File extends AggregateRoot { private _contentsId: ContentsId, private _folderId: number, private _path: FilePath, - private readonly _size: FileSize, + private _size: FileSize, public createdAt: Date, public updatedAt: Date, private _status: FileStatus @@ -174,6 +175,24 @@ export class File extends AggregateRoot { ); } + changeContents(contentsId: ContentsId, contentsSize: FileSize) { + const previousContentsId = this.contentsId; + const previousSize = this.size; + + this._contentsId = contentsId; + this._size = contentsSize; + + this.record( + new FileOverriddenDomainEvent({ + aggregateId: this.contentsId, + previousContentsId, + previousSize, + currentContentsId: contentsId.value, + currentSize: contentsSize.value, + }) + ); + } + hasParent(id: number): boolean { return this.folderId === id; } diff --git a/src/context/virtual-drive/files/domain/errors/FileNotFoundError.ts b/src/context/virtual-drive/files/domain/errors/FileNotFoundError.ts index 2eb92dd83..228bb7c4d 100644 --- a/src/context/virtual-drive/files/domain/errors/FileNotFoundError.ts +++ b/src/context/virtual-drive/files/domain/errors/FileNotFoundError.ts @@ -1,5 +1,5 @@ export class FileNotFoundError extends Error { - constructor(id: string) { + constructor(id: string | number) { super(`File ${id} not found`); } } diff --git a/src/context/virtual-drive/files/domain/events/FileOverriddenDomainEvent.ts b/src/context/virtual-drive/files/domain/events/FileOverriddenDomainEvent.ts new file mode 100644 index 000000000..410067e81 --- /dev/null +++ b/src/context/virtual-drive/files/domain/events/FileOverriddenDomainEvent.ts @@ -0,0 +1,46 @@ +import { DomainEvent } from '../../../../shared/domain/DomainEvent'; + +export class FileOverriddenDomainEvent extends DomainEvent { + static readonly EVENT_NAME = 'file.overridden'; + + readonly previousContentsId: string; + readonly previousSize: number; + + readonly currentContentsId: string; + readonly currentSize: number; + + constructor({ + aggregateId, + previousContentsId, + previousSize, + currentContentsId, + currentSize, + }: { + aggregateId: string; + previousContentsId: string; + previousSize: number; + currentContentsId: string; + currentSize: number; + }) { + super({ + eventName: FileOverriddenDomainEvent.EVENT_NAME, + aggregateId, + }); + + this.previousContentsId = previousContentsId; + this.previousSize = previousSize; + + this.currentContentsId = currentContentsId; + this.currentSize = currentSize; + } + + toPrimitives() { + return { + aggregateId: this.aggregateId, + previousContentsId: this.previousContentsId, + previousSize: this.previousSize, + currentContentsId: this.currentContentsId, + currentSize: this.currentSize, + }; + } +} diff --git a/src/context/virtual-drive/files/domain/file-systems/RemoteFileSystem.ts b/src/context/virtual-drive/files/domain/file-systems/RemoteFileSystem.ts index 9573f252c..26f67d98e 100644 --- a/src/context/virtual-drive/files/domain/file-systems/RemoteFileSystem.ts +++ b/src/context/virtual-drive/files/domain/file-systems/RemoteFileSystem.ts @@ -9,4 +9,6 @@ export interface RemoteFileSystem { move(file: File): Promise; rename(file: File): Promise; + + override(file: File): Promise; } diff --git a/src/context/virtual-drive/files/infrastructure/SDKRemoteFileSystem.ts b/src/context/virtual-drive/files/infrastructure/SDKRemoteFileSystem.ts index f6ff744b4..03cd5c0c1 100644 --- a/src/context/virtual-drive/files/infrastructure/SDKRemoteFileSystem.ts +++ b/src/context/virtual-drive/files/infrastructure/SDKRemoteFileSystem.ts @@ -93,4 +93,11 @@ export class SDKRemoteFileSystem implements RemoteFileSystem { bucketId: this.bucket, }); } + + async override(file: File): Promise { + await this.sdk.replaceFile('b81849d9-e45e-5e00-9e4e-b9cc3b1c1687', { + fileId: file.contentsId, + size: file.size, + }); + } } diff --git a/tests/context/virtual-drive/contents/domain/ContentsIdMother.ts b/tests/context/virtual-drive/contents/domain/ContentsIdMother.ts index ab72d7330..a6ff9b596 100644 --- a/tests/context/virtual-drive/contents/domain/ContentsIdMother.ts +++ b/tests/context/virtual-drive/contents/domain/ContentsIdMother.ts @@ -9,7 +9,7 @@ export class ContentsIdMother { return new ContentsId(raw); } - static raw(): string { + static primitive(): string { return chance.string({ length: ContentsId.VALID_LENGTH }); } } diff --git a/tests/context/virtual-drive/contents/infrastructure/upload/EnvironmentContentFileUploader.test.ts b/tests/context/virtual-drive/contents/infrastructure/upload/EnvironmentContentFileUploader.test.ts index 33631bb34..e02d4e865 100644 --- a/tests/context/virtual-drive/contents/infrastructure/upload/EnvironmentContentFileUploader.test.ts +++ b/tests/context/virtual-drive/contents/infrastructure/upload/EnvironmentContentFileUploader.test.ts @@ -10,7 +10,7 @@ describe('Environment Content File Uploader', () => { describe('event emitter', () => { it('emits an event on start', async () => { const strategy = createUploadStrategy((opts) => { - opts.finishedCallback(null, ContentsIdMother.raw()); + opts.finishedCallback(null, ContentsIdMother.primitive()); }); const uploader = new EnvironmentContentFileUploader(strategy, bucket); @@ -25,7 +25,7 @@ describe('Environment Content File Uploader', () => { }); it('emits an event with an id when a file is uploaded', async () => { - const uploadedFileId = ContentsIdMother.raw(); + const uploadedFileId = ContentsIdMother.primitive(); const strategy = createUploadStrategy((opts) => { opts.finishedCallback(null, uploadedFileId); }); @@ -44,7 +44,7 @@ describe('Environment Content File Uploader', () => { opts.progressCallback(25, 1, 4); opts.progressCallback(50, 2, 4); opts.progressCallback(75, 3, 4); - opts.finishedCallback(null, ContentsIdMother.raw()); + opts.finishedCallback(null, ContentsIdMother.primitive()); }); const uploader = new EnvironmentContentFileUploader(strategy, bucket); @@ -61,7 +61,7 @@ describe('Environment Content File Uploader', () => { it('emits an event when there is a progress update and finish on the end', async () => { const strategy = createUploadStrategy((opts) => { opts.progressCallback(50, 2, 4); - opts.finishedCallback(null, ContentsIdMother.raw()); + opts.finishedCallback(null, ContentsIdMother.primitive()); }); const uploader = new EnvironmentContentFileUploader(strategy, bucket); @@ -102,7 +102,7 @@ describe('Environment Content File Uploader', () => { const strategy = createUploadStrategy((opts) => { setTimeout(() => opts.progressCallback(50, 1, 4), 20); setTimeout( - () => opts.finishedCallback(null, ContentsIdMother.raw()), + () => opts.finishedCallback(null, ContentsIdMother.primitive()), 100 ); }); @@ -122,7 +122,7 @@ describe('Environment Content File Uploader', () => { const delay = 1000; const strategy = createUploadStrategy((opts) => { setTimeout( - () => opts.finishedCallback(null, ContentsIdMother.raw()), + () => opts.finishedCallback(null, ContentsIdMother.primitive()), delay ); }); diff --git a/tests/context/virtual-drive/files/__mocks__/RemoteFileSystemMock.ts b/tests/context/virtual-drive/files/__mocks__/RemoteFileSystemMock.ts index 76473803f..a072a2146 100644 --- a/tests/context/virtual-drive/files/__mocks__/RemoteFileSystemMock.ts +++ b/tests/context/virtual-drive/files/__mocks__/RemoteFileSystemMock.ts @@ -10,6 +10,7 @@ export class RemoteFileSystemMock implements RemoteFileSystem { public readonly trashMock = jest.fn(); public readonly moveMock = jest.fn(); public readonly renameMock = jest.fn(); + public readonly overrideMock = jest.fn(); persist(offline: OfflineFile): Promise { return this.persistMock(offline); @@ -26,4 +27,8 @@ export class RemoteFileSystemMock implements RemoteFileSystem { rename(file: File): Promise { return this.renameMock(file); } + + override(file: File): Promise { + return this.overrideMock(file); + } } diff --git a/tests/context/virtual-drive/files/__test-class__/FileCreatorTestClass.ts b/tests/context/virtual-drive/files/__test-class__/FileCreatorTestClass.ts new file mode 100644 index 000000000..577ef5198 --- /dev/null +++ b/tests/context/virtual-drive/files/__test-class__/FileCreatorTestClass.ts @@ -0,0 +1,27 @@ +import { FileCreator } from '../../../../../src/context/virtual-drive/files/application/FileCreator'; +import { FileDeleter } from '../../../../../src/context/virtual-drive/files/application/FileDeleter'; +import { File } from '../../../../../src/context/virtual-drive/files/domain/File'; +import { FileRepository } from '../../../../../src/context/virtual-drive/files/domain/FileRepository'; +import { SyncFileMessenger } from '../../../../../src/context/virtual-drive/files/domain/SyncFileMessenger'; +import { RemoteFileSystem } from '../../../../../src/context/virtual-drive/files/domain/file-systems/RemoteFileSystem'; +import { ParentFolderFinder } from '../../../../../src/context/virtual-drive/folders/application/ParentFolderFinder'; +import { EventBus } from '../../../../../src/context/virtual-drive/shared/domain/EventBus'; + +export class FileCreatorTestClass extends FileCreator { + public readonly mock = jest.fn(); + + constructor() { + super( + {} as RemoteFileSystem, + {} as FileRepository, + {} as ParentFolderFinder, + {} as FileDeleter, + {} as EventBus, + {} as SyncFileMessenger + ); + } + + run(path: string, contentsId: string, size: number): Promise { + return this.mock(path, contentsId, size); + } +} diff --git a/tests/context/virtual-drive/files/__test-class__/FileToOverrideProviderTestClass.ts b/tests/context/virtual-drive/files/__test-class__/FileToOverrideProviderTestClass.ts new file mode 100644 index 000000000..6d7136e9f --- /dev/null +++ b/tests/context/virtual-drive/files/__test-class__/FileToOverrideProviderTestClass.ts @@ -0,0 +1,17 @@ +import { FileToOverrideProvider } from '../../../../../src/context/virtual-drive/files/application/FileToOverrideProvider'; +import { File } from '../../../../../src/context/virtual-drive/files/domain/File'; +import { FileRepository } from '../../../../../src/context/virtual-drive/files/domain/FileRepository'; +import { EventRepository } from '../../../../../src/context/virtual-drive/shared/domain/EventRepository'; +import { Optional } from '../../../../../src/shared/types/Optional'; + +export class FileToOverrideProviderTestClass extends FileToOverrideProvider { + readonly mock = jest.fn(); + + constructor() { + super({} as EventRepository, {} as FileRepository); + } + + run(): Promise> { + return this.mock(); + } +} diff --git a/tests/context/virtual-drive/files/application/FileDeleter.test.ts b/tests/context/virtual-drive/files/application/FileDeleter.test.ts index aa4be0a1c..ef33ce959 100644 --- a/tests/context/virtual-drive/files/application/FileDeleter.test.ts +++ b/tests/context/virtual-drive/files/application/FileDeleter.test.ts @@ -38,7 +38,7 @@ describe('File Deleter', () => { }); it('does not nothing if the file its not found', async () => { - const contentsId = ContentsIdMother.raw(); + const contentsId = ContentsIdMother.primitive(); repository.searchByContentsIdMock.mockReturnValueOnce(undefined); jest diff --git a/tests/context/virtual-drive/files/application/event-subscribers/CreateFileOnOfflineFileUploaded.test.ts b/tests/context/virtual-drive/files/application/event-subscribers/CreateFileOnOfflineFileUploaded.test.ts new file mode 100644 index 000000000..22dbd47c9 --- /dev/null +++ b/tests/context/virtual-drive/files/application/event-subscribers/CreateFileOnOfflineFileUploaded.test.ts @@ -0,0 +1,40 @@ +import { CreateFileOnOfflineFileUploaded } from '../../../../../../src/context/virtual-drive/files/application/event-subsribers/CreateFileOnOfflineFileUplodaded'; +import { Optional } from '../../../../../../src/shared/types/Optional'; +import { FileCreatorTestClass } from '../../__test-class__/FileCreatorTestClass'; +import { FileToOverrideProviderTestClass } from '../../__test-class__/FileToOverrideProviderTestClass'; +import { FileMother } from '../../domain/FileMother'; +import { OfflineContentsUploadedDomainEventMother } from '../../domain/events/OfflineContentsUploadedDomainEventMother'; + +describe('Create File On Offline File Uploaded', () => { + it('creates a new file when no file to be overridden is found', async () => { + const creator = new FileCreatorTestClass(); + const toOverride = new FileToOverrideProviderTestClass(); + const uploadedEvent = OfflineContentsUploadedDomainEventMother.any(); + + const sut = new CreateFileOnOfflineFileUploaded(creator, toOverride); + + toOverride.mock.mockReturnValueOnce(Optional.empty()); + + await sut.on(uploadedEvent); + + expect(creator.mock).toBeCalledWith( + uploadedEvent.path, + uploadedEvent.aggregateId, + uploadedEvent.size + ); + }); + + it('does not create a new file an overridden file is provided', async () => { + const creator = new FileCreatorTestClass(); + const toOverride = new FileToOverrideProviderTestClass(); + const uploadedEvent = OfflineContentsUploadedDomainEventMother.any(); + + const sut = new CreateFileOnOfflineFileUploaded(creator, toOverride); + + toOverride.mock.mockReturnValueOnce(Optional.of(FileMother.any())); + + await sut.on(uploadedEvent); + + expect(creator.mock).not.toBeCalled(); + }); +}); diff --git a/tests/context/virtual-drive/files/application/override/FileOverrider.test.ts b/tests/context/virtual-drive/files/application/override/FileOverrider.test.ts new file mode 100644 index 000000000..205473f32 --- /dev/null +++ b/tests/context/virtual-drive/files/application/override/FileOverrider.test.ts @@ -0,0 +1,80 @@ +import { FileOverrider } from '../../../../../../src/context/virtual-drive/files/application/override/FileOverrider'; +import { FileNotFoundError } from '../../../../../../src/context/virtual-drive/files/domain/errors/FileNotFoundError'; +import { FileOverriddenDomainEvent } from '../../../../../../src/context/virtual-drive/files/domain/events/FileOverriddenDomainEvent'; +import { ContentsIdMother } from '../../../contents/domain/ContentsIdMother'; +import { EventBusMock } from '../../../shared/__mock__/EventBusMock'; +import { FileRepositoryMock } from '../../__mocks__/FileRepositoryMock'; +import { RemoteFileSystemMock } from '../../__mocks__/RemoteFileSystemMock'; +import { FileMother } from '../../domain/FileMother'; +import { FileSizeMother } from '../../domain/FileSizeMother'; + +describe('File Overrider', () => { + it('throws an error if no file is founded with the given fileId', async () => { + const rfs = new RemoteFileSystemMock(); + const repository = new FileRepositoryMock(); + const eventBus = new EventBusMock(); + + const overrider = new FileOverrider(repository, rfs, eventBus); + + const file = FileMother.any(); + const updatedContentsId = ContentsIdMother.random(); + const updatedSize = FileSizeMother.random(); + + repository.searchByIdMock.mockResolvedValueOnce(undefined); + + try { + await overrider.run(file.id, updatedContentsId.value, updatedSize.value); + fail('it should have thrown an error'); + } catch (err: unknown) { + expect(err).toBeInstanceOf(FileNotFoundError); + } + }); + + it('calls the override method with the updated contentsId and size updated', async () => { + const rfs = new RemoteFileSystemMock(); + const repository = new FileRepositoryMock(); + const eventBus = new EventBusMock(); + + const overrider = new FileOverrider(repository, rfs, eventBus); + + const file = FileMother.any(); + const updatedContentsId = ContentsIdMother.random(); + const updatedSize = FileSizeMother.random(); + + repository.searchByIdMock.mockResolvedValueOnce(file); + + await overrider.run(file.id, updatedContentsId.value, updatedSize.value); + + expect(rfs.overrideMock).toBeCalledWith( + expect.objectContaining({ + _id: file.id, + _contentsId: updatedContentsId, + _size: updatedSize, + }) + ); + }); + + it('emits the FileOverridden domain event when successfully overridden ', async () => { + const rfs = new RemoteFileSystemMock(); + const repository = new FileRepositoryMock(); + const eventBus = new EventBusMock(); + + const overrider = new FileOverrider(repository, rfs, eventBus); + + const file = FileMother.any(); + const updatedContentsId = ContentsIdMother.primitive(); + + repository.searchByIdMock.mockResolvedValueOnce(file); + + await overrider.run(file.id, updatedContentsId, FileSizeMother.primitive()); + + expect(eventBus.publishMock).toBeCalledWith( + expect.arrayContaining([ + expect.objectContaining({ + eventName: FileOverriddenDomainEvent.EVENT_NAME, + aggregateId: updatedContentsId, + }), + ]) + ); + }); +}); diff --git a/tests/context/virtual-drive/files/domain/FileSizeMother.ts b/tests/context/virtual-drive/files/domain/FileSizeMother.ts index 61fcfd6d6..ede743f62 100644 --- a/tests/context/virtual-drive/files/domain/FileSizeMother.ts +++ b/tests/context/virtual-drive/files/domain/FileSizeMother.ts @@ -6,4 +6,8 @@ export class FileSizeMother { static random() { return new FileSize(chance.integer({ min: 0, max: FileSize.MAX_SIZE })); } + + static primitive(): number { + return FileSizeMother.random().value; + } } diff --git a/tests/context/virtual-drive/files/domain/events/OfflineContentsUploadedDomainEventMother.ts b/tests/context/virtual-drive/files/domain/events/OfflineContentsUploadedDomainEventMother.ts new file mode 100644 index 000000000..cd11279d5 --- /dev/null +++ b/tests/context/virtual-drive/files/domain/events/OfflineContentsUploadedDomainEventMother.ts @@ -0,0 +1,15 @@ +import { OfflineContentsUploadedDomainEvent } from '../../../../../../src/context/offline-drive/contents/domain/events/OfflineContentsUploadedDomainEvent'; +import { UuidMother } from '../../../../shared/domain/UuidMother'; +import { FileSizeMother } from '../FileSizeMother'; +import { FilePathMother } from '../FilePathMother'; + +export class OfflineContentsUploadedDomainEventMother { + static any(): OfflineContentsUploadedDomainEvent { + return new OfflineContentsUploadedDomainEvent({ + aggregateId: UuidMother.random().value, + size: FileSizeMother.random().value, + path: FilePathMother.random().value, + offlineContentsPath: FilePathMother.random().value, + }); + } +} diff --git a/tests/context/virtual-drive/files/infrastructure/ServerFileMother.ts b/tests/context/virtual-drive/files/infrastructure/ServerFileMother.ts index 7f3a89caa..a7ce06590 100644 --- a/tests/context/virtual-drive/files/infrastructure/ServerFileMother.ts +++ b/tests/context/virtual-drive/files/infrastructure/ServerFileMother.ts @@ -10,7 +10,7 @@ export class ServerFileMother { bucket: '55c229cf-d40b-5f66-b8d6-10fbe9dafc1f', createdAt: new Date().toISOString(), encrypt_version: 'aes-3', - fileId: ContentsIdMother.raw(), + fileId: ContentsIdMother.primitive(), folderId: 4017, id: 2785074, modificationTime: new Date().toISOString(), diff --git a/tests/context/virtual-drive/tree/application/Traverser.test.ts b/tests/context/virtual-drive/tree/application/Traverser.test.ts index 968cc8754..9423d7bf1 100644 --- a/tests/context/virtual-drive/tree/application/Traverser.test.ts +++ b/tests/context/virtual-drive/tree/application/Traverser.test.ts @@ -19,7 +19,7 @@ describe('Traverser', () => { files: [ { name: 'file A', - fileId: ContentsIdMother.raw(), + fileId: ContentsIdMother.primitive(), folderId: baseFolderId, size: 67, status: 'EXISTS', @@ -46,7 +46,7 @@ describe('Traverser', () => { files: [ { name: 'file A', - fileId: ContentsIdMother.raw(), + fileId: ContentsIdMother.primitive(), folderId: 22491, size: 200, status: 'EXISTS', @@ -180,14 +180,14 @@ describe('Traverser', () => { } as ServerFile, { name: 'valid_name', - fileId: ContentsIdMother.raw(), + fileId: ContentsIdMother.primitive(), folderId: baseFolderId, size: 67, status: 'EXISTS', } as ServerFile, { name: 'valid_name_2', - fileId: ContentsIdMother.raw(), + fileId: ContentsIdMother.primitive(), folderId: baseFolderId, size: 67, status: 'INVALID_STATUS', @@ -241,7 +241,7 @@ describe('Traverser', () => { files: [ { name: 'file A', - fileId: ContentsIdMother.raw(), + fileId: ContentsIdMother.primitive(), folderId: baseFolderId, size: 67, status: 'TRASHED', @@ -276,7 +276,7 @@ describe('Traverser', () => { files: [ { name: 'file A', - fileId: ContentsIdMother.raw(), + fileId: ContentsIdMother.primitive(), folderId: baseFolderId, size: 67, status: 'TRASHED',