Skip to content

Commit

Permalink
test: πŸ’ add capacity test
Browse files Browse the repository at this point in the history
  • Loading branch information
waynewyang committed Dec 13, 2023
1 parent 89abf02 commit 87286db
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions test/test.test.ts β†’ test/capacity/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,24 @@

import assert from "assert"
import { it } from "mocha"
import { Capacity } from "../../src/capacity"

//@ts-ignore
describe("xxxx Test", () => {
it("xxxx test", async () => {
console.log("ok")
describe("Capacity Test", () => {
it("prettyBytes test(number)", async () => {
const res = new Capacity(1024 * 1024)
assert.deepStrictEqual(res.prettyBytes(), "1 MiB")
})

it("prettyBytes test(string)", async () => {
const res = new Capacity("1024")
assert.deepStrictEqual(res.prettyBytes(), "1 kiB")
})

it("plus test(string)", async () => {
const capacity1 = new Capacity("1024")
const capacity2 = new Capacity("1024")

assert.deepStrictEqual(capacity1.plus(capacity2).prettyBytes(), "2 kiB")
})
})

0 comments on commit 87286db

Please sign in to comment.