Skip to content

Commit

Permalink
Restoring engine as any structure in test
Browse files Browse the repository at this point in the history
  • Loading branch information
rmohan20 committed Aug 16, 2021
1 parent d09b8dd commit a63b95c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/lib/cpd/CpdEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ export class CpdEngine extends AbstractRuleEngine {
return results;
}

//protected visibility to be available in unit tests
protected sortPaths(targets: RuleTarget[]): Map<LANGUAGE, string[]> {

private sortPaths(targets: RuleTarget[]): Map<LANGUAGE, string[]> {
const languageToPaths = new Map<LANGUAGE, string[]>();
const unmatchedPaths: string[] = [];
for (const target of targets) {
Expand Down
16 changes: 4 additions & 12 deletions test/lib/cpd/CpdEngine.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,8 @@ import { RuleTarget } from '../../../src/types';
TestOverrides.initializeTestSetup();

describe('CpdEngine', () => {
class CpdEngineSubclass extends CpdEngine {
constructor() {
super();
}
public sortPaths(targets: RuleTarget[]): Map<LANGUAGE, string[]> {
return super.sortPaths(targets);
}
}

const testEngine: CpdEngineSubclass = new CpdEngineSubclass();

const testEngine: CpdEngine = new CpdEngine();

before(async () => {
await testEngine.init();
Expand All @@ -38,7 +30,7 @@ describe('CpdEngine', () => {
let langPathMap: Map<LANGUAGE, string[]> = new Map();
langPathMap.set(LANGUAGE.APEX, ['file.cls','file.trigger']);
langPathMap.set(LANGUAGE.VISUALFORCE, ['file.page','file.component']);
expect(testEngine.sortPaths(targets)).to.eql(langPathMap);
expect((testEngine as any).sortPaths(targets)).to.eql(langPathMap);
});

it('should compare extensions case-insensitively', () => {
Expand All @@ -49,7 +41,7 @@ describe('CpdEngine', () => {

let langPathMap: Map<LANGUAGE, string[]> = new Map();
langPathMap.set(LANGUAGE.APEX, ['file.Cls','file.tRIGGER']);
expect(testEngine.sortPaths(targets)).to.eql(langPathMap);
expect((testEngine as any).sortPaths(targets)).to.eql(langPathMap);
});
});

Expand Down

0 comments on commit a63b95c

Please sign in to comment.