TEST(wave): add test file for wave function

This commit is contained in:
zainabdnaya 2023-10-19 08:18:31 -04:00
parent 0d9b6958a0
commit 374d5a32f5
1 changed files with 11 additions and 0 deletions

11
js/tests/wave_test.js Normal file
View File

@ -0,0 +1,11 @@
export const tests = []
const t = (f) => tests.push(f)
t(({ eq }) => eq(wave('hello'), ['Hello', 'hEllo', 'heLlo', 'helLo', 'hellO']))
t(({ eq }) => eq(wave('codewars'), ['Codewars', 'cOdewars', 'coDewars', 'codEwars', 'codeWars', 'codewArs', 'codewaRs', 'codewarS']))
t(({ eq }) => eq(wave('two words'), ['Two words', 'tWo words', 'twO words', 'two Words', 'two wOrds', 'two woRds', 'two worDs', 'two wordS']))
t(({ eq }) => eq(wave(' gap '), [' Gap ', ' gAp ', ' gaP ']))
t(({ eq }) => eq(wave(''), []))
t(({ eq }) => eq(wave('a b '), ['A b ', 'a B ']))
t(({eq}) => eq(wave('12345'), ['12345', '12345', '12345', '12345', '12345']))
Object.freeze(tests)