Skip to content

Commit 2d0842b

Browse files
committed
Fixed an issue where definition validation was not considering multiple white space characters
1 parent cbe5002 commit 2d0842b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

test/unit/versionUtils.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -485,23 +485,23 @@ describe('compareVersion method', function () {
485485
describe('getVersionRegexBySpecificationVersion method', function () {
486486
it('should return regex for 3.0', function () {
487487
const result = getVersionRegexBySpecificationVersion('3.0');
488-
expect(result.toString()).to.equal('/openapi[\'|\"]?:\\s?[\\]?[\'|\"]?3.0/');
488+
expect(result.toString()).to.equal('/openapi[\'|\"]?\\s*:\\s*[\\]?[\'|\"]?3.0/');
489489
});
490490
it('should return regex for 3.0.0', function () {
491491
const result = getVersionRegexBySpecificationVersion('3.0.0');
492-
expect(result.toString()).to.equal('/openapi[\'|\"]?:\\s?[\\]?[\'|\"]?3.0/');
492+
expect(result.toString()).to.equal('/openapi[\'|\"]?\\s*:\\s*[\\]?[\'|\"]?3.0/');
493493
});
494494
it('should return regex for 3.1', function () {
495495
const result = getVersionRegexBySpecificationVersion('3.1');
496-
expect(result.toString()).to.equal('/openapi[\'|\"]?:\\s?[\\]?[\'|\"]?3.1/');
496+
expect(result.toString()).to.equal('/openapi[\'|\"]?\\s*:\\s*[\\]?[\'|\"]?3.1/');
497497
});
498498
it('should return regex for 2.0', function () {
499499
const result = getVersionRegexBySpecificationVersion('2.0');
500-
expect(result.toString()).to.equal('/swagger[\'|\"]?:\\s?[\\]?[\'|\"]?2.0/');
500+
expect(result.toString()).to.equal('/swagger[\'|\"]?\\s*:\\s*[\\]?[\'|\"]?2.0/');
501501
});
502502
it('should return regex for 3.0 as default', function () {
503503
const result = getVersionRegexBySpecificationVersion('invalid');
504-
expect(result.toString()).to.equal('/openapi[\'|\"]?:\\s?[\\]?[\'|\"]?3.0/');
504+
expect(result.toString()).to.equal('/openapi[\'|\"]?\\s*:\\s*[\\]?[\'|\"]?3.0/');
505505
});
506506
});
507507

0 commit comments

Comments
 (0)