-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathsecond-to-third-version.spec.ts
42 lines (36 loc) · 2.18 KB
/
second-to-third-version.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import fs from 'fs';
import path from 'path';
import { convert } from '../src/convert';
import { assertResults } from './helpers';
describe('convert() - 2.X.X to 3.X.X versions', () => {
it('should convert from 2.6.0 to 3.0.0', () => {
const input = fs.readFileSync(path.resolve(__dirname, 'input', '2.6.0', 'for-3.0.0.yml'), 'utf8');
const output = fs.readFileSync(path.resolve(__dirname, 'output', '3.0.0', 'from-2.6.0.yml'), 'utf8');
const result = convert(input, '3.0.0');
assertResults(output, result);
});
it('should convert from 2.6.0 to 3.0.0 (with used channel components)', () => {
const input = fs.readFileSync(path.resolve(__dirname, 'input', '2.6.0', 'for-3.0.0-with-servers-and-channels-components.yml'), 'utf8');
const output = fs.readFileSync(path.resolve(__dirname, 'output', '3.0.0', 'from-2.6.0-with-servers-and-channels-components.yml'), 'utf8');
const result = convert(input, '3.0.0');
assertResults(output, result);
});
it('should convert from 2.6.0 to 3.0.0 (with deep local references)', () => {
const input = fs.readFileSync(path.resolve(__dirname, 'input', '2.6.0', 'for-3.0.0-with-deep-local-references.yml'), 'utf8');
const output = fs.readFileSync(path.resolve(__dirname, 'output', '3.0.0', 'from-2.6.0-with-deep-local-references.yml'), 'utf8');
const result = convert(input, '3.0.0');
assertResults(output, result);
});
it('should convert from 2.6.0 to 3.0.0 (with custom schema formats)', () => {
const input = fs.readFileSync(path.resolve(__dirname, 'input', '2.6.0', 'for-3.0.0-with-custom-schema-format.yml'), 'utf8');
const output = fs.readFileSync(path.resolve(__dirname, 'output', '3.0.0', 'from-2.6.0-with-custom-schema-format.yml'), 'utf8');
const result = convert(input, '3.0.0');
assertResults(output, result);
});
it('should handle parameter object', () => {
const input = fs.readFileSync(path.resolve(__dirname, 'input', '2.6.0', 'for-3.0.0-with-reference-parameter.yml'), 'utf8');
const output = fs.readFileSync(path.resolve(__dirname, 'output', '3.0.0', 'from-2.6.0-with-reference-parameter.yml'), 'utf8');
const result = convert(input, '3.0.0');
assertResults(output, result);
});
});