1- import { getRepoIdFromUrl , toOldIssueFormat , toOldUserFormat } from 'utils'
1+ import { getRepoIdFromUrl , toOldIssueFormat , toOldUserFormat } from 'utils' ;
22
33describe ( 'Migration Helper' , ( ) => {
44 it ( 'should return a repo id in {username}/{reponame} format' , ( ) => {
55 const result = getRepoIdFromUrl ( 'https://api.github.com/repos/octocat/Hello-World' ) ;
6+
67 expect ( result ) . toBe ( 'octocat/Hello-World' ) ;
78 } ) ;
89
910 it ( 'should convert a user object to old format' , ( ) => {
1011 const user = { } ;
11-
1212 const result = toOldUserFormat ( user ) ;
1313 const resultKeys = Object . keys ( result ) ;
14+
1415 expect ( result . avatar_url ) . toBe ( user . avatarUrl ) ;
1516 expect ( Object . keys ( user ) . reduce ( ( accum , key ) => accum && resultKeys . includes ( key ) , true ) ) . toBe ( true ) ;
1617 } ) ;
@@ -27,9 +28,9 @@ describe('Migration Helper', () => {
2728 state : 'StAte' ,
2829 } ;
2930 const repoId = 'git-point' ;
30-
3131 const result = toOldIssueFormat ( issue , repoId ) ;
3232 const resultKeys = Object . keys ( result ) ;
33+
3334 expect ( Object . keys ( issue ) . reduce ( ( accum , key ) => accum && resultKeys . includes ( key ) , true ) ) . toBe ( true ) ;
3435 expect ( result . comments ) . toBe ( issue . comments . totalCount ) ;
3536 expect ( result . closed_at ) . toBe ( issue . closedAt ) ;
0 commit comments