mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-03-26 08:01:08 -04:00
fix(client): store challenge panes sizes (#42519)
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
15
client/src/utils/is-contained.test.ts
Normal file
15
client/src/utils/is-contained.test.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { isContained } from './is-contained';
|
||||
|
||||
describe('client/src isContained', () => {
|
||||
it('returns true if `arr1` values are contained in `arr2`', () => {
|
||||
const arr1 = ['dog', 'cat'];
|
||||
const arr2 = ['cat', 'dog'];
|
||||
expect(isContained(arr1, arr2)).toEqual(true);
|
||||
});
|
||||
|
||||
it('returns true if `arr1` values are not contained in `arr2`', () => {
|
||||
const arr1 = ['dog', 'cat'];
|
||||
const arr2 = ['cat', 'monkey', 'bird'];
|
||||
expect(isContained(arr1, arr2)).toEqual(false);
|
||||
});
|
||||
});
|
||||
4
client/src/utils/is-contained.ts
Normal file
4
client/src/utils/is-contained.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
// Performs a check if the items in `value` exist in `other`
|
||||
export function isContained(value: string[], other: string[]): boolean {
|
||||
return value.every(i => other.includes(i));
|
||||
}
|
||||
Reference in New Issue
Block a user