Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions exercises/practice/word-count/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"contributors": [
"ankorGH",
"draalger",
"jagdish-15",
"kytrinyx",
"matthewmorgan",
"ovidiu141",
Expand Down
21 changes: 18 additions & 3 deletions exercises/practice/word-count/.meta/tests.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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"
17 changes: 14 additions & 3 deletions exercises/practice/word-count/word-count.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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);
});
});