feature #1

Merged
wellingtonCarlos merged 11 commits from feature into master 2022-11-02 18:10:07 +00:00
2 changed files with 32 additions and 8 deletions
Showing only changes of commit 7977d238da - Show all commits

View File

@ -1,4 +1,28 @@
export function isAnagram(word1, word2) { export function isAnagram(word1, word2) {
// implementar logica aqui
if (word1.length !== word2.length) {
} return false;
} else {
if (
word1.toLowerCase().split("").sort().join("") ===
word2.toLowerCase().split("").sort().join("")
) {
return true;
} else {
return false;
}
}
}

View File

@ -5,23 +5,23 @@ describe("isAnagram", () => {
expect(isAnagram("roma", "amor")).toBe(true); expect(isAnagram("roma", "amor")).toBe(true);
}); });
ít("Dever retornar true quando passamos as palavras \"Buckethead\" e \"DeathCubeK\"", () => { it("Dever retornar true quando passamos as palavras \"Buckethead\" e \"DeathCubeK\"", () => {
expect(isAnagram("Buckethead", "DeathCubeK")).toBe(true); expect(isAnagram("Buckethead", "DeathCubeK")).toBe(true);
}); });
ít("Dever retornar true quando passamos as palavras \"Twoo\" e \"WooT\"", () => { it("Dever retornar true quando passamos as palavras \"Twoo\" e \"WooT\"", () => {
expect(isAnagram("Twoo", "WooT")).toBe(true); expect(isAnagram("Twoo", "WooT")).toBe(true);
}); });
ít("Dever retornar false quando passamos as palavras \"dumble\" e \"bumble\"", () => { it("Dever retornar false quando passamos as palavras \"dumble\" e \"bumble\"", () => {
expect(isAnagram("dumble", "bumble")).toBe(false); expect(isAnagram("dumble", "bumble")).toBe(false);
}); });
ít("Dever retornar false quando passamos as palavras \"ound\" e \"round\"", () => { it("Dever retornar false quando passamos as palavras \"ound\" e \"round\"", () => {
expect(isAnagram("ound", "round")).toBe(false); expect(isAnagram("ound", "round")).toBe(false);
}); });
ít("Dever retornar false quando passamos as palavras \"apple\" e \"pale\"", () => { it("Dever retornar false quando passamos as palavras \"apple\" e \"pale\"", () => {
expect(isAnagram("apple", "pale")).toBe(false); expect(isAnagram("apple", "pale")).toBe(false);
}); });
}); });