Skip to content

Commit

Permalink
add demo of chai asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
nbogie committed Jun 29, 2024
1 parent dd62296 commit a3e3383
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/greet.test.ts
Original file line number Diff line number Diff line change
@@ -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] });
});

0 comments on commit a3e3383

Please sign in to comment.