File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { StaticService } from '../shared/static/static.service';
66import { IgnoreAreaDto } from 'src/test/dto/ignore-area.dto' ;
77
88const initModule = async ( {
9+ findOneMock = jest . fn ,
910 findManyMock = jest . fn ( ) . mockReturnValue ( [ ] ) ,
1011 createMock = jest . fn ( ) ,
1112 updateMock = jest . fn ( )
@@ -17,6 +18,7 @@ const initModule = async ({
1718 {
1819 provide : PrismaService , useValue : {
1920 testVariation : {
21+ findOne : findOneMock ,
2022 findMany : findManyMock ,
2123 create : createMock ,
2224 update : updateMock ,
@@ -50,6 +52,30 @@ const dataAllFields: CreateTestRequestDto = {
5052describe ( 'TestVariationsService' , ( ) => {
5153 let service : TestVariationsService ;
5254
55+ describe ( 'getDetails' , ( ) => {
56+ it ( 'can find one' , async ( ) => {
57+ const id = 'test id'
58+ const findOneMock = jest . fn ( )
59+ service = await initModule ( { findOneMock } )
60+
61+ await service . getDetails ( id )
62+
63+ expect ( findOneMock ) . toHaveBeenCalledWith ( {
64+ where : { id } ,
65+ include : {
66+ baselines : {
67+ include : {
68+ testRun : true ,
69+ } ,
70+ orderBy : {
71+ createdAt : 'desc'
72+ }
73+ } ,
74+ }
75+ } )
76+ } )
77+ } )
78+
5379 describe ( 'findOrCreate' , ( ) => {
5480
5581 it ( 'can find by required fields' , async ( ) => {
You can’t perform that action at this time.
0 commit comments