46 lines
1.5 KiB
TypeScript
46 lines
1.5 KiB
TypeScript
![]() |
import { expect } from "chai";
|
||
|
|
||
|
import { Formatter } from "export/formatter";
|
||
|
|
||
|
import { MathDenominator } from "./math-denominator";
|
||
|
import { MathFraction } from "./math-fraction";
|
||
|
import { MathNumerator } from "./math-numerator";
|
||
|
|
||
|
describe("MathFraction", () => {
|
||
|
describe("#constructor()", () => {
|
||
|
it("should create a MathFraction with correct root key", () => {
|
||
|
const mathFraction = new MathFraction({
|
||
|
numerator: new MathNumerator("2"),
|
||
|
denominator: new MathDenominator("2"),
|
||
|
});
|
||
|
const tree = new Formatter().format(mathFraction);
|
||
|
expect(tree).to.deep.equal({
|
||
|
"m:f": [
|
||
|
{
|
||
|
"m:num": [
|
||
|
{
|
||
|
"m:r": [
|
||
|
{
|
||
|
"m:t": ["2"],
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
{
|
||
|
"m:den": [
|
||
|
{
|
||
|
"m:r": [
|
||
|
{
|
||
|
"m:t": ["2"],
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
],
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
});
|