@@ -2,28 +2,28 @@ import { getFileOwnership } from './file';
22
33import { OwnershipEngine } from './lib/OwnershipEngine' ;
44
5- import { readDirRecursively } from './lib/readDirRecursively ' ;
6- import { readTrackedGitFiles } from './lib/readTrackedGitFiles ' ;
7- import { countLinesInFile } from './lib/countLinesInFile ' ;
5+ import { readDir } from '../file/readDir ' ;
6+ import { readGit } from '../file/readGit ' ;
7+ import { countLines } from '../file/countLines ' ;
88import { OwnedFile } from './lib/OwnedFile' ;
99
1010jest . mock ( './lib/OwnershipEngine' ) ;
11- jest . mock ( './lib/readDirRecursively ' ) ;
12- jest . mock ( './lib/readTrackedGitFiles ' ) ;
13- jest . mock ( './lib/countLinesInFile ' ) ;
11+ jest . mock ( '../file/readDir ' ) ;
12+ jest . mock ( '../file/readGit ' ) ;
13+ jest . mock ( '../file/countLines ' ) ;
1414
1515describe ( 'file' , ( ) => {
1616 const mocks = {
17- readDirRecursively : readDirRecursively as jest . Mock ,
18- readTrackedGitFiles : readTrackedGitFiles as jest . Mock ,
19- countLinesInFile : countLinesInFile as jest . Mock ,
17+ readDir : readDir as jest . Mock ,
18+ readGit : readGit as jest . Mock ,
19+ countLines : countLines as jest . Mock ,
2020 } ;
2121
2222 beforeEach ( ( ) => {
2323 jest . resetAllMocks ( ) ;
24- mocks . readDirRecursively . mockResolvedValue ( [ ] ) ;
25- mocks . readTrackedGitFiles . mockResolvedValue ( [ ] ) ;
26- mocks . countLinesInFile . mockResolvedValue ( 0 ) ;
24+ mocks . readDir . mockResolvedValue ( [ ] ) ;
25+ mocks . readGit . mockResolvedValue ( [ ] ) ;
26+ mocks . countLines . mockResolvedValue ( 0 ) ;
2727 } ) ;
2828
2929 describe ( 'getFileOwnership' , ( ) => {
@@ -46,18 +46,18 @@ describe('file', () => {
4646 await getFileOwnership ( { codeowners : expected , dir : expected , onlyGit : false } ) ;
4747
4848 // Assert
49- expect ( mocks . readDirRecursively ) . toHaveBeenCalledWith ( expected , [ '.git' ] ) ;
49+ expect ( mocks . readDir ) . toHaveBeenCalledWith ( expected , [ '.git' ] ) ;
5050 } ) ;
5151
52- it ( 'should read files from git tracked files when onlyGit is specified' , async ( ) => {
52+ it ( 'should read files from git tracked filegs when onlyGit is specified' , async ( ) => {
5353 // Arrange
5454 const expected = 'some/dir' ;
5555
5656 // Act
5757 await getFileOwnership ( { codeowners : expected , dir : expected , onlyGit : true } ) ;
5858
5959 // Assert
60- expect ( mocks . readTrackedGitFiles ) . toHaveBeenCalledWith ( expected ) ;
60+ expect ( mocks . readGit ) . toHaveBeenCalledWith ( expected ) ;
6161 } ) ;
6262
6363 it ( 'should return owned files' , async ( ) => {
@@ -79,7 +79,7 @@ describe('file', () => {
7979 } ;
8080 } ) ;
8181
82- mocks . readDirRecursively . mockResolvedValue ( expected . map ( f => f . path ) . reverse ( ) ) ;
82+ mocks . readDir . mockResolvedValue ( expected . map ( f => f . path ) . reverse ( ) ) ;
8383
8484 // Act
8585 const result = await getFileOwnership ( { codeowners : 'some/file' , dir : '/' , onlyGit : false } ) ;
0 commit comments