mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
This implements a very simple Project Summary page (which lists workspaces):  ...which also has an empty state:  Fixes #66
18 lines
423 B
TypeScript
18 lines
423 B
TypeScript
import { firstOrItem } from "./array"
|
|
|
|
describe("array", () => {
|
|
describe("firstOrItem", () => {
|
|
it("returns null if empty array", () => {
|
|
expect(firstOrItem([])).toBeNull()
|
|
})
|
|
|
|
it("returns first item if array with more one item", () => {
|
|
expect(firstOrItem(["a", "b"])).toEqual("a")
|
|
})
|
|
|
|
it("returns item if single item", () => {
|
|
expect(firstOrItem("c")).toEqual("c")
|
|
})
|
|
})
|
|
})
|