diff --git a/test/definitions/3.0.0/security/apiKey.test.mjs b/test/definitions/3.0.0/security/apiKey.test.mjs new file mode 100644 index 00000000..339a901e --- /dev/null +++ b/test/definitions/3.0.0/security/apiKey.test.mjs @@ -0,0 +1,72 @@ +import {describe, it} from 'vitest'; +import TestHelper from '@test/test-helper.mjs'; + +const jsonSchema = require('@definitions/3.0.0/apiKey.json'); + +describe('API Key', () => { + it(TestHelper.exampleIsValidTestName, () => TestHelper.objectIsValid( + jsonSchema, + { + "type": "apiKey", + "description": "apiKey", + "in": "user" + }, + )); + + it(TestHelper.cannotBeEmptyTestName, () => TestHelper.objectIsNotValid( + jsonSchema, + {}, + [ + 'must have required property \'type\'', + 'must have required property \'in\'' + ] + )); + + it(TestHelper.isNotValidWithoutRequiredPropertiesTestName, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "description": "apiKey" + }, + [ + 'must have required property \'type\'', + 'must have required property \'in\'' + ] + )); + + it(TestHelper.isValidWithOnlyRequiredPropertiesTestName, () => TestHelper.objectIsValid( + jsonSchema, + { + "type": "apiKey", + "in": "user" + }, + )); + + it(TestHelper.isValidWhenIsExtendedTestName, () => TestHelper.objectIsValid( + jsonSchema, + { + "type": "apiKey", + "description": "apiKey", + "in": "user", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + )); + + it(TestHelper.isNotValidWhenIsWronglyExtendedTestName, () => TestHelper.wronglyExtended( + jsonSchema, + { + "type": "apiKey", + "description": "apiKey", + "in": "user", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + )); +}); diff --git a/test/definitions/3.0.0/security/apiKey/empty.json b/test/definitions/3.0.0/security/apiKey/empty.json deleted file mode 100644 index 0967ef42..00000000 --- a/test/definitions/3.0.0/security/apiKey/empty.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/test/definitions/3.0.0/security/apiKey/example.json b/test/definitions/3.0.0/security/apiKey/example.json deleted file mode 100644 index 36ca4473..00000000 --- a/test/definitions/3.0.0/security/apiKey/example.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "apiKey", - "description": "apiKey", - "in": "user" -} diff --git a/test/definitions/3.0.0/security/apiKey/extended.json b/test/definitions/3.0.0/security/apiKey/extended.json deleted file mode 100644 index ed945abd..00000000 --- a/test/definitions/3.0.0/security/apiKey/extended.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "type": "apiKey", - "description": "apiKey", - "in": "user", - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - } -} diff --git a/test/definitions/3.0.0/security/apiKey/index.mjs b/test/definitions/3.0.0/security/apiKey/index.mjs deleted file mode 100644 index d154c670..00000000 --- a/test/definitions/3.0.0/security/apiKey/index.mjs +++ /dev/null @@ -1,45 +0,0 @@ -import {describe, it} from 'vitest'; -import TestHelper from '@test/test-helper'; -import path from 'path'; - -const jsonSchema = require('@definitions/3.0.0/apiKey.json'); - -describe('API Key', () => { - it('example', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './example.json'), - )); - - it('empty', () => TestHelper.objectIsNotValid( - jsonSchema, - path.resolve(__dirname, './empty.json'), - [ - 'must have required property \'type\'', - 'must have required property \'in\'' - ] - )); - - it('without required properties', () => TestHelper.objectIsNotValid( - jsonSchema, - path.resolve(__dirname, './without required properties.json'), - [ - 'must have required property \'type\'', - 'must have required property \'in\'' - ] - )); - - it('only required properties', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './only required properties.json'), - )); - - it('extended', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './extended.json'), - )); - - it('wrongly extended', () => TestHelper.wronglyExtended( - jsonSchema, - path.resolve(__dirname, './wrongly extended.json'), - )); -}); diff --git a/test/definitions/3.0.0/security/apiKey/only required properties.json b/test/definitions/3.0.0/security/apiKey/only required properties.json deleted file mode 100644 index 330f8403..00000000 --- a/test/definitions/3.0.0/security/apiKey/only required properties.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "type": "apiKey", - "in": "user" -} diff --git a/test/definitions/3.0.0/security/apiKey/without required properties.json b/test/definitions/3.0.0/security/apiKey/without required properties.json deleted file mode 100644 index 73e6ab8d..00000000 --- a/test/definitions/3.0.0/security/apiKey/without required properties.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "description": "apiKey", - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - } -} diff --git a/test/definitions/3.0.0/security/apiKey/wrongly extended.json b/test/definitions/3.0.0/security/apiKey/wrongly extended.json deleted file mode 100644 index 0d26144b..00000000 --- a/test/definitions/3.0.0/security/apiKey/wrongly extended.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "type": "apiKey", - "description": "apiKey", - "in": "user", - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - }, - "ext-number": 1 -} diff --git a/test/definitions/3.0.0/security/asymmetricEncryption/empty.json b/test/definitions/3.0.0/security/asymmetricEncryption/empty.json deleted file mode 100644 index 0967ef42..00000000 --- a/test/definitions/3.0.0/security/asymmetricEncryption/empty.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/test/definitions/3.0.0/security/asymmetricEncryption/example.json b/test/definitions/3.0.0/security/asymmetricEncryption/example.json deleted file mode 100644 index d4fe745c..00000000 --- a/test/definitions/3.0.0/security/asymmetricEncryption/example.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "type": "asymmetricEncryption", - "description": "asymmetricEncryption" -} diff --git a/test/definitions/3.0.0/security/asymmetricEncryption/extended.json b/test/definitions/3.0.0/security/asymmetricEncryption/extended.json deleted file mode 100644 index 7e8b7320..00000000 --- a/test/definitions/3.0.0/security/asymmetricEncryption/extended.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "type": "asymmetricEncryption", - "description": "asymmetricEncryption", - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - } -} diff --git a/test/definitions/3.0.0/security/asymmetricEncryption/index.mjs b/test/definitions/3.0.0/security/asymmetricEncryption/index.mjs deleted file mode 100644 index 250a022b..00000000 --- a/test/definitions/3.0.0/security/asymmetricEncryption/index.mjs +++ /dev/null @@ -1,43 +0,0 @@ -import {describe, it} from 'vitest'; -import TestHelper from '@test/test-helper'; -import path from 'path'; - -const jsonSchema = require('@definitions/3.0.0/asymmetricEncryption.json'); - -describe('Asymmetric Encryption', () => { - it('example', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './example.json'), - )); - - it('empty', () => TestHelper.objectIsNotValid( - jsonSchema, - path.resolve(__dirname, './empty.json'), - [ - 'must have required property \'type\'' - ] - )); - - it('without required properties', () => TestHelper.objectIsNotValid( - jsonSchema, - path.resolve(__dirname, './without required properties.json'), - [ - 'must have required property \'type\'' - ] - )); - - it('only required properties', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './only required properties.json'), - )); - - it('extended', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './extended.json'), - )); - - it('wrongly extended', () => TestHelper.wronglyExtended( - jsonSchema, - path.resolve(__dirname, './wrongly extended.json'), - )); -}); diff --git a/test/definitions/3.0.0/security/asymmetricEncryption/only required properties.json b/test/definitions/3.0.0/security/asymmetricEncryption/only required properties.json deleted file mode 100644 index 7b89b499..00000000 --- a/test/definitions/3.0.0/security/asymmetricEncryption/only required properties.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "asymmetricEncryption" -} diff --git a/test/definitions/3.0.0/security/asymmetricEncryption/without required properties.json b/test/definitions/3.0.0/security/asymmetricEncryption/without required properties.json deleted file mode 100644 index e3c53a59..00000000 --- a/test/definitions/3.0.0/security/asymmetricEncryption/without required properties.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "asymmetricEncryption" -} diff --git a/test/definitions/3.0.0/security/asymmetricEncryption/wrongly extended.json b/test/definitions/3.0.0/security/asymmetricEncryption/wrongly extended.json deleted file mode 100644 index 33fe5edf..00000000 --- a/test/definitions/3.0.0/security/asymmetricEncryption/wrongly extended.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "type": "asymmetricEncryption", - "description": "asymmetricEncryption", - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - }, - "ext-number": 1 -} diff --git a/test/definitions/3.0.0/security/default-implementation.test.mjs b/test/definitions/3.0.0/security/default-implementation.test.mjs new file mode 100644 index 00000000..e7b272ff --- /dev/null +++ b/test/definitions/3.0.0/security/default-implementation.test.mjs @@ -0,0 +1,117 @@ +import {describe, it} from 'vitest'; +import TestHelper from '@test/test-helper.mjs'; + +describe.each([ + { + name: 'X509', + type: 'X509', + description: 'X509 example', + schema: 'X509', + }, + { + name: 'userPassword', + type: 'userPassword', + description: 'userPassword example', + schema: 'userPassword', + }, + { + name: 'symmetricEncryption', + type: 'symmetricEncryption', + description: 'symmetricEncryption example', + schema: 'symmetricEncryption', + }, + { + name: 'asymmetricEncryption', + type: 'asymmetricEncryption', + description: 'asymmetricEncryption example', + schema: 'asymmetricEncryption', + }, + { + name: 'SASL: plain', + type: 'plain', + description: 'SASL plain example', + schema: 'SaslPlainSecurityScheme', + }, + { + name: 'SASL: GSS-API', + type: 'gssapi', + description: 'SASL GSS-API example', + schema: 'SaslGssapiSecurityScheme', + }, + { + name: 'SASL: SCRAM-SHA-256', + type: 'scramSha256', + description: 'SASL SCRAM-SHA-256 example', + schema: 'SaslScramSecurityScheme', + }, + { + name: 'SASL: SCRAM-SHA-512', + type: 'scramSha512', + description: 'SASL SCRAM-SHA-512 example', + schema: 'SaslScramSecurityScheme', + }, +])('$name', async (params) => { + + const jsonSchema = await import(`@definitions/3.0.0/${params.schema}.json`); + + it(TestHelper.exampleIsValidTestName, () => TestHelper.objectIsValid( + jsonSchema, + { + "type": params.type, + "description": params.description, + }, + )); + + it(TestHelper.cannotBeEmptyTestName, () => TestHelper.objectIsNotValid( + jsonSchema, + {}, + [ + 'must have required property \'type\'' + ] + )); + + it(TestHelper.isNotValidWithoutRequiredPropertiesTestName, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "description": params.description, + }, + [ + 'must have required property \'type\'' + ] + )); + + it(TestHelper.isValidWithOnlyRequiredPropertiesTestName, () => TestHelper.objectIsValid( + jsonSchema, + { + "type": params.type, + }, + )); + + it(TestHelper.isValidWhenIsExtendedTestName, () => TestHelper.objectIsValid( + jsonSchema, + { + "type": params.type, + "description": params.description, + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + )); + + it(TestHelper.isNotValidWhenIsWronglyExtendedTestName, () => TestHelper.wronglyExtended( + jsonSchema, + { + "type": params.type, + "description": params.description, + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + }, + )); + +}) \ No newline at end of file diff --git a/test/definitions/3.0.0/security/gssapi/empty.json b/test/definitions/3.0.0/security/gssapi/empty.json deleted file mode 100644 index 0967ef42..00000000 --- a/test/definitions/3.0.0/security/gssapi/empty.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/test/definitions/3.0.0/security/gssapi/example.json b/test/definitions/3.0.0/security/gssapi/example.json deleted file mode 100644 index f2784402..00000000 --- a/test/definitions/3.0.0/security/gssapi/example.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "type": "gssapi", - "description": "gssapi" -} diff --git a/test/definitions/3.0.0/security/gssapi/extended.json b/test/definitions/3.0.0/security/gssapi/extended.json deleted file mode 100644 index f3e810a1..00000000 --- a/test/definitions/3.0.0/security/gssapi/extended.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "type": "gssapi", - "description": "gssapi", - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - } -} diff --git a/test/definitions/3.0.0/security/gssapi/index.mjs b/test/definitions/3.0.0/security/gssapi/index.mjs deleted file mode 100644 index 844803d3..00000000 --- a/test/definitions/3.0.0/security/gssapi/index.mjs +++ /dev/null @@ -1,39 +0,0 @@ -import {describe, it} from 'vitest'; -import TestHelper from '@test/test-helper'; -import path from 'path'; - -const jsonSchema = require('@definitions/3.0.0/SaslGssapiSecurityScheme.json'); - -describe('GSS-API', () => { - it('example', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './example.json'), - )); - - it('empty', () => TestHelper.objectIsNotValid( - jsonSchema, - path.resolve(__dirname, './empty.json'), - ['must have required property \'type\''] - )); - - it('without required properties', () => TestHelper.objectIsNotValid( - jsonSchema, - path.resolve(__dirname, './without required properties.json'), - ['must have required property \'type\''] - )); - - it('only required properties', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './only required properties.json') - )); - - it('extended', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './extended.json') - )); - - it('wrongly extended', () => TestHelper.wronglyExtended( - jsonSchema, - path.resolve(__dirname, './wrongly extended.json'), - )); -}); diff --git a/test/definitions/3.0.0/security/gssapi/only required properties.json b/test/definitions/3.0.0/security/gssapi/only required properties.json deleted file mode 100644 index a8f1ac25..00000000 --- a/test/definitions/3.0.0/security/gssapi/only required properties.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "gssapi" -} diff --git a/test/definitions/3.0.0/security/gssapi/without required properties.json b/test/definitions/3.0.0/security/gssapi/without required properties.json deleted file mode 100644 index ad2bdae5..00000000 --- a/test/definitions/3.0.0/security/gssapi/without required properties.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "gssapi" -} diff --git a/test/definitions/3.0.0/security/gssapi/wrongly extended.json b/test/definitions/3.0.0/security/gssapi/wrongly extended.json deleted file mode 100644 index 9e3c6988..00000000 --- a/test/definitions/3.0.0/security/gssapi/wrongly extended.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "type": "gssapi", - "description": "gssapi", - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - }, - "ext-number": 1 -} diff --git a/test/definitions/3.0.0/security/index.mjs b/test/definitions/3.0.0/security/index.mjs deleted file mode 100644 index 96cfc7f2..00000000 --- a/test/definitions/3.0.0/security/index.mjs +++ /dev/null @@ -1,16 +0,0 @@ -import {describe} from 'vitest'; - -describe('Security Schemes Test Suite', async () => { - await import('./apiKey'); - await import('./asymmetricEncryption'); - await import('./gssapi'); - await import('./openIdconnect'); - await import('./saslSecurityScheme'); - await import('./plain'); - await import('./scramSha256'); - await import('./scramSha512'); - await import('./symmetricEncryption'); - await import('./userPassword'); - await import('./x509'); - await import('./oauth2'); -}); diff --git a/test/definitions/3.0.0/security/oauth2/index.mjs b/test/definitions/3.0.0/security/oauth2/oauth2.test.mjs similarity index 100% rename from test/definitions/3.0.0/security/oauth2/index.mjs rename to test/definitions/3.0.0/security/oauth2/oauth2.test.mjs diff --git a/test/definitions/3.0.0/security/openIdconnect.test.mjs b/test/definitions/3.0.0/security/openIdconnect.test.mjs new file mode 100644 index 00000000..14e9e0aa --- /dev/null +++ b/test/definitions/3.0.0/security/openIdconnect.test.mjs @@ -0,0 +1,84 @@ +import {describe, it} from 'vitest'; +import TestHelper from '@test/test-helper.mjs'; + +const jsonSchema = require('@definitions/3.0.0/openIdConnect.json'); + +describe('OpenID Connect', () => { + it(TestHelper.exampleIsValidTestName, () => TestHelper.objectIsValid( + jsonSchema, + { + "type": "openIdConnect", + "description": "openIdConnect", + "openIdConnectUrl": "https://server.com/.well-known/openid-configuration", + "scopes": [ + "write:pets", + "read:pets" + ] + }, + )); + + it(TestHelper.cannotBeEmptyTestName, () => TestHelper.objectIsNotValid( + jsonSchema, + {}, + [ + 'must have required property \'type\'', + 'must have required property \'openIdConnectUrl\'' + ] + )); + + it(TestHelper.isNotValidWithoutRequiredPropertiesTestName, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "description": "openIdConnect" + }, + [ + 'must have required property \'type\'', + 'must have required property \'openIdConnectUrl\'' + ] + )); + + it(TestHelper.isValidWithOnlyRequiredPropertiesTestName, () => TestHelper.objectIsValid( + jsonSchema, + { + "type": "openIdConnect", + "openIdConnectUrl": "https://server.com/.well-known/openid-configuration" + }, + )); + + it(TestHelper.isValidWhenIsExtendedTestName, () => TestHelper.objectIsValid( + jsonSchema, + { + "type": "openIdConnect", + "description": "openIdConnect", + "openIdConnectUrl": "https://server.com/.well-known/openid-configuration", + "scopes": [ + "write:pets", + "read:pets" + ], + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + )); + + it(TestHelper.isNotValidWhenIsWronglyExtendedTestName, () => TestHelper.wronglyExtended( + jsonSchema, + { + "type": "openIdConnect", + "description": "openIdConnect", + "openIdConnectUrl": "https://server.com/.well-known/openid-configuration", + "scopes": [ + "write:pets", + "read:pets" + ], + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + }, + )); +}); diff --git a/test/definitions/3.0.0/security/openIdconnect/empty.json b/test/definitions/3.0.0/security/openIdconnect/empty.json deleted file mode 100644 index 0967ef42..00000000 --- a/test/definitions/3.0.0/security/openIdconnect/empty.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/test/definitions/3.0.0/security/openIdconnect/example.json b/test/definitions/3.0.0/security/openIdconnect/example.json deleted file mode 100644 index 71a624c1..00000000 --- a/test/definitions/3.0.0/security/openIdconnect/example.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "type": "openIdConnect", - "description": "openIdConnect", - "openIdConnectUrl": "https://server.com/.well-known/openid-configuration", - "scopes": [ - "write:pets", - "read:pets" - ] -} diff --git a/test/definitions/3.0.0/security/openIdconnect/extended.json b/test/definitions/3.0.0/security/openIdconnect/extended.json deleted file mode 100644 index 5499cc4d..00000000 --- a/test/definitions/3.0.0/security/openIdconnect/extended.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "type": "openIdConnect", - "description": "openIdConnect", - "openIdConnectUrl": "https://server.com/.well-known/openid-configuration", - "scopes": [ - "write:pets", - "read:pets" - ], - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - } -} diff --git a/test/definitions/3.0.0/security/openIdconnect/index.mjs b/test/definitions/3.0.0/security/openIdconnect/index.mjs deleted file mode 100644 index 72902101..00000000 --- a/test/definitions/3.0.0/security/openIdconnect/index.mjs +++ /dev/null @@ -1,45 +0,0 @@ -import {describe, it} from 'vitest'; -import TestHelper from '@test/test-helper'; -import path from 'path'; - -const jsonSchema = require('@definitions/3.0.0/openIdConnect.json'); - -describe('OpenID Connect', () => { - it('example', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './example.json'), - )); - - it('empty', () => TestHelper.objectIsNotValid( - jsonSchema, - path.resolve(__dirname, './empty.json'), - [ - 'must have required property \'type\'', - 'must have required property \'openIdConnectUrl\'' - ] - )); - - it('without required properties', () => TestHelper.objectIsNotValid( - jsonSchema, - path.resolve(__dirname, './without required properties.json'), - [ - 'must have required property \'type\'', - 'must have required property \'openIdConnectUrl\'' - ] - )); - - it('only required properties', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './only required properties.json'), - )); - - it('extended', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './extended.json'), - )); - - it('wrongly extended', () => TestHelper.wronglyExtended( - jsonSchema, - path.resolve(__dirname, './wrongly extended.json'), - )); -}); diff --git a/test/definitions/3.0.0/security/openIdconnect/only required properties.json b/test/definitions/3.0.0/security/openIdconnect/only required properties.json deleted file mode 100644 index f6475aba..00000000 --- a/test/definitions/3.0.0/security/openIdconnect/only required properties.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "type": "openIdConnect", - "openIdConnectUrl": "https://server.com/.well-known/openid-configuration" -} diff --git a/test/definitions/3.0.0/security/openIdconnect/without required properties.json b/test/definitions/3.0.0/security/openIdconnect/without required properties.json deleted file mode 100644 index 0a716a9f..00000000 --- a/test/definitions/3.0.0/security/openIdconnect/without required properties.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "openIdConnect" -} diff --git a/test/definitions/3.0.0/security/openIdconnect/wrongly extended.json b/test/definitions/3.0.0/security/openIdconnect/wrongly extended.json deleted file mode 100644 index a245b607..00000000 --- a/test/definitions/3.0.0/security/openIdconnect/wrongly extended.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "type": "openIdConnect", - "description": "openIdConnect", - "openIdConnectUrl": "https://server.com/.well-known/openid-configuration", - "scopes": [ - "write:pets", - "read:pets" - ], - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - }, - "ext-number": 1 -} diff --git a/test/definitions/3.0.0/security/plain/empty.json b/test/definitions/3.0.0/security/plain/empty.json deleted file mode 100644 index 0967ef42..00000000 --- a/test/definitions/3.0.0/security/plain/empty.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/test/definitions/3.0.0/security/plain/example.json b/test/definitions/3.0.0/security/plain/example.json deleted file mode 100644 index 5a3f8a63..00000000 --- a/test/definitions/3.0.0/security/plain/example.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "type": "plain", - "description": "plain" -} diff --git a/test/definitions/3.0.0/security/plain/extended.json b/test/definitions/3.0.0/security/plain/extended.json deleted file mode 100644 index be8c7a90..00000000 --- a/test/definitions/3.0.0/security/plain/extended.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "type": "plain", - "description": "plain", - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - } -} diff --git a/test/definitions/3.0.0/security/plain/index.mjs b/test/definitions/3.0.0/security/plain/index.mjs deleted file mode 100644 index c6e6f395..00000000 --- a/test/definitions/3.0.0/security/plain/index.mjs +++ /dev/null @@ -1,43 +0,0 @@ -import {describe, it} from 'vitest'; -import TestHelper from '@test/test-helper'; -import path from 'path'; - -const jsonSchema = require('@definitions/3.0.0/SaslPlainSecurityScheme.json'); - -describe('Plain', () => { - it('example', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './example.json'), - )); - - it('empty', () => TestHelper.objectIsNotValid( - jsonSchema, - path.resolve(__dirname, './empty.json'), - [ - 'must have required property \'type\'' - ] - )); - - it('without required properties', () => TestHelper.objectIsNotValid( - jsonSchema, - path.resolve(__dirname, './without required properties.json'), - [ - 'must have required property \'type\'' - ] - )); - - it('only required properties', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './only required properties.json'), - )); - - it('extended', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './extended.json'), - )); - - it('wrongly extended', () => TestHelper.wronglyExtended( - jsonSchema, - path.resolve(__dirname, './wrongly extended.json'), - )); -}); diff --git a/test/definitions/3.0.0/security/plain/only required properties.json b/test/definitions/3.0.0/security/plain/only required properties.json deleted file mode 100644 index 5501f3f7..00000000 --- a/test/definitions/3.0.0/security/plain/only required properties.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "plain" -} diff --git a/test/definitions/3.0.0/security/plain/without required properties.json b/test/definitions/3.0.0/security/plain/without required properties.json deleted file mode 100644 index 59085966..00000000 --- a/test/definitions/3.0.0/security/plain/without required properties.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "plain" -} diff --git a/test/definitions/3.0.0/security/plain/wrongly extended.json b/test/definitions/3.0.0/security/plain/wrongly extended.json deleted file mode 100644 index 7fd42856..00000000 --- a/test/definitions/3.0.0/security/plain/wrongly extended.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "type": "plain", - "description": "plain", - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - }, - "ext-number": 1 -} diff --git a/test/definitions/3.0.0/security/saslSecurityScheme.test.mjs b/test/definitions/3.0.0/security/saslSecurityScheme.test.mjs new file mode 100644 index 00000000..3ecc5c47 --- /dev/null +++ b/test/definitions/3.0.0/security/saslSecurityScheme.test.mjs @@ -0,0 +1,40 @@ +import {describe, it} from 'vitest'; +import TestHelper from '@test/test-helper'; + +describe('SASL Security Scheme', async (httpSecurity) => { + const httpSecurityScheme = await import('@definitions/3.0.0/SaslSecurityScheme.json'); + + it.each([ + { + name: 'gssapi', + json: { + "type": "gssapi", + "description": "gssapi" + } + }, + { + name: 'plain', + json: { + "type": "plain", + "description": "plain" + } + }, + { + name: 'scramSha256', + json: { + "type": "scramSha256", + "description": "scramSha256" + } + }, + { + name: 'scramSha512', + json: { + "type": "scramSha512", + "description": "scramSha512" + } + } + ])('oneOf recognize: $name', (httpSecurity) => TestHelper.objectIsValid( + httpSecurityScheme, + httpSecurity.json, + )); +}); \ No newline at end of file diff --git a/test/definitions/3.0.0/security/saslSecurityScheme/gssapi.json b/test/definitions/3.0.0/security/saslSecurityScheme/gssapi.json deleted file mode 100644 index f2784402..00000000 --- a/test/definitions/3.0.0/security/saslSecurityScheme/gssapi.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "type": "gssapi", - "description": "gssapi" -} diff --git a/test/definitions/3.0.0/security/saslSecurityScheme/index.mjs b/test/definitions/3.0.0/security/saslSecurityScheme/index.mjs deleted file mode 100644 index 1865cecc..00000000 --- a/test/definitions/3.0.0/security/saslSecurityScheme/index.mjs +++ /dev/null @@ -1,27 +0,0 @@ -import {describe, it} from 'vitest'; -import TestHelper from '@test/test-helper'; -import path from 'path'; - -const jsonSchema = require('@definitions/3.0.0/SaslSecurityScheme.json'); - -describe('SASL Security Scheme', () => { - it('Plain', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './plain.json'), - )); - - it('SCRAM-SHA-256', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './scramSha256.json'), - )); - - it('SCRAM-SHA-512', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './scramSha512.json'), - )); - - it('GSS-API', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './gssapi.json'), - )); -}); diff --git a/test/definitions/3.0.0/security/saslSecurityScheme/plain.json b/test/definitions/3.0.0/security/saslSecurityScheme/plain.json deleted file mode 100644 index 5a3f8a63..00000000 --- a/test/definitions/3.0.0/security/saslSecurityScheme/plain.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "type": "plain", - "description": "plain" -} diff --git a/test/definitions/3.0.0/security/saslSecurityScheme/scramSha256.json b/test/definitions/3.0.0/security/saslSecurityScheme/scramSha256.json deleted file mode 100644 index 120e37e8..00000000 --- a/test/definitions/3.0.0/security/saslSecurityScheme/scramSha256.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "type": "scramSha256", - "description": "scramSha256" -} diff --git a/test/definitions/3.0.0/security/saslSecurityScheme/scramSha512.json b/test/definitions/3.0.0/security/saslSecurityScheme/scramSha512.json deleted file mode 100644 index 82ab450c..00000000 --- a/test/definitions/3.0.0/security/saslSecurityScheme/scramSha512.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "type": "scramSha512", - "description": "scramSha512" -} diff --git a/test/definitions/3.0.0/security/scramSha256/empty.json b/test/definitions/3.0.0/security/scramSha256/empty.json deleted file mode 100644 index 0967ef42..00000000 --- a/test/definitions/3.0.0/security/scramSha256/empty.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/test/definitions/3.0.0/security/scramSha256/example.json b/test/definitions/3.0.0/security/scramSha256/example.json deleted file mode 100644 index 120e37e8..00000000 --- a/test/definitions/3.0.0/security/scramSha256/example.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "type": "scramSha256", - "description": "scramSha256" -} diff --git a/test/definitions/3.0.0/security/scramSha256/extended.json b/test/definitions/3.0.0/security/scramSha256/extended.json deleted file mode 100644 index a2a64539..00000000 --- a/test/definitions/3.0.0/security/scramSha256/extended.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "type": "scramSha256", - "description": "scramSha256", - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - } -} diff --git a/test/definitions/3.0.0/security/scramSha256/index.mjs b/test/definitions/3.0.0/security/scramSha256/index.mjs deleted file mode 100644 index 2bdce85d..00000000 --- a/test/definitions/3.0.0/security/scramSha256/index.mjs +++ /dev/null @@ -1,43 +0,0 @@ -import {describe, it} from 'vitest'; -import TestHelper from '@test/test-helper'; -import path from 'path'; - -const jsonSchema = require('@definitions/3.0.0/SaslScramSecurityScheme.json'); - -describe('SCRAM-SHA-256', () => { - it('example', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './example.json'), - )); - - it('empty', () => TestHelper.objectIsNotValid( - jsonSchema, - path.resolve(__dirname, './empty.json'), - [ - 'must have required property \'type\'' - ] - )); - - it('without required properties', () => TestHelper.objectIsNotValid( - jsonSchema, - path.resolve(__dirname, './without required properties.json'), - [ - 'must have required property \'type\'' - ] - )); - - it('only required properties', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './only required properties.json'), - )); - - it('extended', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './extended.json'), - )); - - it('wrongly extended', () => TestHelper.wronglyExtended( - jsonSchema, - path.resolve(__dirname, './wrongly extended.json'), - )); -}); diff --git a/test/definitions/3.0.0/security/scramSha256/only required properties.json b/test/definitions/3.0.0/security/scramSha256/only required properties.json deleted file mode 100644 index 3b7f6567..00000000 --- a/test/definitions/3.0.0/security/scramSha256/only required properties.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "scramSha256" -} diff --git a/test/definitions/3.0.0/security/scramSha256/without required properties.json b/test/definitions/3.0.0/security/scramSha256/without required properties.json deleted file mode 100644 index 1d128c52..00000000 --- a/test/definitions/3.0.0/security/scramSha256/without required properties.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "scramSha256" -} diff --git a/test/definitions/3.0.0/security/scramSha256/wrongly extended.json b/test/definitions/3.0.0/security/scramSha256/wrongly extended.json deleted file mode 100644 index f44423d1..00000000 --- a/test/definitions/3.0.0/security/scramSha256/wrongly extended.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "type": "scramSha256", - "description": "scramSha256", - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - }, - "ext-number": 1 -} diff --git a/test/definitions/3.0.0/security/scramSha512/empty.json b/test/definitions/3.0.0/security/scramSha512/empty.json deleted file mode 100644 index 0967ef42..00000000 --- a/test/definitions/3.0.0/security/scramSha512/empty.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/test/definitions/3.0.0/security/scramSha512/example.json b/test/definitions/3.0.0/security/scramSha512/example.json deleted file mode 100644 index 82ab450c..00000000 --- a/test/definitions/3.0.0/security/scramSha512/example.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "type": "scramSha512", - "description": "scramSha512" -} diff --git a/test/definitions/3.0.0/security/scramSha512/extended.json b/test/definitions/3.0.0/security/scramSha512/extended.json deleted file mode 100644 index f434a3cb..00000000 --- a/test/definitions/3.0.0/security/scramSha512/extended.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "type": "scramSha512", - "description": "scramSha512", - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - } -} diff --git a/test/definitions/3.0.0/security/scramSha512/index.mjs b/test/definitions/3.0.0/security/scramSha512/index.mjs deleted file mode 100644 index bcb45fe0..00000000 --- a/test/definitions/3.0.0/security/scramSha512/index.mjs +++ /dev/null @@ -1,43 +0,0 @@ -import {describe, it} from 'vitest'; -import TestHelper from '@test/test-helper'; -import path from 'path'; - -const jsonSchema = require('@definitions/3.0.0/SaslScramSecurityScheme.json'); - -describe('SCRAM-SHA-512', () => { - it('example', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './example.json'), - )); - - it('empty', () => TestHelper.objectIsNotValid( - jsonSchema, - path.resolve(__dirname, './empty.json'), - [ - 'must have required property \'type\'' - ] - )); - - it('without required properties', () => TestHelper.objectIsNotValid( - jsonSchema, - path.resolve(__dirname, './without required properties.json'), - [ - 'must have required property \'type\'' - ] - )); - - it('only required properties', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './only required properties.json'), - )); - - it('extended', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './extended.json'), - )); - - it('wrongly extended', () => TestHelper.wronglyExtended( - jsonSchema, - path.resolve(__dirname, './wrongly extended.json'), - )); -}); diff --git a/test/definitions/3.0.0/security/scramSha512/only required properties.json b/test/definitions/3.0.0/security/scramSha512/only required properties.json deleted file mode 100644 index fe00827c..00000000 --- a/test/definitions/3.0.0/security/scramSha512/only required properties.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "scramSha512" -} diff --git a/test/definitions/3.0.0/security/scramSha512/without required properties.json b/test/definitions/3.0.0/security/scramSha512/without required properties.json deleted file mode 100644 index a004eef0..00000000 --- a/test/definitions/3.0.0/security/scramSha512/without required properties.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "scramSha512" -} diff --git a/test/definitions/3.0.0/security/scramSha512/wrongly extended.json b/test/definitions/3.0.0/security/scramSha512/wrongly extended.json deleted file mode 100644 index 097dc240..00000000 --- a/test/definitions/3.0.0/security/scramSha512/wrongly extended.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "type": "scramSha512", - "description": "scramSha512", - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - }, - "ext-number": 1 -} diff --git a/test/definitions/3.0.0/security/symmetricEncryption/empty.json b/test/definitions/3.0.0/security/symmetricEncryption/empty.json deleted file mode 100644 index 0967ef42..00000000 --- a/test/definitions/3.0.0/security/symmetricEncryption/empty.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/test/definitions/3.0.0/security/symmetricEncryption/example.json b/test/definitions/3.0.0/security/symmetricEncryption/example.json deleted file mode 100644 index 4596ab1e..00000000 --- a/test/definitions/3.0.0/security/symmetricEncryption/example.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "type": "symmetricEncryption", - "description": "symmetricEncryption" -} diff --git a/test/definitions/3.0.0/security/symmetricEncryption/extended.json b/test/definitions/3.0.0/security/symmetricEncryption/extended.json deleted file mode 100644 index 4f61478f..00000000 --- a/test/definitions/3.0.0/security/symmetricEncryption/extended.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "type": "symmetricEncryption", - "description": "symmetricEncryption", - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - } -} diff --git a/test/definitions/3.0.0/security/symmetricEncryption/index.mjs b/test/definitions/3.0.0/security/symmetricEncryption/index.mjs deleted file mode 100644 index 635067e2..00000000 --- a/test/definitions/3.0.0/security/symmetricEncryption/index.mjs +++ /dev/null @@ -1,43 +0,0 @@ -import {describe, it} from 'vitest'; -import TestHelper from '@test/test-helper'; -import path from 'path'; - -const jsonSchema = require('@definitions/3.0.0/symmetricEncryption.json'); - -describe('Symmetric Encryption', () => { - it('example', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './example.json'), - )); - - it('empty', () => TestHelper.objectIsNotValid( - jsonSchema, - path.resolve(__dirname, './empty.json'), - [ - 'must have required property \'type\'' - ] - )); - - it('without required properties', () => TestHelper.objectIsNotValid( - jsonSchema, - path.resolve(__dirname, './without required properties.json'), - [ - 'must have required property \'type\'' - ] - )); - - it('only required properties', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './only required properties.json'), - )); - - it('extended', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './extended.json'), - )); - - it('wrongly extended', () => TestHelper.wronglyExtended( - jsonSchema, - path.resolve(__dirname, './wrongly extended.json'), - )); -}); diff --git a/test/definitions/3.0.0/security/symmetricEncryption/only required properties.json b/test/definitions/3.0.0/security/symmetricEncryption/only required properties.json deleted file mode 100644 index 184bb5ef..00000000 --- a/test/definitions/3.0.0/security/symmetricEncryption/only required properties.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "symmetricEncryption" -} diff --git a/test/definitions/3.0.0/security/symmetricEncryption/without required properties.json b/test/definitions/3.0.0/security/symmetricEncryption/without required properties.json deleted file mode 100644 index 0636ee8d..00000000 --- a/test/definitions/3.0.0/security/symmetricEncryption/without required properties.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "symmetricEncryption" -} diff --git a/test/definitions/3.0.0/security/symmetricEncryption/wrongly extended.json b/test/definitions/3.0.0/security/symmetricEncryption/wrongly extended.json deleted file mode 100644 index e4da124c..00000000 --- a/test/definitions/3.0.0/security/symmetricEncryption/wrongly extended.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "type": "symmetricEncryption", - "description": "symmetricEncryption", - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - }, - "ext-number": 1 -} diff --git a/test/definitions/3.0.0/security/userPassword/empty.json b/test/definitions/3.0.0/security/userPassword/empty.json deleted file mode 100644 index 0967ef42..00000000 --- a/test/definitions/3.0.0/security/userPassword/empty.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/test/definitions/3.0.0/security/userPassword/example.json b/test/definitions/3.0.0/security/userPassword/example.json deleted file mode 100644 index 35dc563f..00000000 --- a/test/definitions/3.0.0/security/userPassword/example.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "type": "userPassword", - "description": "userPassword" -} diff --git a/test/definitions/3.0.0/security/userPassword/extended.json b/test/definitions/3.0.0/security/userPassword/extended.json deleted file mode 100644 index b94d082d..00000000 --- a/test/definitions/3.0.0/security/userPassword/extended.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "type": "userPassword", - "description": "userPassword", - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - } -} diff --git a/test/definitions/3.0.0/security/userPassword/index.mjs b/test/definitions/3.0.0/security/userPassword/index.mjs deleted file mode 100644 index b8fe4a40..00000000 --- a/test/definitions/3.0.0/security/userPassword/index.mjs +++ /dev/null @@ -1,43 +0,0 @@ -import {describe, it} from 'vitest'; -import TestHelper from '@test/test-helper'; -import path from 'path'; - -const jsonSchema = require('@definitions/3.0.0/userPassword.json'); - -describe('User Password', () => { - it('example', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './example.json'), - )); - - it('empty', () => TestHelper.objectIsNotValid( - jsonSchema, - path.resolve(__dirname, './empty.json'), - [ - 'must have required property \'type\'' - ] - )); - - it('without required properties', () => TestHelper.objectIsNotValid( - jsonSchema, - path.resolve(__dirname, './without required properties.json'), - [ - 'must have required property \'type\'' - ] - )); - - it('only required properties', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './only required properties.json'), - )); - - it('extended', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './extended.json'), - )); - - it('wrongly extended', () => TestHelper.wronglyExtended( - jsonSchema, - path.resolve(__dirname, './wrongly extended.json'), - )); -}); diff --git a/test/definitions/3.0.0/security/userPassword/only required properties.json b/test/definitions/3.0.0/security/userPassword/only required properties.json deleted file mode 100644 index 47dbe379..00000000 --- a/test/definitions/3.0.0/security/userPassword/only required properties.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "userPassword" -} diff --git a/test/definitions/3.0.0/security/userPassword/without required properties.json b/test/definitions/3.0.0/security/userPassword/without required properties.json deleted file mode 100644 index 732bfc34..00000000 --- a/test/definitions/3.0.0/security/userPassword/without required properties.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "userPassword" -} diff --git a/test/definitions/3.0.0/security/userPassword/wrongly extended.json b/test/definitions/3.0.0/security/userPassword/wrongly extended.json deleted file mode 100644 index 4f62ca6e..00000000 --- a/test/definitions/3.0.0/security/userPassword/wrongly extended.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "type": "userPassword", - "description": "userPassword", - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - }, - "ext-number": 1 -} diff --git a/test/definitions/3.0.0/security/x509/empty.json b/test/definitions/3.0.0/security/x509/empty.json deleted file mode 100644 index 0967ef42..00000000 --- a/test/definitions/3.0.0/security/x509/empty.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/test/definitions/3.0.0/security/x509/example.json b/test/definitions/3.0.0/security/x509/example.json deleted file mode 100644 index b3399241..00000000 --- a/test/definitions/3.0.0/security/x509/example.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "type": "X509", - "description": "X509" -} diff --git a/test/definitions/3.0.0/security/x509/extended.json b/test/definitions/3.0.0/security/x509/extended.json deleted file mode 100644 index 6722b04b..00000000 --- a/test/definitions/3.0.0/security/x509/extended.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "type": "X509", - "description": "X509", - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - } -} diff --git a/test/definitions/3.0.0/security/x509/index.mjs b/test/definitions/3.0.0/security/x509/index.mjs deleted file mode 100644 index ac89e831..00000000 --- a/test/definitions/3.0.0/security/x509/index.mjs +++ /dev/null @@ -1,43 +0,0 @@ -import {describe, it} from 'vitest'; -import TestHelper from '@test/test-helper'; -import path from 'path'; - -const jsonSchema = require('@definitions/3.0.0/X509.json'); - -describe('X509', () => { - it('example', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './example.json'), - )); - - it('empty', () => TestHelper.objectIsNotValid( - jsonSchema, - path.resolve(__dirname, './empty.json'), - [ - 'must have required property \'type\'' - ] - )); - - it('without required properties', () => TestHelper.objectIsNotValid( - jsonSchema, - path.resolve(__dirname, './without required properties.json'), - [ - 'must have required property \'type\'' - ] - )); - - it('only required properties', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './only required properties.json'), - )); - - it('extended', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './extended.json'), - )); - - it('wrongly extended', () => TestHelper.wronglyExtended( - jsonSchema, - path.resolve(__dirname, './wrongly extended.json'), - )); -}); diff --git a/test/definitions/3.0.0/security/x509/only required properties.json b/test/definitions/3.0.0/security/x509/only required properties.json deleted file mode 100644 index 48b3245e..00000000 --- a/test/definitions/3.0.0/security/x509/only required properties.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "X509" -} diff --git a/test/definitions/3.0.0/security/x509/without required properties.json b/test/definitions/3.0.0/security/x509/without required properties.json deleted file mode 100644 index 010bac4d..00000000 --- a/test/definitions/3.0.0/security/x509/without required properties.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "X509" -} diff --git a/test/definitions/3.0.0/security/x509/wrongly extended.json b/test/definitions/3.0.0/security/x509/wrongly extended.json deleted file mode 100644 index 582621cb..00000000 --- a/test/definitions/3.0.0/security/x509/wrongly extended.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "type": "X509", - "description": "X509", - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - }, - "ext-number": 1 -} diff --git a/test/test-helper.mjs b/test/test-helper.mjs index 999bb90f..c0ffe1eb 100644 --- a/test/test-helper.mjs +++ b/test/test-helper.mjs @@ -103,7 +103,10 @@ export default class TestHelper { static wronglyExtended(jsonSchemaPath, objectFilePath) { const validator = this.validator(jsonSchemaPath); - const model = JSON.parse(fs.readFileSync(objectFilePath, 'utf-8')); + const model = (typeof objectFilePath === 'string') + ? JSON.parse(fs.readFileSync(objectFilePath, 'utf-8')) + : objectFilePath + ; const validationResult = validator(model); assert(validationResult === false, 'Object is not valid when was wrongly extended');