( a: Array<unknown> | string, b: Array<unknown> | string, expected: Array<unknown>, )
| 237 | |
| 238 | // Assert that array-like objects have the expected common items. |
| 239 | const expectCommonItems = ( |
| 240 | a: Array<unknown> | string, |
| 241 | b: Array<unknown> | string, |
| 242 | expected: Array<unknown>, |
| 243 | ) => { |
| 244 | expect(findCommonItems(a, b)).toEqual(expected); |
| 245 | |
| 246 | if (a.length !== b.length) { |
| 247 | // If sequences a and b have different lengths, |
| 248 | // then if you swap sequences in your callback functions, |
| 249 | // this package finds the same items. |
| 250 | expect(findCommonItems(b, a)).toEqual(expected); |
| 251 | } |
| 252 | }; |
| 253 | |
| 254 | describe('input callback encapsulates sequences', () => { |
| 255 | // Example sequences in “edit graph” analogy from |
no test coverage detected