Skip to content

Commit

Permalink
test: add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jmsjtu committed Jul 9, 2024
1 parent 317c856 commit 927570f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/service/templateService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,34 @@ describe('TemplateService', () => {
);
});

it('should create LightningComponent (lwc) with TypeScript', async () => {
await remove(path.join('testsoutput', 'libraryCreate', 'lwc'));
const templateService = TemplateService.getInstance();
const result = await templateService.create(
TemplateType.LightningComponent,
{
componentname: 'LibraryCreateComponent',
outputdir: path.join('testsoutput', 'libraryCreate', 'lwc'),
template: 'typeScript',
type: 'lwc',
}
);

chai
.expect(result.created.sort())
.to.deep.equal(
[
'testsoutput/libraryCreate/lwc/libraryCreateComponent/libraryCreateComponent.ts',
'testsoutput/libraryCreate/lwc/libraryCreateComponent/libraryCreateComponent.html',
'testsoutput/libraryCreate/lwc/libraryCreateComponent/__tests__/libraryCreateComponent.test.ts',
'testsoutput/libraryCreate/lwc/libraryCreateComponent/libraryCreateComponent.js-meta.xml',
'testsoutput/libraryCreate/lwc/libraryCreateComponent/.gitignore',
]
.map((p) => path.normalize(p))
.sort()
);
});

it('should create LightningEvent', async () => {
await remove(path.join('testsoutput', 'libraryCreate', 'aura'));
const templateService = TemplateService.getInstance();
Expand Down

0 comments on commit 927570f

Please sign in to comment.