@@ -8,47 +8,41 @@ export const BLOG_ID = new Types.ObjectId();
88export const BLOG_ID_2 = new Types . ObjectId ( ) ;
99export const BLOG_URL = 'abc' ;
1010
11- export const mockBlogFindUrlIfExists = jest . fn (
12- async ( blogUrl : string ) : Promise < Blog | null > => {
13- if ( blogUrl === BLOG_URL )
14- return {
15- _id : BLOG_ID ,
16- blogUrl : blogUrl ,
17- } as Blog ;
18- return null ;
19- } ,
20- ) ;
11+ export const mockBlogFindUrlIfExists = jest . fn ( async ( blogUrl : string ) : Promise < Blog | null > => {
12+ if ( blogUrl === BLOG_URL )
13+ return {
14+ _id : BLOG_ID ,
15+ blogUrl : blogUrl ,
16+ } as Blog ;
17+ return null ;
18+ } ) ;
2119
22- export const mockBlogCreate = jest . fn (
23- async ( blog : Blog ) : Promise < Blog > => {
24- blog . _id = BLOG_ID ;
25- return blog ;
26- } ,
27- ) ;
20+ export const mockBlogCreate = jest . fn ( async ( blog : Blog ) : Promise < Blog > => {
21+ blog . _id = BLOG_ID ;
22+ return blog ;
23+ } ) ;
2824
2925export const mockBlogUpdate = jest . fn ( async ( blog : Blog ) : Promise < Blog > => blog ) ;
3026
31- export const mockFindBlogAllDataById = jest . fn (
32- async ( id : Types . ObjectId ) : Promise < Blog | null > => {
33- if ( BLOG_ID . equals ( id ) )
34- return {
35- _id : BLOG_ID ,
36- author : { _id : USER_ID_WRITER } ,
37- isDraft : true ,
38- isSubmitted : false ,
39- isPublished : false ,
40- } as Blog ;
41- if ( BLOG_ID_2 . equals ( id ) )
42- return {
43- _id : BLOG_ID ,
44- author : { _id : new Types . ObjectId ( ) } ,
45- isDraft : true ,
46- isSubmitted : false ,
47- isPublished : false ,
48- } as Blog ;
49- return null ;
50- } ,
51- ) ;
27+ export const mockFindBlogAllDataById = jest . fn ( async ( id : Types . ObjectId ) : Promise < Blog | null > => {
28+ if ( BLOG_ID . equals ( id ) )
29+ return {
30+ _id : BLOG_ID ,
31+ author : { _id : USER_ID_WRITER } ,
32+ isDraft : true ,
33+ isSubmitted : false ,
34+ isPublished : false ,
35+ } as Blog ;
36+ if ( BLOG_ID_2 . equals ( id ) )
37+ return {
38+ _id : BLOG_ID ,
39+ author : { _id : new Types . ObjectId ( ) } ,
40+ isDraft : true ,
41+ isSubmitted : false ,
42+ isPublished : false ,
43+ } as Blog ;
44+ return null ;
45+ } ) ;
5246
5347jest . mock ( '../../../../../src/database/repository/BlogRepo' , ( ) => ( {
5448 get findUrlIfExists ( ) {
0 commit comments