move away from ehemer to resolve recursive loop.
This commit is contained in:
@ -4,21 +4,20 @@ import { Product } from "../product";
|
||||
describe("Product tests", () => {
|
||||
|
||||
it(`Length product gives correct price for a shorter length`, () => {
|
||||
const standard = new Product(20, length("foot", 4));
|
||||
const comparison = standard.priceFor(length("foot", 2));
|
||||
const standard = new Product(20, { l: 4, u: "feet" });
|
||||
const comparison = standard.priceFor({ l: 2, u: "feet" });
|
||||
expect(comparison).toEqual(10);
|
||||
});
|
||||
|
||||
it(`Length product gives correct price for a longer length`, () => {
|
||||
const standard = new Product(20, length("foot", 4));
|
||||
const comparison = standard.priceFor(length("foot", 8));
|
||||
const standard = new Product(20, {l: 4, u : "feet"});
|
||||
const comparison = standard.priceFor({l : 8, u : "feet"});
|
||||
expect(comparison).toEqual(40);
|
||||
});
|
||||
|
||||
it(`Length product gives correct price if different units`, () => {
|
||||
const standard = new Product(10, length("foot", 1));
|
||||
const comparison = standard.priceFor(length("inch", 24));
|
||||
expect(comparison).toEqual(20);
|
||||
const standard = new Product(10, {l: 1, u : "feet"});
|
||||
const comparison = standard.priceFor({l : 24, u: "inch"});
|
||||
expect(comparison).toBeCloseTo(20, 4);
|
||||
});
|
||||
|
||||
});
|
Reference in New Issue
Block a user