From 0d212a18c53d2f4b0ef04343b7123502048e1be2 Mon Sep 17 00:00:00 2001 From: Jorge Estanislao Barsoba Date: Wed, 30 Mar 2022 12:29:06 -0300 Subject: [PATCH] test(morse-code-decoder): HackerRank scenarios 2 and 3 --- hackerrank/morse-code-decoder.test.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/hackerrank/morse-code-decoder.test.js b/hackerrank/morse-code-decoder.test.js index 6625eef..4875d2c 100644 --- a/hackerrank/morse-code-decoder.test.js +++ b/hackerrank/morse-code-decoder.test.js @@ -155,6 +155,26 @@ describe("morse code decoding", () => { }); describe("HackerRank tests, based on provided input and expected output", () => { + it("test case 2", async () => { + const data = await readFileAsync( + "./morse-code-decoder.data.raw.txt", + "utf8" + ); + const input = parseInput(data); + + expect(decode(".....--....", input.dictionary, input.context)).toBe("HATH"); + }); + + it("test case 3", async () => { + const data = await readFileAsync( + "./morse-code-decoder.data.raw.txt", + "utf8" + ); + const input = parseInput(data); + + expect(decode("--.----..", input.dictionary, input.context)).toBe("GOD"); + }); + it("test case 4", async () => { const data = await readFileAsync( "./morse-code-decoder.data.raw.txt",