v1
- by enrcio 1/31/202200
Setup HTML - click to add setup HTML
disable setup JavaScript
Setup JavaScript
const obj = {
    name: undefined,
  age: 15,
  school: 'Some school'
}
delete caserun single casemove downdrag and drop case


ready



hasOnly = (obj,props) => {
	var objProps = Object.keys(obj)
	return objProps.length == props.length && props.every(p => objProps.includes(p))
};
hasOnly(obj,['name','age']) //return false
hasOnly(obj,['name','age','city']) //return false
hasOnly(obj,['name','age','school']) //return true
delete caserun single casemove updrag and drop case


ready



const size = x => x.length;
const keys = x => Object.keys(x);
const every = (x, y) => y.every(x);
const includes = x => y => x.includes(y);
hasOnly = (obj,props) => {
    const objProps = keys(obj)
    return size(objProps) == size(props) && every(includes(objProps), props);
};
hasOnly(obj,['name','age']) //return false
hasOnly(obj,['name','age','city']) //return false
hasOnly(obj,['name','age','school']) //return true
Test Case - click to add another test case
Teardown JS - click to add teardown JavaScript
Output (DOM) - click to monitor output (DOM) while test is running
RUN