From 100b23040ef7e0179917af22e2716e10afdd5224 Mon Sep 17 00:00:00 2001 From: Jagdish Prajapati Date: Sat, 11 Jan 2025 18:01:30 +0530 Subject: [PATCH 1/2] Updating tests for largest-series-product --- .../largest-series-product/.meta/config.json | 1 + .../largest-series-product/.meta/tests.toml | 18 +++++++++++++++--- .../largest-series-product.spec.js | 8 ++++---- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/exercises/practice/largest-series-product/.meta/config.json b/exercises/practice/largest-series-product/.meta/config.json index 554e288820..9f78ec6a9a 100644 --- a/exercises/practice/largest-series-product/.meta/config.json +++ b/exercises/practice/largest-series-product/.meta/config.json @@ -4,6 +4,7 @@ ], "contributors": [ "ankorGH", + "jagdish-15", "ovidiu141", "petertseng", "rchavarria", diff --git a/exercises/practice/largest-series-product/.meta/tests.toml b/exercises/practice/largest-series-product/.meta/tests.toml index 00956d8d41..8831692597 100644 --- a/exercises/practice/largest-series-product/.meta/tests.toml +++ b/exercises/practice/largest-series-product/.meta/tests.toml @@ -1,6 +1,13 @@ -# This is an auto-generated file. Regular comments will be removed when this -# file is regenerated. Regenerating will not touch any manually added keys, -# so comments can be added in a "comment" key. +# This is an auto-generated file. +# +# Regenerating this file via `configlet sync` will: +# - Recreate every `description` key/value pair +# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications +# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) +# - Preserve any other key/value pair +# +# As user-added comments (using the # character) will be removed when this file +# is regenerated, comments can be added via a `comment` key. [7c82f8b7-e347-48ee-8a22-f672323324d4] description = "finds the largest product if span equals length" @@ -48,3 +55,8 @@ description = "rejects invalid character in digits" [5fe3c0e5-a945-49f2-b584-f0814b4dd1ef] description = "rejects negative span" +include = false + +[c859f34a-9bfe-4897-9c2f-6d7f8598e7f0] +description = "rejects negative span" +reimplements = "5fe3c0e5-a945-49f2-b584-f0814b4dd1ef" diff --git a/exercises/practice/largest-series-product/largest-series-product.spec.js b/exercises/practice/largest-series-product/largest-series-product.spec.js index 84c7d8c686..a96e650ec7 100644 --- a/exercises/practice/largest-series-product/largest-series-product.spec.js +++ b/exercises/practice/largest-series-product/largest-series-product.spec.js @@ -42,25 +42,25 @@ describe('Largest Series Product', () => { xtest('rejects span longer than string length', () => { expect(() => largestProduct('123', 4)).toThrow( - new Error('Span must be smaller than string length'), + new Error('span must be smaller than string length'), ); }); xtest('rejects empty string and nonzero span', () => { expect(() => largestProduct('', 1)).toThrow( - new Error('Span must be smaller than string length'), + new Error('span must be smaller than string length'), ); }); xtest('rejects invalid character in digits', () => { expect(() => largestProduct('1234a5', 2)).toThrow( - new Error('Digits input must only contain digits'), + new Error('digits input must only contain digits'), ); }); xtest('rejects negative span', () => { expect(() => largestProduct('12345', -1)).toThrow( - new Error('Span must be greater than zero'), + new Error('span must not be negative'), ); }); }); From c76a23191624458618c77412f0304c43bb3299ce Mon Sep 17 00:00:00 2001 From: Jagdish Prajapati Date: Sat, 11 Jan 2025 18:05:09 +0530 Subject: [PATCH 2/2] Updating proof solution --- exercises/practice/largest-series-product/.meta/proof.ci.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exercises/practice/largest-series-product/.meta/proof.ci.js b/exercises/practice/largest-series-product/.meta/proof.ci.js index 077d6d9f69..facec74de4 100644 --- a/exercises/practice/largest-series-product/.meta/proof.ci.js +++ b/exercises/practice/largest-series-product/.meta/proof.ci.js @@ -3,14 +3,14 @@ export const largestProduct = (digits, seriesLength) => { return 1; } if (seriesLength > digits.length) { - throw new Error('Span must be smaller than string length'); + throw new Error('span must be smaller than string length'); } if (seriesLength < 0) { - throw new Error('Span must be greater than zero'); + throw new Error('span must not be negative'); } if (!/^[0-9]+$/g.test(digits)) { - throw new Error('Digits input must only contain digits'); + throw new Error('digits input must only contain digits'); } let result = 0;