Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should return an object of flattened components', () => {
const flattened = utils.flattenComponents(components);
for (let n = 1; n <= 8; n += 1) {
const component = flattened[writtenNumber(n)];
expect(component).not.to.be.undefined;
expect(component).to.be.an('object');
expect(component.order).to.equal(n);
expect(component.key).to.equal(writtenNumber(n));
}
});
it('should return the correct components', () => {
for (let n = 1; n <= 8; n += 1) {
const component = utils.getComponent(components, writtenNumber(n));
expect(component).not.to.be.null;
expect(component).not.to.be.undefined;
expect(component).to.be.an('object');
expect(component.order).to.equal(n);
expect(component.key).to.equal(writtenNumber(n));
}
});
it('should return an object of flattened components', () => {
const flattened = utils.flattenComponents(components);
for (let n = 1; n <= 8; n += 1) {
const component = flattened[writtenNumber(n)];
expect(component).not.to.be.undefined;
expect(component).to.be.an('object');
expect(component.order).to.equal(n);
expect(component.key).to.equal(writtenNumber(n));
}
});
it('should work with a different this context', () => {
for (let n = 1; n <= 8; n += 1) {
const component = utils.getComponent.call({}, components, writtenNumber(n));
expect(component).not.to.be.null;
expect(component).not.to.be.undefined;
expect(component).to.be.an('object');
expect(component.order).to.equal(n);
expect(component.key).to.equal(writtenNumber(n));
}
});
});