algorithm: reverse (#1197)

This commit is contained in:
SczSca
2022-10-20 06:38:56 -05:00
committed by GitHub
parent b07529fb6f
commit 636017ca51
2 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,13 @@
import { Reverse } from '../Reverse.js'
import each from 'jest-each'
describe('reverse elements in an array', () => {
each`
array | expected
${[]} | ${[]}
${[1]} | ${[1]}
${[1, 2, 3, 4]} | ${[4, 3, 2, 1]}
`.test('returns $expected when given $array', ({ array, expected }) => {
expect(Reverse(array)).toEqual(expected)
})
})