Skip to content

Commit f198d37

Browse files
committed
tests: add a failing testcase for updating a primitive type
1 parent 7688307 commit f198d37

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

test/expected/immutable.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
openapi: 3.1.0
2+
info:
3+
version: 1.0.0
4+
title: API
5+
paths: {}

test/openapi/immutable.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
openapi: 3.1.0
2+
info:
3+
version: 1.0.0
4+
title: API
5+
paths: {}

test/overlay.test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,14 @@ test('remove all description fields', () => {
5959
expect(result).toEqual(expectedOutput);
6060
});
6161

62+
test('fail to update a primitive string type', () => {
63+
const openapiFile = "test/openapi/immutable.yaml";
64+
const overlayFile = "test/overlays/immutable.yaml";
65+
const expectedFile = "test/expected/immutable.yaml";
66+
const expectedOutput = fs.readFileSync(expectedFile, 'utf8');
67+
68+
const result = overlayFiles(openapiFile, overlayFile);
69+
70+
expect(result).toEqual(expectedOutput);
71+
});
6272

test/overlays/immutable.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
overlay: 1.0.0
2+
actions:
3+
- target: info.version
4+
update: 1.1.0

0 commit comments

Comments
 (0)