-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathlightningTestGenerator.ts
46 lines (42 loc) · 1.42 KB
/
lightningTestGenerator.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* Copyright (c) 2019, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import * as path from 'path';
import { nls } from '../i18n';
import { CreateUtil } from '../utils';
import { LightningTestOptions } from '../utils/types';
import { BaseGenerator } from './baseGenerator';
export default class LightningTestGenerator extends BaseGenerator<LightningTestOptions> {
constructor(options: LightningTestOptions) {
super(options);
}
public validateOptions(): void {
CreateUtil.checkInputs(this.options.testname);
CreateUtil.checkInputs(this.options.template);
}
public async generate(): Promise<void> {
const { template, testname, internal } = this.options;
this.sourceRootWithPartialPath('lightningtest');
if (!internal) {
await this.render(
this.templatePath('_staticresource.resource-meta.xml'),
this.destinationPath(
path.join(this.outputdir, `${testname}.resource-meta.xml`)
),
{
description: nls.localize('LightningTest'),
},
// @ts-ignore
{ apiName: testname }
);
}
await this.render(
this.templatePath(`${template}.resource`),
this.destinationPath(path.join(this.outputdir, `${testname}.resource`)),
{ apiName: testname }
);
}
}