Reputation: 43
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?
Upvotes: 1
Views: 242
Reputation: 480
The js
file was cached (read: HTTP Caching).
There are various ways to stop this from happening with server configurations, client-side cache busting, or just plain-old cache clearing.
When developing, often the best way to avoid this kind of issue is to "Empty Cache and Hard Reload" by right-clicking the refresh button with the dev-tools open: Read More
Upvotes: 4