Skip to content

Instantly share code, notes, and snippets.

@willie-hung
Created August 2, 2023 19:05
Show Gist options
  • Save willie-hung/9d120bc0d27823baeeb9dcf8ab8c4d53 to your computer and use it in GitHub Desktop.
Save willie-hung/9d120bc0d27823baeeb9dcf8ab8c4d53 to your computer and use it in GitHub Desktop.
post_32
import sum from "./sum";
import { describe, expect, it } from "vitest";
describe("#SUM", () => {
it("should return 0 for empty array", () => {
expect(sum()).toBe(0);
});
it("should return 1 for [1]", () => {
expect(sum(1)).toBe(1);
});
it("should return sum of all numbers", () => {
expect(sum(1, 2, 3, 4, 5)).toBe(15);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment