Skip to content

Commit

Permalink
Updating tests for change
Browse files Browse the repository at this point in the history
  • Loading branch information
jagdish-15 committed Jan 5, 2025
1 parent 8758c83 commit 681a387
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
1 change: 1 addition & 0 deletions exercises/practice/change/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
],
"contributors": [
"adamxtokyo",
"jagdish-15",
"rchavarria",
"SleeplessByte",
"tejasbubane",
Expand Down
19 changes: 16 additions & 3 deletions exercises/practice/change/.meta/tests.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# 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.

[d0ebd0e1-9d27-4609-a654-df5c0ba1d83a]
description = "change for 1 cent"

[36887bea-7f92-4a9c-b0cc-c0e886b3ecc8]
description = "single coin change"
Expand All @@ -23,6 +33,9 @@ description = "possible change without unit coins available"
[9a166411-d35d-4f7f-a007-6724ac266178]
description = "another possible change without unit coins available"

[ce0f80d5-51c3-469d-818c-3e69dbd25f75]
description = "a greedy approach is not optimal"

[bbbcc154-e9e9-4209-a4db-dd6d81ec26bb]
description = "no coins make 0 change"

Expand Down
6 changes: 6 additions & 0 deletions exercises/practice/change/change.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ describe('Change', () => {
expect(result).toEqual([4, 4, 4, 5, 5, 5]);
});

xtest('a greedy approach is not optimal', () => {
const change = new Change();
const result = change.calculate([1, 10, 11], 20);
expect(result).toEqual([10, 10]);
});

xtest('no coins make 0 change', () => {
const change = new Change();
const result = change.calculate([1, 5, 10, 21, 25], 0);
Expand Down

0 comments on commit 681a387

Please sign in to comment.