TypeScript | Testing with TypeScript | Question2

Last Updated :
Discuss
Comments

Which of the following is a correct TypeScript test case?

TypeScript
import { add } from "./math";

test("should add two numbers", () => {
    const result: number = add(2, 3);
    expect(result).toBe(5);
});


TypeScript does not support the test function.

The type of result must not be explicitly declared.

This is a correct TypeScript test case using a testing framework.

TypeScript tests must use the assert method instead of expect.

Share your thoughts in the comments