I am not sure why I am failing tests here, can anyone shed some light? I am also not seeing the correct file show up in DevTools sources, so I am thinking that might have something to do with it, but I am not entirely sure.
cleanObject.test.js
const cleanObject = object => {
for (let prop in object) {
if (
object[prop] === null ||
object[prop] === undefined ||
object[prop] === ""
) {
delete obj[prop];
}
}
};
describe("cleanObject", () => {
it("removes null, undefined, and empty string values", () => {
const dirty = {
a: "",
b: undefined,
c: null,
d: "value",
e: false
};
const clean = cleanObject(dirty);
expect(clean).to.deep.equal({
d: "value",
e: false
});
});
});
cleanObject.test.js in DevTools Sources
/**
* Take an object and remove null, empty, or undefined values.
*
* @param {Object} object
* @returns {Object}
*/
const cleanObject = (object) => {
// complete the function
};
describe('cleanObject', () => {
it('removes null, undefined, and empty string values', () => {
const dirty = {
a: '',
b: undefined,
c: null,
d: 'value',
e: false,
};
const clean = cleanObject(dirty);
expect(clean).to.deep.equal({
d: 'value',
e: false,
});
});
});
It seems the file is not being sent over to the browser. Can anyone see where I may be going wrong here?