Skip to content

Commit

Permalink
test(definitions): Info test review
Browse files Browse the repository at this point in the history
  • Loading branch information
Pakisan committed Jun 12, 2024
1 parent 85f6522 commit ac929b6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/definitions/3.0.0/models/info/info/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import path from 'path';
const jsonSchema = require('@definitions/3.0.0/info.json');

describe('Info', () => {
it('example', () => TestHelper.objectIsValid(
it(TestHelper.exampleIsValidTestName, () => TestHelper.objectIsValid(
jsonSchema,
path.resolve(__dirname, './example.json'),
));

it('empty', () => TestHelper.objectIsNotValid(
it(TestHelper.cannotBeEmptyTestName, () => TestHelper.objectIsNotValid(
jsonSchema,
path.resolve(__dirname, './empty.json'),
[
Expand All @@ -19,7 +19,7 @@ describe('Info', () => {
]
));

it('without required properties', () => TestHelper.objectIsNotValid(
it(TestHelper.isNotValidWithoutRequiredPropertiesTestName, () => TestHelper.objectIsNotValid(
jsonSchema,
path.resolve(__dirname, './without required properties.json'),
[
Expand All @@ -28,17 +28,17 @@ describe('Info', () => {
]
));

it('only required properties', () => TestHelper.objectIsValid(
it(TestHelper.isValidWithOnlyRequiredPropertiesTestName, () => TestHelper.objectIsValid(
jsonSchema,
path.resolve(__dirname, './only required properties.json'),
));

it('extended', () => TestHelper.objectIsValid(
it(TestHelper.isValidWhenIsExtendedTestName, () => TestHelper.objectIsValid(
jsonSchema,
path.resolve(__dirname, './extended.json'),
));

it('wrongly extended', () => TestHelper.wronglyExtended(
it(TestHelper.isNotValidWhenIsWronglyExtendedTestName, () => TestHelper.wronglyExtended(
jsonSchema,
path.resolve(__dirname, './wrongly extended.json')
));
Expand Down
8 changes: 8 additions & 0 deletions test/test-helper.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,18 @@ export default class TestHelper {
return 'can be empty';
}

static get cannotBeEmptyTestName() {
return 'cannot be empty';
}

static get isValidWithoutRequiredPropertiesTestName() {
return 'is valid without required properties';
}

static get isNotValidWithoutRequiredPropertiesTestName() {
return 'is not valid without required properties';
}

static get isValidWithOnlyRequiredPropertiesTestName() {
return 'is valid with only required properties';
}
Expand Down

0 comments on commit ac929b6

Please sign in to comment.