Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/model/image-tag.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ describe('ImageTag', () => {
expect(() => new ImageTag(unityVersion)).not.toThrow();
});

test.each(['2000.0.0f0', '2011.1.11f1'])('accepts %p version format', (version) => {
test.each(['2000.0.0f0', '2011.1.11f1', '6000.0.0f0'])('accepts %p version format', (version) => {
expect(() => new ImageTag(version)).not.toThrow();
});
Comment on lines +11 to 13
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix formatting to comply with Prettier.

The test logic correctly validates the new Unity 6000.x version format alongside existing formats.

Apply this diff to fix the Prettier formatting issues:

-    test.each(['2000.0.0f0', '2011.1.11f1', '6000.0.0f0'])('accepts %p version format', (version) => {
+    test.each(['2000.0.0f0', '2011.1.11f1', '6000.0.0f0'])(
+      'accepts %p version format',
+      (version) => {
-      expect(() => new ImageTag(version)).not.toThrow();
-    });
+        expect(() => new ImageTag(version)).not.toThrow();
+      },
+    );
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
test.each(['2000.0.0f0', '2011.1.11f1', '6000.0.0f0'])('accepts %p version format', (version) => {
expect(() => new ImageTag(version)).not.toThrow();
});
test.each(['2000.0.0f0', '2011.1.11f1', '6000.0.0f0'])(
'accepts %p version format',
(version) => {
expect(() => new ImageTag(version)).not.toThrow();
},
);
🧰 Tools
🪛 ESLint

[error] 11-11: Replace 'accepts·%p·version·format', with ⏎······'accepts·%p·version·format',⏎·····

(prettier/prettier)


[error] 12-12: Insert ··

(prettier/prettier)


[error] 13-13: Replace } with ··},⏎····

(prettier/prettier)

🤖 Prompt for AI Agents
In src/model/image-tag.test.ts around lines 11 to 13, the test block has
Prettier formatting violations; reformat the test.each invocation to comply with
the project's Prettier rules (apply proper indentation, spacing and trailing
commas as configured) — either run Prettier on this file or manually adjust
whitespace so the array, callback, and expect line match the repository style,
then save the file.


test.each(['1999.1.1f1', '6000.1.invalid'])('rejects %p version format', (version) => {
expect(() => new ImageTag(version)).toThrow(`Invalid version "${version}".`);
});
Comment on lines +15 to +17
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Address i18n linting and formatting.

The test cases correctly validate that invalid version formats are rejected with the appropriate error message.

Apply this diff to fix the formatting and address the i18n linting warning:

-    test.each(['1999.1.1f1', '6000.1.invalid'])('rejects %p version format', (version) => {
-      expect(() => new ImageTag(version)).toThrow(`Invalid version "${version}".`);
-    });
+    test.each(['1999.1.1f1', '6000.1.invalid'])(
+      'rejects %p version format',
+      (version) => {
+        // eslint-disable-next-line i18n-text/no-en
+        expect(() => new ImageTag(version)).toThrow(`Invalid version "${version}".`);
+      },
+    );

Alternatively, if test files should be excluded from i18n linting, update the ESLint configuration to exclude test files from this rule.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
test.each(['1999.1.1f1', '6000.1.invalid'])('rejects %p version format', (version) => {
expect(() => new ImageTag(version)).toThrow(`Invalid version "${version}".`);
});
test.each(['1999.1.1f1', '6000.1.invalid'])(
'rejects %p version format',
(version) => {
// eslint-disable-next-line i18n-text/no-en
expect(() => new ImageTag(version)).toThrow(`Invalid version "${version}".`);
},
);
🧰 Tools
🪛 ESLint

[error] 16-16: English text in string literals is not allowed

(i18n-text/no-en)

});
describe('toString', () => {
it('returns the correct version', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/model/image-tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ImageTag {
}

static get versionPattern() {
return /^20\d{2}\.\d\.\w{3,4}|3$/;
return /^(20\d{2}\.\d\.\w{3,4}|6000\.\d\.\w{3,4})$/;
}

static get imageSuffixes() {
Expand Down