|
| 1 | +describe('Schema with multiple external $refs to different parts of a file', function () { |
| 2 | + 'use strict'; |
| 3 | + |
| 4 | + it('should parse successfully', function () { |
| 5 | + var parser = new $RefParser(); |
| 6 | + return parser |
| 7 | + .parse(path.abs('specs/external-multiple/external-multiple.yaml')) |
| 8 | + .then(function (schema) { |
| 9 | + expect(schema).to.equal(parser.schema); |
| 10 | + expect(schema).to.deep.equal(helper.parsed.externalMultiple.schema); |
| 11 | + expect(parser.$refs.paths()).to.deep.equal([path.abs('specs/external-multiple/external-multiple.yaml')]); |
| 12 | + }); |
| 13 | + }); |
| 14 | + |
| 15 | + it('should resolve successfully', helper.testResolve( |
| 16 | + path.rel('specs/external-multiple/external-multiple.yaml'), |
| 17 | + path.abs('specs/external-multiple/external-multiple.yaml'), helper.parsed.externalMultiple.schema, |
| 18 | + path.abs('specs/external-multiple/definitions.yaml'), helper.parsed.externalMultiple.definitions |
| 19 | + )); |
| 20 | + |
| 21 | + it('should dereference successfully', function () { |
| 22 | + var parser = new $RefParser(); |
| 23 | + return parser |
| 24 | + .dereference(path.rel('specs/external-multiple/external-multiple.yaml')) |
| 25 | + .then(function (schema) { |
| 26 | + expect(schema).to.equal(parser.schema); |
| 27 | + expect(schema).to.deep.equal(helper.dereferenced.externalMultiple); |
| 28 | + |
| 29 | + // Reference equality |
| 30 | + expect(schema.properties.user.example).to.equal(schema.example.user); |
| 31 | + |
| 32 | + // The "circular" flag should NOT be set |
| 33 | + expect(parser.$refs.circular).to.equal(false); |
| 34 | + }); |
| 35 | + }); |
| 36 | + |
| 37 | + it('should bundle successfully', function () { |
| 38 | + var parser = new $RefParser(); |
| 39 | + return parser |
| 40 | + .bundle(path.rel('specs/external-multiple/external-multiple.yaml')) |
| 41 | + .then(function (schema) { |
| 42 | + expect(schema).to.equal(parser.schema); |
| 43 | + expect(schema).to.deep.equal(helper.bundled.externalMultiple); |
| 44 | + }); |
| 45 | + }); |
| 46 | +}); |
0 commit comments