Skip to content

Commit 92ba8c2

Browse files
committed
bot review
1 parent f64c626 commit 92ba8c2

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

packages/compass-data-modeling/src/services/open-and-download-diagram.spec.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,17 @@ describe('open-and-download-diagram', function () {
6464
},
6565
{
6666
title:
67-
'should throw an error if content.version and content.type is not valid',
67+
'should throw an error if content.version is not the current version',
6868
file: makeFile(
69-
JSON.stringify({ version: 0, type: 'something' }),
69+
JSON.stringify({ version: 0, type: 'Compass Data Modeling Diagram' }),
70+
'file.json'
71+
),
72+
expected: 'Unsupported diagram file format',
73+
},
74+
{
75+
title: 'should throw an error if content.type is not the current type',
76+
file: makeFile(
77+
JSON.stringify({ version: 1, type: 'Compass Data Modeling' }),
7078
'file.json'
7179
),
7280
expected: 'Unsupported diagram file format',

packages/compass-data-modeling/src/services/open-and-download-diagram.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export async function getDiagramContentsFromFile(
4242
const parsedContent = JSON.parse(content);
4343

4444
if (
45-
parsedContent.version !== kCurrentVersion &&
45+
parsedContent.version !== kCurrentVersion ||
4646
parsedContent.type !== kFileTypeDescription
4747
) {
4848
return reject(new Error('Unsupported diagram file format'));

0 commit comments

Comments
 (0)