Port tests to vitest

This commit is contained in:
Pieter Vander Vennet 2023-02-03 04:48:32 +01:00
parent 64a4d7e929
commit 228ceb120d
33 changed files with 673 additions and 326 deletions

View file

@ -1,7 +1,6 @@
import { describe } from "mocha"
import { expect } from "chai"
import { Unit } from "../../Models/Unit"
import { Denomination } from "../../Models/Denomination"
import { describe, expect, it } from "vitest"
describe("Unit", () => {
it("should convert a value back and forth", () => {
@ -19,10 +18,10 @@ describe("Unit", () => {
)
const canonical = denomintion.canonicalValue("5", true)
expect(canonical).eq("5 MW")
expect(canonical).toBe("5 MW")
const units = new Unit(["key"], [denomintion], false)
const [detected, detectedDenom] = units.findDenomination("5 MW", () => "be")
expect(detected).eq("5")
expect(detectedDenom).eq(denomintion)
expect(detected).toBe("5")
expect(detectedDenom).toBe(denomintion)
})
})