-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement lazy Property for Cfgu Declaration (#347)
- Loading branch information
1 parent
1048b0a
commit e2be9b2
Showing
7 changed files
with
212 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { ConfigSchema } from './ConfigSchema'; | ||
import { ConfigError } from './utils'; | ||
|
||
describe(`ConfigSchema`, () => { | ||
describe('cfguStructureValidator', () => { | ||
test('Empty SchemaContents', () => { | ||
expect(() => new ConfigSchema('empty', {})).toThrow(ConfigError); | ||
}); | ||
describe('Tests for lazy configs', () => { | ||
test('parse ConfigSchema with `lazy=true` and `default=any`', () => { | ||
expect( | ||
() => | ||
new ConfigSchema('lazy', { | ||
K1: { | ||
type: 'String', | ||
lazy: true, | ||
default: '1', | ||
}, | ||
}), | ||
).toThrow(ConfigError); | ||
}); | ||
test('parse ConfigSchema with `lazy=true` and `template=any`', () => { | ||
expect( | ||
() => | ||
new ConfigSchema('lazy', { | ||
T1: { | ||
type: 'String', | ||
default: 'Template', | ||
}, | ||
K1: { | ||
type: 'String', | ||
lazy: true, | ||
template: '{{ T1 }}', | ||
}, | ||
}), | ||
).toThrow(ConfigError); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,4 +50,5 @@ export interface Cfgu { | |
depends?: string[]; | ||
template?: string; | ||
options?: string[]; | ||
lazy?: boolean; | ||
} |