mirror of
https://github.com/sasjs/lint.git
synced 2026-01-06 20:20:06 +00:00
feat(lint): implement v1 with 3 rules - trailing spaces, encoded passwords and Doxygen header
This commit is contained in:
22
src/utils/getProjectRoot.spec.ts
Normal file
22
src/utils/getProjectRoot.spec.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { getProjectRoot } from './getProjectRoot'
|
||||
import path from 'path'
|
||||
|
||||
describe('getProjectRoot', () => {
|
||||
it('should return the current location if it contains the lint config file', async () => {
|
||||
const projectRoot = await getProjectRoot()
|
||||
|
||||
expect(projectRoot).toEqual(process.cwd())
|
||||
})
|
||||
|
||||
it('should return the parent folder if it contains the lint config file', async () => {
|
||||
const currentLocation = process.cwd()
|
||||
jest
|
||||
.spyOn(process, 'cwd')
|
||||
.mockImplementationOnce(() =>
|
||||
path.join(currentLocation, 'folder', 'subfolder')
|
||||
)
|
||||
const projectRoot = await getProjectRoot()
|
||||
|
||||
expect(projectRoot).toEqual(currentLocation)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user