Skip to content

Commit 1ff3f66

Browse files
committed
test: ut for forceignore injection
1 parent 78ba78c commit 1ff3f66

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/resolve/forceIgnore.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,21 @@ describe('ForceIgnore', () => {
2121

2222
afterEach(() => env.restore());
2323

24+
describe('contents injections', () => {
25+
const newContents = 'force-app/main/default/classes/';
26+
it('Should accept an override for the contents of the forceignore file', () => {
27+
const forceIgnore = new ForceIgnore('', newContents);
28+
expect(forceIgnore.accepts(join('force-app', 'main', 'default', 'classes', 'foo'))).to.be.false;
29+
});
30+
it('injected contents prevent reading the forceignore file', () => {
31+
const readStub = env.stub(fs, 'readFileSync');
32+
const forceIgnore = new ForceIgnore(forceIgnorePath, newContents);
33+
expect(readStub.called).to.be.false;
34+
expect(forceIgnore.accepts(join(forceIgnorePath, 'force-app', 'main', 'default', 'classes', 'foo'))).to.be.false;
35+
expect(forceIgnore.accepts(testPath)).to.be.true;
36+
});
37+
});
38+
2439
it('Should default to not ignoring a file if forceignore is not loaded', () => {
2540
const path = join('some', 'path');
2641
const forceIgnore = new ForceIgnore();

0 commit comments

Comments
 (0)