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..b83e5043bd 100644 --- a/exercises/practice/word-count/word-count.spec.js +++ b/exercises/practice/word-count/word-count.spec.js @@ -80,10 +80,13 @@ 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( - expectedCounts, - ); + expect( + countWords("'First: don't laugh. Then: don't cry. You're getting it.'"), + ).toEqual(expectedCounts); }); xtest('with quotations', () => { @@ -132,4 +135,12 @@ describe('countWords', () => { }; expect(countWords(",\n,one,\n ,two \n 'three'")).toEqual(expectedCounts); }); + + xtest('quotation for word with apostrophe', () => { + const expectedCounts = { + can: 1, + "can't": 2, + }; + expect(countWords("can, can't, 'can't'")).toEqual(expectedCounts); + }); });