From f61b7b7d777060bd03ca63c06c22adc98adbdead Mon Sep 17 00:00:00 2001 From: Valery Malyshev Date: Thu, 1 Feb 2024 18:41:53 +0300 Subject: [PATCH] Multiply --- 8kyu/Add Length/task.test.js | 2 +- 8kyu/Filter out the geese/task.test.js | 4 ++-- 8kyu/Grasshopper - Summation/task.test.js | 2 +- 8kyu/Invert values/task.test.js | 4 ++-- 8kyu/Multiply/README.md | 5 +++++ 8kyu/Multiply/index.js | 3 +++ 8kyu/Multiply/task.test.js | 10 ++++++++++ 8kyu/The Feast of Many Beasts/task.test.js | 2 +- 8 files changed, 25 insertions(+), 7 deletions(-) create mode 100644 8kyu/Multiply/README.md create mode 100644 8kyu/Multiply/index.js create mode 100644 8kyu/Multiply/task.test.js diff --git a/8kyu/Add Length/task.test.js b/8kyu/Add Length/task.test.js index 755f0fb..a23c320 100644 --- a/8kyu/Add Length/task.test.js +++ b/8kyu/Add Length/task.test.js @@ -1,5 +1,5 @@ describe('Tests', () => { - it('test', () => { + it('addLength', () => { expect(addLength('apple ban')).toEqual(['apple 5', 'ban 3']); expect(addLength('you will win')).toEqual(['you 3', 'will 4', 'win 3']); }); diff --git a/8kyu/Filter out the geese/task.test.js b/8kyu/Filter out the geese/task.test.js index e9a4e37..a086c5e 100644 --- a/8kyu/Filter out the geese/task.test.js +++ b/8kyu/Filter out the geese/task.test.js @@ -1,5 +1,5 @@ -describe('Basic tests', function () { - it('Mixed list', function () { +describe('Tests', function () { + it('gooseFilter', function () { expect(gooseFilter(['Mallard', 'Hook Bill', 'African', 'Crested', 'Pilgrim', 'Toulouse', 'Blue Swedish'])). toEqual(['Mallard', 'Hook Bill', 'Crested', 'Blue Swedish']); }); diff --git a/8kyu/Grasshopper - Summation/task.test.js b/8kyu/Grasshopper - Summation/task.test.js index 69a0264..35a6707 100644 --- a/8kyu/Grasshopper - Summation/task.test.js +++ b/8kyu/Grasshopper - Summation/task.test.js @@ -1,5 +1,5 @@ describe('Tests', () => { - it('should return the correct total', function () { + it('summation', function () { expect(summation(1)).toBe(1); expect(summation(2)).toBe(3); expect(summation(8)).toBe(36); diff --git a/8kyu/Invert values/task.test.js b/8kyu/Invert values/task.test.js index f6c3bf3..73c7be9 100644 --- a/8kyu/Invert values/task.test.js +++ b/8kyu/Invert values/task.test.js @@ -1,5 +1,5 @@ -describe("Invert array values", () => { - it("Basic Tests", () => { +describe("Tests", () => { + it("invert", () => { expect(invert([1, 2, 3, 4, 5])).toEqual([-1, -2, -3, -4, -5]); expect(invert([1, -2, 3, -4, 5])).toEqual([-1, 2, -3, 4, -5]); expect(invert([])).toEqual([]); diff --git a/8kyu/Multiply/README.md b/8kyu/Multiply/README.md new file mode 100644 index 0000000..651fd95 --- /dev/null +++ b/8kyu/Multiply/README.md @@ -0,0 +1,5 @@ +## Multiply + +https://www.codewars.com/kata/50654ddff44f800200000004 + +This code does not execute properly. Try to figure out why. diff --git a/8kyu/Multiply/index.js b/8kyu/Multiply/index.js new file mode 100644 index 0000000..67588ee --- /dev/null +++ b/8kyu/Multiply/index.js @@ -0,0 +1,3 @@ +function multiply($a, $b) { + return $a * $b; +} diff --git a/8kyu/Multiply/task.test.js b/8kyu/Multiply/task.test.js new file mode 100644 index 0000000..18321c1 --- /dev/null +++ b/8kyu/Multiply/task.test.js @@ -0,0 +1,10 @@ +describe('Tests', () => { + it('multiply', () => { + expect(multiply(1, 1)).toBe(1); + expect(multiply(2, 3)).toBe(6); + expect(multiply(3, 5)).toBe(15); + expect(multiply(5, 0)).toBe(0); + expect(multiply(0, 5)).toBe(0); + expect(multiply(0, 0)).toBe(0); + }); +}); diff --git a/8kyu/The Feast of Many Beasts/task.test.js b/8kyu/The Feast of Many Beasts/task.test.js index 0232b06..7701c6e 100644 --- a/8kyu/The Feast of Many Beasts/task.test.js +++ b/8kyu/The Feast of Many Beasts/task.test.js @@ -1,5 +1,5 @@ describe('Tests', () => { - it('example', () => { + it('feast', () => { expect(feast("great blue heron", "garlic naan")).toBe(true); expect(feast("chickadee", "chocolate cake")).toBe(true); expect(feast("brown bear", "bear claw")).toBe(false);