got store working. now working on product-dimension switcher.
This commit is contained in:
24
lib/__tests__/product-test.ts
Normal file
24
lib/__tests__/product-test.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import { length } from "enheter";
|
||||
import { AreaProduct, LengthProduct, price } from "../product";
|
||||
|
||||
describe("Product tests", () => {
|
||||
|
||||
it(`Length product gives correct price for a shorter length`, () => {
|
||||
const standard = new LengthProduct(price("USD", 20), length("foot", 4));
|
||||
const comparison = standard.priceFor(length("foot", 2));
|
||||
expect(comparison.value).toEqual(10);
|
||||
});
|
||||
|
||||
it(`Length product gives correct price for a longer length`, () => {
|
||||
const standard = new LengthProduct(price("USD", 20), length("foot", 4));
|
||||
const comparison = standard.priceFor(length("foot", 8));
|
||||
expect(comparison.value).toEqual(40);
|
||||
});
|
||||
|
||||
it(`Length product gives correct price if different units`, () => {
|
||||
const standard = new LengthProduct(price("USD", 10), length("foot", 1));
|
||||
const comparison = standard.priceFor(length("inch", 24));
|
||||
expect(comparison.value).toEqual(20);
|
||||
});
|
||||
|
||||
});
|
Reference in New Issue
Block a user