Skip to content

Commit db8e129

Browse files
committed
clearing sprint 2 implementation only
1 parent 1cb25ad commit db8e129

3 files changed

Lines changed: 1 addition & 48 deletions

File tree

‎Sprint-2/implement/lookup.js‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
function createLookup(countryCurrencyPairs) {
2-
// implementation here
3-
42
pairs = {};
53
for (const [country, currency] of countryCurrencyPairs) {
64
pairs[country] = currency;

‎Sprint-2/implement/querystring.test.js‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
// In the prep, we implemented a function to parse query strings.
2-
// Unfortunately, it contains several bugs!
3-
// Below are some test cases the implementation doesn't handle well.
4-
// Fix the implementation for these tests, and try to think of as many other edge cases as possible - write tests and fix those too.
5-
61
const parseQueryString = require("./querystring.js");
72

83
test("should parse values containing '='", () => {
@@ -37,9 +32,6 @@ test("should replace '+' by ' '", () => {
3732
});
3833
});
3934

40-
// Stretch exercise: Handling query strings that contain identical keys
41-
42-
// Delete this test if you are not working on this optional case
4335
test("should store values of a key in an array when the key has 2 or more values", () => {
4436
expect(parseQueryString("key=value1&key=value2&key=value3&foo=bar")).toEqual({
4537
key: ["value1", "value2", "value3"],

‎Sprint-2/implement/tally.test.js‎

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,13 @@
11
const tally = require("./tally.js");
22

3-
/**
4-
* tally array
5-
*
6-
* In this task, you'll need to implement a function called tally
7-
* that will take a list of items and count the frequency of each item
8-
* in an array
9-
*
10-
* For example:
11-
*
12-
* tally(['a']), target output: { a: 1 }
13-
* tally(['a', 'a', 'a']), target output: { a: 3 }
14-
* tally(['a', 'a', 'b', 'c']), target output: { a : 2, b: 1, c: 1 }
15-
*/
16-
17-
// Acceptance criteria:
18-
19-
// Given a function called tally
20-
// When passed an array of items
21-
// Then it should return an object containing the count for each unique item
223
test("given an array of items an object containing the counter for each item", () => {
234
expect(tally(["a", "a"])).toEqual({ a: 2 });
245
});
25-
// Given an empty array
26-
// When passed to tally
27-
// Then it should return an empty object
6+
287
test("tally on an empty array returns an empty object", () => {
298
expect(tally([])).toEqual({});
309
});
3110

32-
// Given an array with duplicate items
33-
// When passed to tally
34-
// Then it should return counts for each unique item
3511
test("given an array of items an object containing the counter for each item", () => {
3612
expect(tally(["a", "a", "c", "b", "b", "d"])).toEqual({
3713
a: 2,
@@ -40,19 +16,6 @@ test("given an array of items an object containing the counter for each item", (
4016
d: 1,
4117
});
4218
});
43-
// Given an invalid input like a string
44-
// When passed to tally
45-
// Then it should throw an error
46-
47-
/*
48-
try {
49-
tally("Invalid");
50-
console.error(
51-
"Test failed: Expected an error to be thrown for invalid input"
52-
);
53-
} catch (error) {
54-
console.log("Test passed: Error thrown for invalid input");
55-
}*/
5619

5720
test("tally on an empty array returns an empty object", () => {
5821
expect(() => tally("string")).toThrow("Invalid input!");

0 commit comments

Comments
 (0)