-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bf20e15
commit 9336d62
Showing
1 changed file
with
27 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,54 @@ | ||
import path from 'path'; | ||
import { createAllowBuildFunction } from './policy'; | ||
import path from 'path' | ||
import { createAllowBuildFunction } from './policy' | ||
|
||
it('should neverBuiltDependencies', () => { | ||
const allowBuild = createAllowBuildFunction({ | ||
neverBuiltDependencies: ['foo'], | ||
}); | ||
expect(typeof allowBuild).toBe('function'); | ||
}) | ||
expect(typeof allowBuild).toBe('function') | ||
if (allowBuild) { | ||
expect(allowBuild('foo')).toBeFalsy(); | ||
expect(allowBuild('bar')).toBeTruthy(); | ||
expect(allowBuild('foo')).toBeFalsy() | ||
expect(allowBuild('bar')).toBeTruthy() | ||
} | ||
}); | ||
}) | ||
|
||
it('should onlyBuiltDependencies', () => { | ||
const allowBuild = createAllowBuildFunction({ | ||
onlyBuiltDependencies: ['foo'], | ||
}); | ||
expect(typeof allowBuild).toBe('function'); | ||
}) | ||
expect(typeof allowBuild).toBe('function') | ||
if (allowBuild) { | ||
expect(allowBuild('foo')).toBeTruthy(); | ||
expect(allowBuild('bar')).toBeFalsy(); | ||
expect(allowBuild('foo')).toBeTruthy() | ||
expect(allowBuild('bar')).toBeFalsy() | ||
} | ||
}); | ||
}) | ||
|
||
it('should onlyBuiltDependencies set via a file', () => { | ||
const allowBuild = createAllowBuildFunction({ | ||
onlyBuiltDependenciesFile: path.join(__dirname, 'onlyBuild.json'), | ||
}); | ||
expect(typeof allowBuild).toBe('function'); | ||
}) | ||
expect(typeof allowBuild).toBe('function') | ||
if (allowBuild) { | ||
expect(allowBuild('zoo')).toBeTruthy(); | ||
expect(allowBuild('qar')).toBeTruthy(); | ||
expect(allowBuild('bar')).toBeFalsy(); | ||
expect(allowBuild('zoo')).toBeTruthy() | ||
expect(allowBuild('qar')).toBeTruthy() | ||
expect(allowBuild('bar')).toBeFalsy() | ||
} | ||
}); | ||
}) | ||
|
||
it('should onlyBuiltDependencies set via a file and config', () => { | ||
const allowBuild = createAllowBuildFunction({ | ||
onlyBuiltDependencies: ['bar'], | ||
onlyBuiltDependenciesFile: path.join(__dirname, 'onlyBuild.json'), | ||
}); | ||
expect(typeof allowBuild).toBe('function'); | ||
}) | ||
expect(typeof allowBuild).toBe('function') | ||
if (allowBuild) { | ||
expect(allowBuild('zoo')).toBeTruthy(); | ||
expect(allowBuild('qar')).toBeTruthy(); | ||
expect(allowBuild('bar')).toBeTruthy(); | ||
expect(allowBuild('esbuild')).toBeFalsy(); | ||
expect(allowBuild('zoo')).toBeTruthy() | ||
expect(allowBuild('qar')).toBeTruthy() | ||
expect(allowBuild('bar')).toBeTruthy() | ||
expect(allowBuild('esbuild')).toBeFalsy() | ||
} | ||
}); | ||
}) | ||
|
||
it('should return undefined if no policy is set', () => { | ||
expect(createAllowBuildFunction({})).toBeUndefined(); | ||
}); | ||
expect(createAllowBuildFunction({})).toBeUndefined() | ||
}) |