Skip to content

Commit

Permalink
Added tests for retrieve_one
Browse files Browse the repository at this point in the history
  • Loading branch information
jakeweatherhead committed Jul 25, 2023
1 parent 5c7bb48 commit ca53bbd
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions backend/src/asset_manager/asset_manager.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,44 @@ describe('AssetManagerService', () => {
).toBeCalledWith(retrieveAllDTO);
});

describe('retrieve_one', () => {
it('should retrieve an image asset', async () => {
const assetDTO = new AssetDTO();
assetDTO.AssetID = 'test';
assetDTO.Format = 'image';
assetDTO.UserID = 1;

jest.spyOn(
imageManagerService,
'retrieveOne',
).mockResolvedValue(assetDTO);

await service.retrieve_one(assetDTO);

expect(
imageManagerService.retrieveOne,
).toBeCalledWith(assetDTO);
});

it('should retrieve a text asset', async () => {
const assetDTO = new AssetDTO();
assetDTO.AssetID = 'test';
assetDTO.Format = 'text';
assetDTO.UserID = 1;

jest.spyOn(
textManagerService,
'retrieveOne',
).mockResolvedValue(assetDTO);

await service.retrieve_one(assetDTO);

expect(
textManagerService.retrieveOne,
).toBeCalledWith(assetDTO);
});
});

// it('should resize all image assets', async () => {
// const retrieveAllDTO = new RetrieveAllDTO();
// retrieveAllDTO.UserID = 1;
Expand Down

0 comments on commit ca53bbd

Please sign in to comment.