asyncapi-converter
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -200,8 +200,8 @@ const yaml = require('js-yaml'); | ||
function from1to2 (asyncapi1, options) { | ||
let res = from1to2rc2(asyncapi1, options); | ||
return from2rc2to2(res, options); | ||
return from2rc2to2(from1to2rc2(asyncapi1, options), options); | ||
} | ||
function from2rc1to2 (asyncapi2rc1, options) { | ||
const result = from2rc1to2rc2(res, options); | ||
let result = from2rc1to2rc2(asyncapi2rc1, options); | ||
if (!options.id) delete result.id; | ||
result.asyncapi = '2.0.0'; | ||
@@ -208,0 +208,0 @@ |
{ | ||
"name": "asyncapi-converter", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "Convert AsyncAPI documents from older to newer versions.", | ||
@@ -5,0 +5,0 @@ "bin": { |
@@ -77,2 +77,30 @@ const assert = require('assert'); | ||
it('should convert from 1.0.0 to 2.0.0', () => { | ||
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.0.0', 'streetlights.yml'), 'utf8'); | ||
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0', 'streetlights.yml'), 'utf8'); | ||
const result = convert(input, '2.0.0'); | ||
assert.strictEqual(output, result); | ||
}); | ||
it('should convert from 1.1.0 to 2.0.0', () => { | ||
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.1.0', 'streetlights.yml'), 'utf8'); | ||
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0', 'streetlights.yml'), 'utf8'); | ||
const result = convert(input, '2.0.0'); | ||
assert.strictEqual(output, result); | ||
}); | ||
it('should convert from 1.2.0 to 2.0.0', () => { | ||
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.2.0', 'streetlights.yml'), 'utf8'); | ||
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0', 'streetlights.yml'), 'utf8'); | ||
const result = convert(input, '2.0.0'); | ||
assert.strictEqual(output, result); | ||
}); | ||
it('should convert from 2.0.0-rc1 to 2.0.0', () => { | ||
const input = fs.readFileSync(path.resolve(__dirname, 'input', '2.0.0-rc1', 'streetlights.yml'), 'utf8'); | ||
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0', 'streetlights.yml'), 'utf8'); | ||
const result = convert(input, '2.0.0'); | ||
assert.strictEqual(output, result); | ||
}); | ||
it('should convert from 2.0.0-rc2 to 2.0.0', () => { | ||
@@ -79,0 +107,0 @@ const input = fs.readFileSync(path.resolve(__dirname, 'input', '2.0.0-rc2', 'streetlights.yml'), 'utf8'); |
145538
378