From 07ca6cadfd3220ad40020207686236b2a857407a Mon Sep 17 00:00:00 2001 From: Gorkem Ercan Date: Tue, 21 Jan 2020 19:37:12 -0500 Subject: [PATCH] Add test for duplicate properties Adds a test that covers duplicate property reporting --- test/schemaValidation.test.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/schemaValidation.test.ts b/test/schemaValidation.test.ts index 0f5ce319..0e6d4027 100644 --- a/test/schemaValidation.test.ts +++ b/test/schemaValidation.test.ts @@ -333,6 +333,27 @@ suite('Validation Tests', () => { }); + describe('Test with no schemas', () => { + function parseSetup(content: string) { + const testTextDocument = setupTextDocument(content); + return languageService.doValidation(testTextDocument, true); + } + + it('Duplicate properties are reported', done => { + languageService.configure({ + validate: true, + isKubernetes: true + }); + const content = 'kind: a\ncwd: b\nkind: c'; + const validator = parseSetup(content); + validator.then(function (result) { + assert.equal(result.length, 2); + assert.equal(result[1].message, 'duplicate key'); + }).then(done, done); + + }); + }); + describe('Test with custom schemas', function () { function parseSetup(content: string) { const testTextDocument = setupTextDocument(content);