forked from MapComplete/MapComplete
Reformat all files with prettier
This commit is contained in:
parent
e22d189376
commit
b541d3eab4
382 changed files with 50893 additions and 35566 deletions
|
@ -1,29 +1,27 @@
|
|||
import {describe} from 'mocha'
|
||||
import {expect} from 'chai'
|
||||
import {Unit} from "../../Models/Unit";
|
||||
import {Denomination} from "../../Models/Denomination";
|
||||
import { describe } from "mocha"
|
||||
import { expect } from "chai"
|
||||
import { Unit } from "../../Models/Unit"
|
||||
import { Denomination } from "../../Models/Denomination"
|
||||
|
||||
describe("Unit", () => {
|
||||
|
||||
it("should convert a value back and forth", () => {
|
||||
|
||||
const denomintion = new Denomination({
|
||||
"canonicalDenomination": "MW",
|
||||
"alternativeDenomination": ["megawatts", "megawatt"],
|
||||
"human": {
|
||||
"en": " megawatts",
|
||||
"nl": " megawatt"
|
||||
it("should convert a value back and forth", () => {
|
||||
const denomintion = new Denomination(
|
||||
{
|
||||
canonicalDenomination: "MW",
|
||||
alternativeDenomination: ["megawatts", "megawatt"],
|
||||
human: {
|
||||
en: " megawatts",
|
||||
nl: " megawatt",
|
||||
},
|
||||
}, "test");
|
||||
},
|
||||
"test"
|
||||
)
|
||||
|
||||
const canonical = denomintion.canonicalValue("5", true)
|
||||
expect(canonical).eq( "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)
|
||||
}
|
||||
)
|
||||
const canonical = denomintion.canonicalValue("5", true)
|
||||
expect(canonical).eq("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)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue