Ad
  • Custom User Avatar

    Not an issue

  • Custom User Avatar

    hey, didn't expect a solution like that

  • Custom User Avatar

    Too many final tests. I don't think it requires 30.

  • Custom User Avatar

    I am not sure what test case I am failing. I am able to pass all of the My Test cases, but when I submit I get:
    Test Passed
    Test Passed
    Value is not what was expected
    2 Passed
    1 Failed
    0 Errors
    Process took 51ms to complete

    If someone could point me to what test case I am failing that would be great.
    Here are my test cases:
    //Some garbage data
    var data = {
    foo: "dynamic",
    bar: {
    baz: ["dynamic"]
    },
    dynamic: true
    };

    //Your solution
    var result = solution(data, "static");

    //Expect the values to have been changed
    Test.expect(result.foo === "static");
    Test.expect(result.bar.baz[0] === "static");

    //None of this nonsense
    //JSON.parse(JSON.Stringify(data).replace(/dynamic/g, "static"))
    Test.expect(result.hasOwnProperty("dynamic"));
    Test.expect(!result.hasOwnProperty("static"));

    //Return the original object
    Test.expect(result === data);

    Test.assertEquals(solution('dynamic', 'x'), 'dynamic');
    Test.assertSimilar(solution({ foo: 'not dynamic'}, 'static'), { foo: 'not dynamic' });