Skip to content

Commit

Permalink
test(definitions): info new tests structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Pakisan committed Jul 2, 2024
1 parent 56293bd commit 03fde74
Show file tree
Hide file tree
Showing 41 changed files with 478 additions and 410 deletions.
1 change: 0 additions & 1 deletion test/definitions/3.0.0/models/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {describe} from 'vitest';

describe('Models Test Suite', async () => {
await import('./channel');
await import('./info');
await import('./operation');
await import('./reference');
await import('./server');
Expand Down
61 changes: 61 additions & 0 deletions test/definitions/3.0.0/models/info/contact.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import {describe} from 'vitest';
import {
JsonSchemaTestSuite,
JsonSchemaTestSuiteConfig,
JsonSchemaTestSuiteData
} from '@test/definitions/base-schema-test.mjs';

const example = {
"name": "AsyncApi",
"url": "https://www.asyncapi.com",
"email": "[email protected]"
}

const onlyRequiredProperties = {}

const withoutRequiredProperties = {}

const extended = {
"name": "AsyncAPI",
"url": "https://www.asyncapi.com",
"email": "[email protected]",
"x-number": 0,
"x-string": "",
"x-object": {
"property": {}
}
}

const wronglyExtended = {
"name": "AsyncAPI",
"url": "https://www.asyncapi.com",
"email": "[email protected]",
"x-number": 0,
"x-string": "",
"x-object": {
"property" : { }
},
"ext-number": 1
}

const jsonSchema = require('@definitions/3.0.0/contact.json');

const config = new JsonSchemaTestSuiteConfig(
false,
[],
true,
[]
);

const data = new JsonSchemaTestSuiteData(
jsonSchema,
[example],
onlyRequiredProperties,
withoutRequiredProperties,
extended,
wronglyExtended
);

describe('Contact', () => {
new JsonSchemaTestSuite(data, config).testSuite()
});
1 change: 0 additions & 1 deletion test/definitions/3.0.0/models/info/contact/empty.json

This file was deleted.

5 changes: 0 additions & 5 deletions test/definitions/3.0.0/models/info/contact/example.json

This file was deleted.

10 changes: 0 additions & 10 deletions test/definitions/3.0.0/models/info/contact/extended.json

This file was deleted.

37 changes: 0 additions & 37 deletions test/definitions/3.0.0/models/info/contact/index.mjs

This file was deleted.

This file was deleted.

This file was deleted.

11 changes: 0 additions & 11 deletions test/definitions/3.0.0/models/info/contact/wrongly extended.json

This file was deleted.

8 changes: 0 additions & 8 deletions test/definitions/3.0.0/models/info/index.mjs

This file was deleted.

58 changes: 58 additions & 0 deletions test/definitions/3.0.0/models/info/info extensions.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import {describe} from 'vitest';
import {
JsonSchemaTestSuite,
JsonSchemaTestSuiteConfig,
JsonSchemaTestSuiteData
} from '@test/definitions/base-schema-test.mjs';

const example = {
"x-x": "PBodiachevskii",
"x-linkedin": "https://www.linkedin.com/company/asyncapi/"
}

const onlyRequiredProperties = {}

const withoutRequiredProperties = {}

const extended = {
"x-number" : 0,
"x-string" : "",
"x-object" : {
"property" : { }
},
"x-x": "PBodiachevskii",
"x-linkedin": "https://www.linkedin.com/company/asyncapi/"
}

const wronglyExtended = {
"ext-number": 1,
"x-number": 0,
"x-string": "",
"x-object": {
"property": {}
},
"x-x": "PBodiachevskii",
"x-linkedin": "https://www.linkedin.com/company/asyncapi/"
}

const jsonSchema = require('@definitions/3.0.0/infoExtensions.json');

const config = new JsonSchemaTestSuiteConfig(
false,
[],
false,
[]
);

const data = new JsonSchemaTestSuiteData(
jsonSchema,
[example],
onlyRequiredProperties,
withoutRequiredProperties,
extended,
wronglyExtended
);

describe('Info Extensions', () => {
new JsonSchemaTestSuite(data, config).testSuite()
});

This file was deleted.

This file was deleted.

This file was deleted.

37 changes: 0 additions & 37 deletions test/definitions/3.0.0/models/info/info extensions/index.mjs

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {describe, it} from 'vitest';
import TestHelper from '@test/test-helper';
import path from 'path';
import TestHelper from '@test/test-helper.mjs';

const jsonSchema = require('@definitions/3.0.0/info.json');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {describe, it} from 'vitest';
import TestHelper from '@test/test-helper';
import path from 'path';
import TestHelper from '@test/test-helper.mjs';

const jsonSchema = require('@definitions/3.0.0/info.json');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {describe, it} from 'vitest';
import TestHelper from '@test/test-helper';
import path from 'path';
import TestHelper from '@test/test-helper.mjs';

const jsonSchema = require('@definitions/3.0.0/info.json');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {describe, it} from 'vitest';
import TestHelper from '@test/test-helper';
import path from 'path';
import TestHelper from '@test/test-helper.mjs';

const jsonSchema = require('@definitions/3.0.0/info.json');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {describe, it} from 'vitest';
import TestHelper from '@test/test-helper';
import path from 'path';
import TestHelper from '@test/test-helper.mjs';

const jsonSchema = require('@definitions/3.0.0/info.json');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {describe, it} from 'vitest';
import TestHelper from '@test/test-helper';
import path from 'path';
import TestHelper from '@test/test-helper.mjs';

const jsonSchema = require('@definitions/3.0.0/info.json');

Expand Down
Loading

0 comments on commit 03fde74

Please sign in to comment.