-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update 5.js #331
Update 5.js #331
Conversation
These tests DO NOT do what the challenge is asking. If you read the challenge description for js3/5.js then it: 1. Takes in two objects: obj1 and obj2 2. Then if the keys match the function value of obj2 is invoked with the value of obj1 as a parameter. 3. Otherwise, the values of obj1 stay the same Here are some examples: const case1 = solution ({ "name": "drake", "age": "33", "power": 'finessing', "color": "platinum" }, { "name": (e) => { return e + "kendrick" }, "power": (e) => { return "motivating" + e } }); // will return : const result1 = { "name": "drakekendrick", "age": "33", "power": "motivatingfinessing", "color": "platinum" } const case2 = solution({ "add2": "5", "sub2": "10", "div2": "6", "mult2": "4" }, { "add2": (num) => { return num + " + 2"}, "mult2": (num) => { return "2 * " + num} }) const result2 = { "add2": "5 + 2", "sub2": "10", "div2": "6", "mult2": "2 * 4" } const case3 = solution({}, { 'white': () => { return 'walkers' } }) const result3 = {} const case4 = solution({ 'name': 'pikachu', 'age': '59', 'power': 10, 'color': 'red' }, { 'name': (e) => { return 'Raichu' }, 'power': (num) => { return num * num } }) const result4 = { 'name': 'Raichu', 'age': '59', 'power': 100, 'color': 'red' } const case5 = solution({ 'name': 'khaleesi', 'age': 25, 'power': 'mother of dragons', 'weakness': 'john snow' }, { 'weakness': (e) => { return e + ' knows nothing' }, 'power': (e) => { return e + ' is fire proof' } }) const result5 = { 'name': 'khaleesi', 'age': 25, 'power': 'mother of dragons is fire proof', 'weakness': 'john snow knows nothing' }
@@ -14,12 +14,12 @@ describe('call function in 2nd object (if possible) using the corresponding valu | |||
}) | |||
|
|||
it('should return new object', () => { | |||
const result = solution({ 'name': 'pikachu', 'age': '59', 'power': 10, 'color': 'red' }, { 'name': (e) => { return 'Raichu' }, 'power': (num) => 1000 }) | |||
expect(result).toEqual({ 'name': 'Raichu', 'age': '59', 'power': 1000, 'color': 'red' }) | |||
const result = solution({ 'name': 'pikachu', 'age': '59', 'power': 10, 'color': 'red' }, { 'name': (e) => { return e + 'Raichu' }, 'power': (num) => num * num }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since you are changing the tests, could you help me format the object so its easier to read? Right now its all in one line and it is difficult to read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just showing an example. I believe Paul already wrote the appropriate tests for this challenge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I closed his PR so I can merge in yours (this one). Please make this PR the best PR you can make so we can merge this in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
solution({
name: 'ffgff',
age: '1213'
...
})
Solution that passes the test
|
This issue has been fixed |
These tests DO NOT do what the challenge is asking. If you read the challenge description for js3/5.js then it:
Here are some examples:
const case1 = solution ({
"name": "drake",
"age": "33",
"power": 'finessing',
"color": "platinum"
}, {
"name": (e) => { return e + "kendrick" },
"power": (e) => { return "motivating" + e }
});
// will return :
const result1 = {
"name": "drakekendrick",
"age": "33",
"power": "motivatingfinessing",
"color": "platinum"
}
const case2 = solution({
"add2": "5",
"sub2": "10",
"div2": "6",
"mult2": "4"
}, {
"add2": (num) => { return num + " + 2"},
"mult2": (num) => { return "2 * " + num}
})
const result2 = {
"add2": "5 + 2",
"sub2": "10",
"div2": "6",
"mult2": "2 * 4"
}
const case3 = solution({}, { 'white': () => { return 'walkers' } })
const result3 = {}
const case4 = solution({
'name': 'pikachu',
'age': '59',
'power': 10,
'color': 'red'
}, {
'name': (e) => { return 'Raichu' },
'power': (num) => { return num * num }
})
const result4 = {
'name': 'Raichu',
'age': '59',
'power': 100,
'color': 'red'
}
const case5 = solution({
'name': 'khaleesi',
'age': 25,
'power': 'mother of dragons',
'weakness': 'john snow'
}, {
'weakness': (e) => { return e + ' knows nothing' },
'power': (e) => { return e + ' is fire proof' }
})
const result5 = {
'name': 'khaleesi',
'age': 25,
'power': 'mother of dragons is fire proof',
'weakness': 'john snow knows nothing'
}