From 176d481f72660c3d22eb1f252cb665b3500008e0 Mon Sep 17 00:00:00 2001 From: Klaus Date: Sat, 28 Sep 2024 10:39:16 +1200 Subject: [PATCH] added extra test case --- .../{infer-language.test.ts => infer-language.test.js} | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) rename tests/unit/slang-utils/{infer-language.test.ts => infer-language.test.js} (86%) diff --git a/tests/unit/slang-utils/infer-language.test.ts b/tests/unit/slang-utils/infer-language.test.js similarity index 86% rename from tests/unit/slang-utils/infer-language.test.ts rename to tests/unit/slang-utils/infer-language.test.js index acd93ec7..3aa6217c 100644 --- a/tests/unit/slang-utils/infer-language.test.ts +++ b/tests/unit/slang-utils/infer-language.test.js @@ -20,11 +20,13 @@ describe("inferLanguage", function () { }) } - test("should use the latest version if the source has no pragmas", function () { + test("should use the latest valid version if the source has no pragmas", function () { const supportedVersions = Language.supportedVersions(); const latestSupportedVersion = supportedVersions[supportedVersions.length - 1]; - const inferredLanguage = inferLanguage(`contract Foo {}`); + let inferredLanguage = inferLanguage(`contract Foo {}`); expect(inferredLanguage.version).toEqual(latestSupportedVersion); + inferredLanguage = inferLanguage(`contract Foo {byte bar;}`); + expect(inferredLanguage.version).toEqual('0.7.6'); }) test.skip('should throw an error if there are incompatible ranges', function () {