add svg icons. running into scroll issue. will upgrade packages.
This commit is contained in:
@ -1,22 +1,47 @@
|
||||
import { Product } from "../product";
|
||||
import { Id, Product, productPriceFor } from "../product";
|
||||
import uuid from "react-native-uuid"
|
||||
|
||||
describe("Product tests", () => {
|
||||
|
||||
it(`Length product gives correct price for a shorter length`, () => {
|
||||
const standard = new Product(20, { l: 4, u: "feet" });
|
||||
const comparison = standard.priceFor({ l: 2, u: "feet" });
|
||||
expect(comparison).toEqual(10);
|
||||
const standard : Product = {
|
||||
id: uuid.v4().valueOf() as Id,
|
||||
dimensions: {
|
||||
l: 5,
|
||||
u: "ft",
|
||||
},
|
||||
type: "lumber",
|
||||
pricePerUnit: 10,
|
||||
};
|
||||
const comparison = productPriceFor(standard, { l: 2, u: "feet" });
|
||||
expect(comparison).toEqual(4);
|
||||
});
|
||||
|
||||
it(`Length product gives correct price for a longer length`, () => {
|
||||
const standard = new Product(20, {l: 4, u : "feet"});
|
||||
const comparison = standard.priceFor({l : 8, u : "feet"});
|
||||
expect(comparison).toEqual(40);
|
||||
const standard : Product = {
|
||||
id: uuid.v4().valueOf() as Id,
|
||||
dimensions: {
|
||||
l: 5,
|
||||
u: "ft",
|
||||
},
|
||||
type: "lumber",
|
||||
pricePerUnit: 10,
|
||||
};
|
||||
const comparison = productPriceFor(standard, { l: 10, u: "feet" });
|
||||
expect(comparison).toEqual(20);
|
||||
});
|
||||
|
||||
it(`Length product gives correct price if different units`, () => {
|
||||
const standard = new Product(10, {l: 1, u : "feet"});
|
||||
const comparison = standard.priceFor({l : 24, u: "inch"});
|
||||
expect(comparison).toBeCloseTo(20, 4);
|
||||
const standard : Product = {
|
||||
id: uuid.v4().valueOf() as Id,
|
||||
dimensions: {
|
||||
l: 12,
|
||||
u: "in",
|
||||
},
|
||||
type: "lumber",
|
||||
pricePerUnit: 1,
|
||||
};
|
||||
const comparison = productPriceFor(standard, { l: 2, u: "feet" });
|
||||
expect(comparison).toBeCloseTo(2, 1);
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user