add svg icons. running into scroll issue. will upgrade packages.

This commit is contained in:
Jordan
2024-08-15 14:07:19 -07:00
parent a463189052
commit dc7f4b25a9
38 changed files with 3272 additions and 2097 deletions

View File

@ -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);
});
});