From 079671fff231c13a40e5ae19f1504f4218c40fab Mon Sep 17 00:00:00 2001 From: Jagdish Prajapati Date: Fri, 6 Jun 2025 13:20:10 +0530 Subject: [PATCH 1/3] Syncing test.toml and updating the test code and the proof solutions --- .../practice/word-count/.meta/config.json | 1 + .../practice/word-count/.meta/tests.toml | 21 ++++++++++++++++--- .../practice/word-count/word-count.spec.js | 13 +++++++++++- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/exercises/practice/word-count/.meta/config.json b/exercises/practice/word-count/.meta/config.json index 474096eae7..5455789de7 100644 --- a/exercises/practice/word-count/.meta/config.json +++ b/exercises/practice/word-count/.meta/config.json @@ -5,6 +5,7 @@ "contributors": [ "ankorGH", "draalger", + "jagdish-15", "kytrinyx", "matthewmorgan", "ovidiu141", diff --git a/exercises/practice/word-count/.meta/tests.toml b/exercises/practice/word-count/.meta/tests.toml index b00c20ae03..1be425b33c 100644 --- a/exercises/practice/word-count/.meta/tests.toml +++ b/exercises/practice/word-count/.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. [61559d5f-2cad-48fb-af53-d3973a9ee9ef] description = "count one word" @@ -28,6 +35,11 @@ description = "normalize case" [4185a902-bdb0-4074-864c-f416e42a0f19] description = "with apostrophes" +include = false + +[4ff6c7d7-fcfc-43ef-b8e7-34ff1837a2d3] +description = "with apostrophes" +reimplements = "4185a902-bdb0-4074-864c-f416e42a0f19" [be72af2b-8afe-4337-b151-b297202e4a7b] description = "with quotations" @@ -40,3 +52,6 @@ description = "multiple spaces not detected as a word" [50176e8a-fe8e-4f4c-b6b6-aa9cf8f20360] description = "alternating word separators not detected as a word" + +[6d00f1db-901c-4bec-9829-d20eb3044557] +description = "quotation for word with apostrophe" diff --git a/exercises/practice/word-count/word-count.spec.js b/exercises/practice/word-count/word-count.spec.js index 49adcf6d84..4a92a5ce49 100644 --- a/exercises/practice/word-count/word-count.spec.js +++ b/exercises/practice/word-count/word-count.spec.js @@ -80,8 +80,11 @@ describe('countWords', () => { laugh: 1, then: 1, cry: 1, + "you're": 1, + getting: 1, + it: 1, }; - expect(countWords("First: don't laugh. Then: don't cry.")).toEqual( + expect(countWords("'First: don't laugh. Then: don't cry. You're getting it.'")).toEqual( expectedCounts, ); }); @@ -132,4 +135,12 @@ describe('countWords', () => { }; expect(countWords(",\n,one,\n ,two \n 'three'")).toEqual(expectedCounts); }); + + xtest('alternating word separators not detected as a word', () => { + const expectedCounts = { + can: 1, + "can't": 2, + }; + expect(countWords("can, can't, 'can't'")).toEqual(expectedCounts); + }); }); From 60affb40b5d8a78de9e727c701d8d3fc20ae7220 Mon Sep 17 00:00:00 2001 From: Jagdish Prajapati Date: Fri, 6 Jun 2025 13:48:49 +0530 Subject: [PATCH 2/3] running format.mjs --- exercises/practice/word-count/word-count.spec.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exercises/practice/word-count/word-count.spec.js b/exercises/practice/word-count/word-count.spec.js index 4a92a5ce49..16f9f5222c 100644 --- a/exercises/practice/word-count/word-count.spec.js +++ b/exercises/practice/word-count/word-count.spec.js @@ -84,9 +84,9 @@ describe('countWords', () => { getting: 1, it: 1, }; - expect(countWords("'First: don't laugh. Then: don't cry. You're getting it.'")).toEqual( - expectedCounts, - ); + expect( + countWords("'First: don't laugh. Then: don't cry. You're getting it.'"), + ).toEqual(expectedCounts); }); xtest('with quotations', () => { From df60bbc2d2d17dd8954e427831fa215daf61a63d Mon Sep 17 00:00:00 2001 From: Jagdish Prajapati Date: Fri, 6 Jun 2025 17:44:49 +0530 Subject: [PATCH 3/3] Fixin wrong test name --- exercises/practice/word-count/word-count.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/practice/word-count/word-count.spec.js b/exercises/practice/word-count/word-count.spec.js index 16f9f5222c..b83e5043bd 100644 --- a/exercises/practice/word-count/word-count.spec.js +++ b/exercises/practice/word-count/word-count.spec.js @@ -136,7 +136,7 @@ describe('countWords', () => { expect(countWords(",\n,one,\n ,two \n 'three'")).toEqual(expectedCounts); }); - xtest('alternating word separators not detected as a word', () => { + xtest('quotation for word with apostrophe', () => { const expectedCounts = { can: 1, "can't": 2,