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 swap nested fields', () => {
const res = arraySwap('medium', 0, 1)(fields);
expect(res['medium.0.nest.0']).toBe(fields['medium.1.nest.0']);
expect(res['medium.0.nest.1']).toBe(fields['medium.1.nest.1']);
expect(res['medium.0.nest.2']).toBe(fields['medium.1.nest.2']);
expect(res['medium.0.nest.3']).toBe(fields['medium.1.nest.3']);
expect(res['medium.1.nest.0']).toBe(fields['medium.0.nest.0']);
expect(res['medium.1.nest.1']).toBe(fields['medium.0.nest.1']);
expect(res['medium.1.nest.2']).toBe(fields['medium.0.nest.2']);
expect(res['medium.1.nest.3']).toBe(fields['medium.0.nest.3']);
});
it('should swap nested fields', () => {
const res = arraySwap('medium', 0, 1)(fields);
expect(res['medium.0.nest.0']).toBe(fields['medium.1.nest.0']);
expect(res['medium.0.nest.1']).toBe(fields['medium.1.nest.1']);
expect(res['medium.0.nest.2']).toBe(fields['medium.1.nest.2']);
expect(res['medium.0.nest.3']).toBe(fields['medium.1.nest.3']);
expect(res['medium.1.nest.0']).toBe(fields['medium.0.nest.0']);
expect(res['medium.1.nest.1']).toBe(fields['medium.0.nest.1']);
expect(res['medium.1.nest.2']).toBe(fields['medium.0.nest.2']);
expect(res['medium.1.nest.3']).toBe(fields['medium.0.nest.3']);
});