yini-parser 1.0.0-alpha.1 → 1.0.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/README.md +21 -10
  2. package/dist/YINI.d.ts +21 -0
  3. package/dist/{src/YINI.js → YINI.js} +7 -7
  4. package/dist/config/env.d.ts +34 -0
  5. package/dist/config/env.js +62 -0
  6. package/dist/core/ErrorDataHandler.d.ts +60 -0
  7. package/dist/core/YINIVisitor.d.ts +149 -0
  8. package/dist/core/objectBuilder.d.ts +6 -0
  9. package/dist/core/types.d.ts +59 -0
  10. package/dist/grammar/YiniLexer.d.ts +68 -0
  11. package/dist/grammar/YiniParser.d.ts +284 -0
  12. package/dist/grammar/YiniParserVisitor.d.ts +143 -0
  13. package/dist/index.d.ts +1 -0
  14. package/dist/{src/index.js → index.js} +17 -9
  15. package/dist/parseEntry.d.ts +2 -0
  16. package/dist/{src/parseEntry.js → parseEntry.js} +10 -0
  17. package/dist/parsers/extractHeaderParts.d.ts +31 -0
  18. package/dist/parsers/extractSignificantYiniLine.d.ts +9 -0
  19. package/dist/parsers/parseBoolean.d.ts +5 -0
  20. package/dist/parsers/parseNull.d.ts +2 -0
  21. package/dist/parsers/parseNumber.d.ts +6 -0
  22. package/dist/parsers/parseSectionHeader.d.ts +13 -0
  23. package/dist/parsers/parseString.d.ts +2 -0
  24. package/dist/utils/pathAndFileName.d.ts +5 -0
  25. package/dist/utils/string.d.ts +42 -0
  26. package/dist/utils/system.d.ts +7 -0
  27. package/dist/{src/utils → utils}/system.js +2 -2
  28. package/dist/yiniHelpers.d.ts +44 -0
  29. package/package.json +25 -26
  30. package/dist/src/config/env.js +0 -15
  31. package/dist/tests/integration/1-core-parsing/parse-bigger-section-nesting-as-object.test.js +0 -83
  32. package/dist/tests/integration/1-core-parsing/parse-section-nesting-w-classic-markers.test.js +0 -170
  33. package/dist/tests/integration/1-core-parsing/parse-section-nesting-w-nsh-markers.test.js +0 -27
  34. package/dist/tests/integration/1-core-parsing/read some values from level 1 and 2.test.js +0 -77
  35. package/dist/tests/integration/1-core-parsing/throw on bad section heads.test.js +0 -162
  36. package/dist/tests/integration/10-special-validation-modes/validation-modes.test.js +0 -38
  37. package/dist/tests/integration/2-file-structure-and-error/able to parse mixed case filenames.test.js +0 -72
  38. package/dist/tests/integration/2-file-structure-and-error/throw error on bad file extensions.test.js +0 -36
  39. package/dist/tests/integration/2-file-structure-and-error/throw error parsing bad content.test.js +0 -80
  40. package/dist/tests/smoke/A-general-smoke.test.js +0 -259
  41. package/dist/tests/smoke/B-parse-inline-smoke.test.js +0 -270
  42. package/dist/tests/smoke/C-traverse-file-smoke.test.js +0 -141
  43. package/dist/tests/smoke/D-parse-file-smoke.test.js +0 -134
  44. package/dist/tests/unit/parsers/extractHeaderParts.unit.test.js +0 -490
  45. package/dist/tests/unit/parsers/parseSectionHeader-classic.unit.test.js +0 -421
  46. package/dist/tests/unit/parsers/parseSectionHeader-nsh.unit.test.js +0 -436
  47. package/dist/tests/unit/parsers/parseSectionHeader-throw-on-invalid.unit.test.js +0 -168
  48. package/dist/tests/unit/utils/utils-pathAndFileName.unit.test.js +0 -80
  49. package/dist/tests/unit/utils/utils-string.unit.test.js +0 -185
  50. package/dist/tests/unit/yiniHelpers.unit.test.js +0 -306
  51. /package/dist/{src/core → core}/ErrorDataHandler.js +0 -0
  52. /package/dist/{src/core → core}/YINIVisitor.js +0 -0
  53. /package/dist/{src/core → core}/objectBuilder.js +0 -0
  54. /package/dist/{src/core → core}/types.js +0 -0
  55. /package/dist/{src/grammar → grammar}/YiniLexer.js +0 -0
  56. /package/dist/{src/grammar → grammar}/YiniParser.js +0 -0
  57. /package/dist/{src/grammar → grammar}/YiniParserVisitor.js +0 -0
  58. /package/dist/{src/parsers → parsers}/extractHeaderParts.js +0 -0
  59. /package/dist/{src/parsers → parsers}/extractSignificantYiniLine.js +0 -0
  60. /package/dist/{src/parsers → parsers}/parseBoolean.js +0 -0
  61. /package/dist/{src/parsers → parsers}/parseNull.js +0 -0
  62. /package/dist/{src/parsers → parsers}/parseNumber.js +0 -0
  63. /package/dist/{src/parsers → parsers}/parseSectionHeader.js +0 -0
  64. /package/dist/{src/parsers → parsers}/parseString.js +0 -0
  65. /package/dist/{src/utils → utils}/pathAndFileName.js +0 -0
  66. /package/dist/{src/utils → utils}/string.js +0 -0
  67. /package/dist/{src/yiniHelpers.js → yiniHelpers.js} +0 -0
@@ -1,270 +0,0 @@
1
- "use strict";
2
- /**
3
- * Around 10 Parse-Inline (incl. literals) Smoke Tests
4
- *
5
- * To "quickly" test the main features and syntax of YINI.
6
- * @note These samples/fixtures are different than the tests for parseFile(..).
7
- */
8
- var __importDefault = (this && this.__importDefault) || function (mod) {
9
- return (mod && mod.__esModule) ? mod : { "default": mod };
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const src_1 = __importDefault(require("../../src"));
13
- const system_1 = require("../../src/utils/system");
14
- const fixture10Yini = `
15
- ^ AppConfig
16
- name = "YINI Tester"
17
- version = 1.0
18
-
19
- ^^ Settings
20
- enable_feature = true
21
- paths = ["/home/user", "/tmp"]
22
- options: "opt1", "opt2", "opt3"
23
-
24
- ^^^ Advanced
25
- triple = """multi
26
- line
27
- string"""
28
-
29
- classic = C"Hello\tWorld\n"
30
- hyper = H" foo
31
- bar baz "
32
-
33
- ^ Metadata
34
- author = 'Smoke Test'
35
- created = null
36
- /END
37
- `;
38
- /**
39
- * Parse-Inline Smoke Tests.
40
- */
41
- describe('Parse-Inline Smoke Tests:', () => {
42
- beforeAll(() => { });
43
- //@todo Need to fix so a single member is attached or returned with the implicit base object.
44
- xtest('1.a. Shortest Valid Code (a single member).', () => {
45
- // Arrange.
46
- const validYini = 'number=42';
47
- // Act.
48
- const result = src_1.default.parse(validYini);
49
- (0, system_1.debugPrint)(result);
50
- // Assert.
51
- expect(result.number).toEqual(42);
52
- });
53
- //@todo Fix so this get parse correctly, seems to be issue that {} is being transformed to undefined at some point!
54
- xtest('1.b. Shortest Valid Code (a single section title).', () => {
55
- // Arrange.
56
- const validYini = '^Title';
57
- // Act.
58
- const result = src_1.default.parse(validYini);
59
- (0, system_1.debugPrint)(result);
60
- // Assert.
61
- expect(result.Title).toBeDefined();
62
- });
63
- test('1.c. Shortest Valid Code (section with a single member).', () => {
64
- // Arrange.
65
- const validYini = `^title
66
- another=64`;
67
- // Act.
68
- const result = src_1.default.parse(validYini);
69
- (0, system_1.debugPrint)(result);
70
- // Assert.
71
- expect(result.title.another).toEqual(64);
72
- });
73
- test('2. Short Valid Code (tabbed section with a negative number).', () => {
74
- // Arrange.
75
- const validYini = `
76
- \t^ Section
77
- \tnumber = -1`;
78
- // Act.
79
- const result = src_1.default.parse(validYini);
80
- (0, system_1.debugPrint)(result);
81
- // Assert.
82
- expect(result.Section.number).toEqual(-1);
83
- });
84
- test('3. Minimal Valid Code (section with couple of members).', () => {
85
- // Arrange.
86
- const validYini = `^ Main
87
- name = 'YINI Smoke Test'
88
- version = 3`;
89
- // Act.
90
- const result = src_1.default.parse(validYini);
91
- (0, system_1.debugPrint)(result);
92
- // Assert.
93
- expect(result.Main.name).toEqual('YINI Smoke Test');
94
- expect(result.Main.version).toEqual(3);
95
- });
96
- //@todo Needs implementing of section with sections for this pass.
97
- xtest('4. Nested Sections, Tabbed Nesting, Backticked Names.', () => {
98
- // Arrange.
99
- const validYini = `@yini
100
- ^ user
101
- username = "tester"
102
- \`Is Admin\` = True
103
-
104
- ^^ prefs
105
- theme = 'dark'
106
- notifications = false
107
-
108
- ^^^ \`Complex Section\`
109
- setting = 99`;
110
- // Act.
111
- const result = src_1.default.parse(validYini);
112
- (0, system_1.debugPrint)(result);
113
- // Assert.
114
- expect(result.user.username).toEqual('tester');
115
- expect(result.user.is_admin).toEqual(true);
116
- expect(result.user.prefs.theme).toEqual('dark');
117
- expect(result.user.prefs.notifications).toEqual(false);
118
- expect(result.user.prefs.theme['Complex Section'].setting).toEqual(99);
119
- });
120
- test('5. All Key/Value (simple) Types.', () => {
121
- // Arrange.
122
- const validYini = `
123
- ^ TypesDemo
124
- string1 = "Hello"
125
- string2 = 'World'
126
- number1 = 123
127
- number2 = -5.7
128
- hexval = 0xFFEE
129
-
130
- binval = %10001
131
- bool_true = yes
132
- \`bool false\` = OFF
133
- nullval = null
134
- empty_val = # ← Null (lenient mode)`;
135
- // Act.
136
- const result = src_1.default.parse(validYini);
137
- (0, system_1.debugPrint)(result);
138
- // Assert.
139
- expect(result.TypesDemo.string1).toEqual('Hello');
140
- expect(result.TypesDemo.string2).toEqual('World');
141
- expect(result.TypesDemo.number1).toEqual(123);
142
- expect(result.TypesDemo.number2).toEqual(-5.7);
143
- expect(result.TypesDemo.hexval).toEqual(65518);
144
- expect(result.TypesDemo.binval).toEqual(17);
145
- expect(result.TypesDemo.bool_true).toEqual(true);
146
- expect(result.TypesDemo['bool false']).toEqual(false);
147
- expect(result.TypesDemo.nullval).toEqual(null);
148
- expect(result.TypesDemo.empty_val).toEqual(null);
149
- //@todo Add the rest of the members too
150
- });
151
- xtest('6. List Types.', () => {
152
- // Arrange.
153
- const validYini = `
154
- @YINI
155
- ^ Lists
156
- simple = [1, 2, 3]
157
- mixed = ["A", 10, true, null]
158
- nested = [[1, 2], [3, 4]]
159
- trailing = [5, 6, 7, ] // Trailing comma allowed in lenient mode
160
-
161
- colonlist:
162
- "a",
163
- "b",
164
- "c",`;
165
- // Act.
166
- const result = src_1.default.parse(validYini);
167
- (0, system_1.debugPrint)(result);
168
- // Assert.
169
- //expect(result.TypesDemo.string2).toEqual('World')
170
- //@todo Add the rest of the members too
171
- });
172
- xtest('7. Object Types.', () => {
173
- // Arrange.
174
- const validYini = `
175
- ^ Objects
176
- person = { name = "Alice", age = 30, active = true }
177
- nested = { inner = { foo = "bar" }, number = 2 }
178
- empty = { }`;
179
- // Act.
180
- const result = src_1.default.parse(validYini);
181
- (0, system_1.debugPrint)(result);
182
- // Assert.
183
- //expect(result.TypesDemo.string2).toEqual('World')
184
- //@todo Add the rest of the members too
185
- });
186
- test('8. Comments, Block Comments, and Disabled Lines.', () => {
187
- // Arrange.
188
- const validYini = `
189
- @yini
190
- // Top comment
191
- ^ CommentsDemo
192
- val1 = 123 # Inline comment
193
- val2 = 456 // Another comment
194
- ; Full-line comment
195
-
196
- /*
197
- Block comment
198
- over multiple lines
199
- */
200
-
201
- --val3 = "This is disabled and ignored"
202
- val4 = 'Some text.'
203
- `;
204
- // Act.
205
- const result = src_1.default.parse(validYini);
206
- (0, system_1.debugPrint)(result);
207
- // Assert.
208
- expect(result.CommentsDemo.val1).toEqual(123);
209
- expect(result.CommentsDemo.val2).toEqual(456);
210
- expect(result.CommentsDemo.val3).toEqual(undefined);
211
- expect(result.CommentsDemo.val4).toEqual('Some text.');
212
- });
213
- test('9. Short-Hand and Alternative Section Notations', () => {
214
- // Arrange.
215
- const validYini = `
216
- ~ user
217
- username = 'tester two'
218
- isSysOp = YES
219
-
220
- ~~ prefs
221
- theme = "light"
222
- notifications = OFF
223
-
224
- ^1 user2
225
- ^2 prefs
226
- ^3 deepSection
227
- ^4 deeperSection
228
- key = "Level 4 section"
229
- ^5 yetDeeperSection
230
- key = "Level 5 section"
231
- item = 77
232
-
233
- ~1 user3
234
- username = 'tester three'
235
- isSysOp = NO
236
-
237
- ~2 prefs
238
- theme = "special-dark"
239
- notifications = ON
240
-
241
- `;
242
- // Act.
243
- const result = src_1.default.parse(validYini);
244
- (0, system_1.debugPrint)(result);
245
- // Assert.
246
- expect(result.user.username).toEqual('tester two');
247
- expect(result.user.isSysOp).toEqual(true);
248
- expect(result.user.prefs.theme).toEqual('light');
249
- expect(result.user.prefs.notifications).toEqual(false);
250
- const deeperSection = Object.assign({}, result.user2.prefs.deepSection.deeperSection);
251
- expect(deeperSection.key).toEqual('Level 4 section');
252
- expect(deeperSection.yetDeeperSection.key).toEqual('Level 5 section');
253
- expect(deeperSection.yetDeeperSection.item).toEqual(77);
254
- expect(result.user3.username).toEqual('tester three');
255
- expect(result.user3.isSysOp).toEqual(false);
256
- //@todo (EDIT: This is fixed now??) Fix issue so this missing subsection gets included, not sure yet what exactly causes the issue...
257
- expect(result.user3.prefs.theme).toEqual('special-dark');
258
- expect(result.user3.prefs.notifications).toEqual(true);
259
- });
260
- //@todo Enable when can parse lists...
261
- xtest('10. Parse inline AppConfig (Mixed).', () => {
262
- // Arrange.
263
- // Act.
264
- const result = src_1.default.parse(fixture10Yini);
265
- (0, system_1.debugPrint)(result);
266
- // Assert.
267
- expect(!!result).toEqual(true);
268
- //@todo Add proper tests
269
- });
270
- });
@@ -1,141 +0,0 @@
1
- "use strict";
2
- /**
3
- * 10 Traverse-File Smoke Tests
4
- *
5
- * Dry run parsing, just analyzes/validates/traverses a set of real-life
6
- * (mimiced) configuration files one might have.
7
- *
8
- * Dry-run parsing — performs only enough work to validate the input and
9
- * return success.
10
- */
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const path_1 = __importDefault(require("path"));
16
- const src_1 = __importDefault(require("../../src"));
17
- const system_1 = require("../../src/utils/system");
18
- const DIR_OF_FIXTURES = '../fixtures/smoke-fixtures';
19
- /**
20
- * Parse File Smoke Tests.
21
- */
22
- describe('Parse-File Smoke Tests:', () => {
23
- // Dir with smoke fixtures.
24
- const baseDir = path_1.default.join(__dirname, DIR_OF_FIXTURES);
25
- beforeAll(() => { });
26
- test('Parse file "1-web-server-configuration.*".', () => {
27
- // Arrange.
28
- const fileName = '1-web-server-configuration.smoke.yini';
29
- const fullPath = path_1.default.join(baseDir, fileName);
30
- // Act.
31
- const result = src_1.default.parseFile(fullPath);
32
- (0, system_1.debugPrint)('fullPath = ' + fullPath);
33
- (0, system_1.debugPrint)(result);
34
- // Assert.
35
- // NOTE: Dry run parsing - enough that something is successfully returned.
36
- expect(!!result).toEqual(true);
37
- });
38
- test('Parse file "2-user-profile-settings.*".', () => {
39
- // Arrange.
40
- const fileName = '2-user-profile-settings.smoke.yini';
41
- const fullPath = path_1.default.join(baseDir, fileName);
42
- // Act.
43
- const result = src_1.default.parseFile(fullPath);
44
- (0, system_1.debugPrint)(result);
45
- // Assert.
46
- // NOTE: Dry run parsing - enough that something is successfully returned.
47
- expect(!!result).toEqual(true);
48
- });
49
- //@todo Enable test (after can parse list (colon based)).
50
- xtest('Parse file "3-cli-application-options.*".', () => {
51
- // Arrange.
52
- const fileName = '3-cli-application-options.smoke.yini';
53
- const fullPath = path_1.default.join(baseDir, fileName);
54
- // Act.
55
- const result = src_1.default.parseFile(fullPath);
56
- (0, system_1.debugPrint)(result);
57
- // Assert.
58
- // NOTE: Dry run parsing - enough that something is successfully returned.
59
- expect(!!result).toEqual(true);
60
- });
61
- test('Parse file "4-build-project-configuration.*".', () => {
62
- // Arrange.
63
- const fileName = '4-build-project-configuration.smoke.yini';
64
- const fullPath = path_1.default.join(baseDir, fileName);
65
- // Act.
66
- const result = src_1.default.parseFile(fullPath);
67
- (0, system_1.debugPrint)(result);
68
- // Assert.
69
- // NOTE: Dry run parsing - enough that something is successfully returned.
70
- expect(!!result).toEqual(true);
71
- });
72
- test('Parse file "5-database-connection.*".', () => {
73
- // Arrange.
74
- const fileName = '5-database-connection.smoke.yini';
75
- const fullPath = path_1.default.join(baseDir, fileName);
76
- // Act.
77
- const result = src_1.default.parseFile(fullPath);
78
- (0, system_1.debugPrint)(result);
79
- // Assert.
80
- // NOTE: Dry run parsing - enough that something is successfully returned.
81
- expect(!!result).toEqual(true);
82
- });
83
- test('Parse file "6-feature-flags-example.*".', () => {
84
- // Arrange.
85
- const fileName = '6-feature-flags-example.smoke.yini';
86
- const fullPath = path_1.default.join(baseDir, fileName);
87
- // Act.
88
- const result = src_1.default.parseFile(fullPath);
89
- (0, system_1.debugPrint)(result);
90
- // Assert.
91
- // NOTE: Dry run parsing - enough that something is successfully returned.
92
- expect(!!result).toEqual(true);
93
- });
94
- test('Parse file "7-email-smtp-configuration.*".', () => {
95
- // Arrange.
96
- const fileName = '7-email-smtp-configuration.smoke.yini';
97
- const fullPath = path_1.default.join(baseDir, fileName);
98
- // Act.
99
- const result = src_1.default.parseFile(fullPath);
100
- (0, system_1.debugPrint)(result);
101
- // Assert.
102
- // NOTE: Dry run parsing - enough that something is successfully returned.
103
- expect(!!result).toEqual(true);
104
- });
105
- //@todo Enable test (after can parse colon based lists).
106
- xtest('Parse file "8-api-keys-integration.*".', () => {
107
- // Arrange.
108
- const fileName = '8-api-keys-integration.smoke.yini';
109
- const fullPath = path_1.default.join(baseDir, fileName);
110
- // Act.
111
- const result = src_1.default.parseFile(fullPath);
112
- (0, system_1.debugPrint)(result);
113
- // Assert.
114
- // NOTE: Dry run parsing - enough that something is successfully returned.
115
- expect(!!result).toEqual(true);
116
- });
117
- //@todo Enable test (after can parse with no section defined, implicit base object).
118
- xtest('Parse file "9-app-preferences.*".', () => {
119
- // Arrange.
120
- const fileName = '9-app-preferences.smoke.yini';
121
- const fullPath = path_1.default.join(baseDir, fileName);
122
- // Act.
123
- const result = src_1.default.parseFile(fullPath);
124
- (0, system_1.debugPrint)(result);
125
- // Assert.
126
- // NOTE: Dry run parsing - enough that something is successfully returned.
127
- expect(!!result).toEqual(true);
128
- });
129
- //@todo Enable test (after can parse lists)
130
- xtest('Parse file "10-logging-monitoring.*".', () => {
131
- // Arrange.
132
- const fileName = '10-logging-monitoring.smoke.yini';
133
- const fullPath = path_1.default.join(baseDir, fileName);
134
- // Act.
135
- const result = src_1.default.parseFile(fullPath);
136
- (0, system_1.debugPrint)(result);
137
- // Assert.
138
- // NOTE: Dry run parsing - enough that something is successfully returned.
139
- expect(!!result).toEqual(true);
140
- });
141
- });
@@ -1,134 +0,0 @@
1
- "use strict";
2
- /**
3
- * 10 Parse-File Smoke Tests
4
- *
5
- * To test a set of real-life (mimiced) configuration files one might have.
6
- */
7
- var __importDefault = (this && this.__importDefault) || function (mod) {
8
- return (mod && mod.__esModule) ? mod : { "default": mod };
9
- };
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- const path_1 = __importDefault(require("path"));
12
- const src_1 = __importDefault(require("../../src"));
13
- const system_1 = require("../../src/utils/system");
14
- const DIR_OF_FIXTURES = '../fixtures/smoke-fixtures';
15
- /**
16
- * Parse File Smoke Tests.
17
- */
18
- describe('Parse-File Smoke Tests:', () => {
19
- // Dir with smoke fixtures.
20
- const baseDir = path_1.default.join(__dirname, DIR_OF_FIXTURES);
21
- beforeAll(() => { });
22
- test('Parse file "1-web-server-configuration.*".', () => {
23
- // Arrange.
24
- const fileName = '1-web-server-configuration.smoke.yini';
25
- const fullPath = path_1.default.join(baseDir, fileName);
26
- // Act.
27
- const result = src_1.default.parseFile(fullPath);
28
- (0, system_1.debugPrint)('fullPath = ' + fullPath);
29
- (0, system_1.debugPrint)(result);
30
- // Assert.
31
- expect(result.Server.max_connections).toEqual(200);
32
- //@todo Add tests for the other literal as well.
33
- });
34
- test('Parse file "2-user-profile-settings.*".', () => {
35
- // Arrange.
36
- const fileName = '2-user-profile-settings.smoke.yini';
37
- const fullPath = path_1.default.join(baseDir, fileName);
38
- // Act.
39
- const result = src_1.default.parseFile(fullPath);
40
- (0, system_1.debugPrint)(result);
41
- // Assert.
42
- expect(result.profile.username).toEqual('robinkoda');
43
- //@todo Add tests for the other literal as well.
44
- });
45
- xtest('Parse file "3-cli-application-options.*".', () => {
46
- // Arrange.
47
- const fileName = '3-cli-application-options.smoke.yini';
48
- const fullPath = path_1.default.join(baseDir, fileName);
49
- // Act.
50
- const result = src_1.default.parseFile(fullPath);
51
- (0, system_1.debugPrint)(result);
52
- // Assert.
53
- expect(result.CLI.dry_run).toEqual(false);
54
- //@todo Add tests for the other literal as well.
55
- });
56
- test('Parse file "4-build-project-configuration.*".', () => {
57
- // Arrange.
58
- const fileName = '4-build-project-configuration.smoke.yini';
59
- const fullPath = path_1.default.join(baseDir, fileName);
60
- // Act.
61
- const result = src_1.default.parseFile(fullPath);
62
- (0, system_1.debugPrint)(result);
63
- // Assert.
64
- expect(result.Build.target).toEqual('ES2022');
65
- //@todo Add tests for the other literal as well.
66
- });
67
- test('Parse file "5-database-connection.*".', () => {
68
- // Arrange.
69
- const fileName = '5-database-connection.smoke.yini';
70
- const fullPath = path_1.default.join(baseDir, fileName);
71
- // Act.
72
- const result = src_1.default.parseFile(fullPath);
73
- (0, system_1.debugPrint)(result);
74
- // Assert.
75
- expect(result.Database.port).toEqual(5432);
76
- //@todo Add tests for the other literal as well.
77
- });
78
- test('Parse file "6-feature-flags-example.*".', () => {
79
- // Arrange.
80
- const fileName = '6-feature-flags-example.smoke.yini';
81
- const fullPath = path_1.default.join(baseDir, fileName);
82
- // Act.
83
- const result = src_1.default.parseFile(fullPath);
84
- (0, system_1.debugPrint)(result);
85
- // Assert.
86
- expect(result['Features'].experimental_ui).toEqual(false);
87
- expect(result.Features['Feature Toggles'].feature_x).toEqual(true);
88
- //@todo Add tests for the other literal as well.
89
- });
90
- xtest('Parse file "7-email-smtp-configuration.*".', () => {
91
- // Arrange.
92
- const fileName = '7-email-smtp-configuration.smoke.yini';
93
- const fullPath = path_1.default.join(baseDir, fileName);
94
- // Act.
95
- const result = src_1.default.parseFile(fullPath);
96
- (0, system_1.debugPrint)(result);
97
- // Assert.
98
- expect(result.SMTP.use_tls).toEqual(true);
99
- //@todo Add tests for the other literal as well.
100
- });
101
- xtest('Parse file "8-api-keys-integration.*".', () => {
102
- // Arrange.
103
- const fileName = '8-api-keys-integration.smoke.yini';
104
- const fullPath = path_1.default.join(baseDir, fileName);
105
- // Act.
106
- const result = src_1.default.parseFile(fullPath);
107
- (0, system_1.debugPrint)(result);
108
- // Assert.
109
- expect(result.Webhooks.enabled).toEqual(true);
110
- //@todo Add tests for the other literal as well.
111
- });
112
- xtest('Parse file "9-app-preferences.*".', () => {
113
- // Arrange.
114
- const fileName = '9-app-preferences.smoke.yini';
115
- const fullPath = path_1.default.join(baseDir, fileName);
116
- // Act.
117
- const result = src_1.default.parseFile(fullPath);
118
- (0, system_1.debugPrint)(result);
119
- // Assert.
120
- expect(result.base.CacheFolder).toEqual(null);
121
- //@todo Add tests for the other literal as well.
122
- });
123
- xtest('Parse file "10-logging-monitoring.*".', () => {
124
- // Arrange.
125
- const fileName = '10-logging-monitoring.smoke.yini';
126
- const fullPath = path_1.default.join(baseDir, fileName);
127
- // Act.
128
- const result = src_1.default.parseFile(fullPath);
129
- (0, system_1.debugPrint)(result);
130
- // Assert.
131
- expect(result.base.Alerts.slack_webhook).toEqual(null);
132
- //@todo Add tests for the other literal as well.
133
- });
134
- });