Skip to content

Commit

Permalink
Add unit test proving the issue
Browse files Browse the repository at this point in the history
  • Loading branch information
TwitchBronBron committed Sep 27, 2023
1 parent be83282 commit effac82
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bsc-plugin/src/lib/rooibos/RooibosSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class RooibosSession {
diagnosticNoStagingDir(files[0]);
} else {
const filePath = path.join(this._builder.options.stagingDir ?? this._builder.options.stagingFolderPath, 'source/rooibosMain.brs');
fsExtra.writeFileSync(filePath, `function main()\n Rooibos_init("${this.config?.testSceneName ?? 'RooibosScene'}")\nend function`);
fsExtra.outputFileSync(filePath, `function main()\n Rooibos_init("${this.config?.testSceneName ?? 'RooibosScene'}")\nend function`);

}
}
Expand Down
23 changes: 23 additions & 0 deletions bsc-plugin/src/plugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,29 @@ describe('RooibosPlugin', () => {
expect(plugin.session.sessionInfo.testsCount).to.equal(0);
});

it('transpiles enums in component node tests', async () => {
const file = program.setFile('components/test.spec.bs', `
enum Direction
up = "up"
end enum
namespace tests
@SGNode("Rectangle")
@suite("[Rectangle] Tests")
class ATest extends rooibos.BaseTestSuite
@describe("groupA")
@it("is test1")
function Test()
print Direction.up
end function
end class
end namespace
`);
program.validate();
const contents = await program.getTranspiledFileContents(file.pkgPath);
expect(contents.code).to.include('print "up"');
});

it('multiple groups', () => {
program.setFile('source/test.spec.bs', `
@suite
Expand Down

0 comments on commit effac82

Please sign in to comment.