Skip to content
Snippets Groups Projects
Commit 2f7f936c authored by Manjunath Kumar's avatar Manjunath Kumar
Browse files

fetch-document-by-id-review-changes-3

parent c624c268
No related branches found
No related tags found
1 merge request!3fetchdocumentById in dms
/**
@file <file name>
@description <description>
@author <Your Name>
@created <YYYY-MM-DD>
**/
import { Test, TestingModule } from '@nestjs/testing'; import { Test, TestingModule } from '@nestjs/testing';
import { DocumentController } from './document.controller'; import { DocumentController } from './document.controller';
import { DocumentService } from './document.service'; import { DocumentService } from './document.service';
...@@ -82,7 +88,7 @@ describe('DocumentController', () => { ...@@ -82,7 +88,7 @@ describe('DocumentController', () => {
it('should throw NotFoundException if document is not found', async () => { it('should throw NotFoundException if document is not found', async () => {
const dto = { id: 'not-found-id' }; const dto = { id: 'not-found-id' };
mockDocumentService.fetchDocument.mockResolvedValue(undefined); mockDocumentService.fetchDocument.mockResolvedValue(undefined);
await expect(controller.download(dto)).rejects.toThrow('Document not found'); await expect(controller.download(dto)).rejects.toThrow('404');
}); });
}); });
}); });
...@@ -178,7 +178,7 @@ describe('DocumentService', () => { ...@@ -178,7 +178,7 @@ describe('DocumentService', () => {
it('should throw NotFoundException if document is not found', async () => { it('should throw NotFoundException if document is not found', async () => {
jest.spyOn(service['prisma'].documents, 'findUnique').mockResolvedValue(null); jest.spyOn(service['prisma'].documents, 'findUnique').mockResolvedValue(null);
await expect(service.fetchDocument('not-found-id')).rejects.toThrow('Document not found'); await expect(service.fetchDocument('not-found-id')).rejects.toThrow('404');
}); });
}); });
}); });
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment