challenge-algorithms-v2.0-G.../10-longestWords/index.test.js

48 lines
1.4 KiB
JavaScript
Raw Normal View History

2022-10-28 10:17:46 +00:00
import { longestWords } from ".";
2022-10-28 10:17:46 +00:00
describe("longestWords", () => {
it('Dever retornar ["melancia"] quando passamos a lista ["abacaxi", "melancia", "banana"]', () => {
expect(longestWords(["abacaxi", "melancia", "banana"])).toEqual([
"melancia",
]);
});
2022-10-28 10:17:46 +00:00
it('Dever retornar ["aba","vcd", "aba"] quando passamos a lista ["aba", "aa", "ad", "vcd", "aba"]', () => {
expect(longestWords(["aba", "aa", "ad", "vcd", "aba"])).toEqual([
"aba",
"vcd",
"aba",
]);
});
2022-10-28 10:17:46 +00:00
it('Dever retornar ["aa"] quando passamos a lista ["aa"]', () => {
expect(longestWords(["aa"])).toEqual(["aa"]);
});
2022-10-28 10:17:46 +00:00
it('Dever retornar ["eeee", "abcd"] quando passamos a lista ["abc", "eeee", "abcd", "dcd"]', () => {
expect(longestWords(["abc", "eeee", "abcd", "dcd"])).toEqual([
"eeee",
"abcd",
]);
});
2022-10-28 10:17:46 +00:00
it('Dever retornar ["aa", "bb", "cc"] quando passamos a lista ["aa", "bb", "cc"]', () => {
expect(longestWords(["aa", "bb", "cc"])).toEqual(["aa", "bb", "cc"]);
});
2022-10-28 10:17:46 +00:00
it('Dever retornar ["zzzzzz", "abcdef", "aaaaaa"] quando passamos a lista ["a", "abc", "cbd", "zzzzzz", "a", "abcdef", "asasa", "aaaaaa"]', () => {
expect(
longestWords([
"a",
"abc",
"cbd",
"zzzzzz",
"a",
"abcdef",
"asasa",
"aaaaaa",
])
).toEqual(["zzzzzz", "abcdef", "aaaaaa"]);
});
});