buildkit(config): rename methods
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
@@ -45,7 +45,7 @@ afterEach(() => {
|
||||
rimraf.sync(tmpDir);
|
||||
});
|
||||
|
||||
describe('generate', () => {
|
||||
describe('resolve', () => {
|
||||
test.each([
|
||||
['debug = true', false, 'debug = true', null],
|
||||
[`notfound.toml`, true, '', new Error('config file notfound.toml not found')],
|
||||
@@ -65,9 +65,9 @@ describe('generate', () => {
|
||||
});
|
||||
let config: string;
|
||||
if (file) {
|
||||
config = buildkit.config.generateFromFile(val);
|
||||
config = buildkit.config.resolveFromFile(val);
|
||||
} else {
|
||||
config = buildkit.config.generateFromString(val);
|
||||
config = buildkit.config.resolveFromString(val);
|
||||
}
|
||||
expect(config).toEqual(tmpName);
|
||||
const configValue = fs.readFileSync(tmpName, 'utf-8');
|
||||
|
||||
@@ -25,15 +25,15 @@ export class Config {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public generateFromString(s: string): string {
|
||||
return this.generate(s, false);
|
||||
public resolveFromString(s: string): string {
|
||||
return this.resolve(s, false);
|
||||
}
|
||||
|
||||
public generateFromFile(s: string): string {
|
||||
return this.generate(s, true);
|
||||
public resolveFromFile(s: string): string {
|
||||
return this.resolve(s, true);
|
||||
}
|
||||
|
||||
private generate(s: string, file: boolean): string {
|
||||
private resolve(s: string, file: boolean): string {
|
||||
if (file) {
|
||||
if (!fs.existsSync(s)) {
|
||||
throw new Error(`config file ${s} not found`);
|
||||
|
||||
Reference in New Issue
Block a user