From a3e3383aca60a1e585b323d2bd42a1559b355d79 Mon Sep 17 00:00:00 2001 From: nbogie Date: Sat, 29 Jun 2024 11:00:23 +0100 Subject: [PATCH] add demo of chai asserts --- src/greet.test.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/greet.test.ts b/src/greet.test.ts index 6d4afde..ac86cae 100644 --- a/src/greet.test.ts +++ b/src/greet.test.ts @@ -1,6 +1,15 @@ import { greet } from "./greet"; +//docs: https://jestjs.io/docs/expect test("greet returns a string, greeting the passed name", () => { expect(greet("Zaphod")).toEqual("Hello, Zaphod"); expect(greet("Mo")).toEqual("Hello, Mo"); }); + +//docs: https://www.chaijs.com/api/assert/ +test("demonstrating chai 'assert' library", () => { + assert.equal(greet("Zaphod"), "Hello, Zaphod"); + assert.equal(greet("Mo"), "Hello, Mo"); + + assert.deepEqual({ b: [10, 20], a: 10 }, { a: 10, b: [10, 20] }); +});