From 97522013f3ea96e9e80ff082f26fd846863ac4a3 Mon Sep 17 00:00:00 2001 From: OMGiTzPomPom Date: Fri, 29 Mar 2024 12:01:00 +0100 Subject: [PATCH] template --- src/exercises/Template/index.test.ts | 32 ++++++++++++++++++++++++++++ src/exercises/Template/index.ts | 10 +++++++++ 2 files changed, 42 insertions(+) create mode 100644 src/exercises/Template/index.test.ts create mode 100644 src/exercises/Template/index.ts diff --git a/src/exercises/Template/index.test.ts b/src/exercises/Template/index.test.ts new file mode 100644 index 0000000..0b2f38e --- /dev/null +++ b/src/exercises/Template/index.test.ts @@ -0,0 +1,32 @@ +import { divide } from "./index"; + +describe("Test divide", () => { + it.each([ + { foo: "", bar: "", expected: "" }, + ])( + "should $foo $bar", + ({ foo, bar, expected }) => { + // act + // const result = function (foo, bar); + const result = 0; + // assert + expect(result).toEqual(expected); + console.log(`Test with foo = ${foo}, bar = ${bar}, expected = ${expected}, result = ${result}`); + } + ); + + /* + * + * If exception test + * + * */ + it("should throw an exception when dividing by zero", () => { + // arrange + const foo = ""; + const bar = ""; + // act & assert + ///TODO + // expect(() => function (foo, bar).toThrow("E"); + console.log(foo + bar); + }); +}); \ No newline at end of file diff --git a/src/exercises/Template/index.ts b/src/exercises/Template/index.ts new file mode 100644 index 0000000..815e8a5 --- /dev/null +++ b/src/exercises/Template/index.ts @@ -0,0 +1,10 @@ +async function start() { + console.log("Application starts..."); + + console.log("Application ends..."); +} + +start(); +export function name(foo : number) : number { + return foo + 1; +}