Skip to content

Commit

Permalink
Fix broken test of Scenario086 #104
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidFeldhoff committed Feb 19, 2023
1 parent 90b4fcd commit e9bfe8a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ suite('AddFeature', function () {
}
//Then
await TestHelper.verifyChangeIsValid(messageUpdate);
await TestHelper.verifyResult(messageUpdate, 'scenario086.al');
await TestHelper.verifyResult(messageUpdate, 'scenario086.al', true);
})
});
6 changes: 5 additions & 1 deletion vscode-extension/src/test/testHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,18 @@ export class TestHelper {
assert.strictEqual(userInteractionMock.validate(), true, 'configured questions should match with the questions which popped up')
return result.wantsToContinue;
}
public static async verifyResult(messageUpdate: MessageUpdate, resultFsPath: string) {
public static async verifyResult(messageUpdate: MessageUpdate, resultFsPath: string, skipObjectTypeAndIdVerification: boolean = false) {
//Then save changes is valid
let successful: boolean = await new ObjectService().saveChanges(messageUpdate);
assert.strictEqual(successful, true, 'saveChanges() should run successfully.');
//Then File content is as expected.
let resultFilename: string = TestHelper.getFsPathOfResults(resultFsPath);
let expectedResult: string = readFileSync(resultFilename, { encoding: 'utf8' });
let actualResult: string = readFileSync(messageUpdate.FsPath, { encoding: 'utf8' });
if(skipObjectTypeAndIdVerification){
expectedResult = expectedResult.substring(expectedResult.match(/^\w+ \d+/)![0].length);
actualResult = actualResult.substring(actualResult.match(/^\w+ \d+/)![0].length);
}
assert.strictEqual(actualResult, expectedResult, 'fileContent should be identical.');
}
public static async resetConfigurations(): Promise<void> {
Expand Down

0 comments on commit e9bfe8a

Please sign in to comment.