diff --git a/src/app/models/Chain.spec.ts b/src/app/models/Chain.spec.ts new file mode 100644 index 0000000..b1ac93e --- /dev/null +++ b/src/app/models/Chain.spec.ts @@ -0,0 +1,7 @@ +import { Chain } from './Chain'; + +describe('Chain', () => { + it('should create', () => { + expect(new Chain('mock', 'mock.jpg', 1)).toBeTruthy(); + }); +}); diff --git a/src/app/models/Establishment.spec.ts b/src/app/models/Establishment.spec.ts new file mode 100644 index 0000000..12379bc --- /dev/null +++ b/src/app/models/Establishment.spec.ts @@ -0,0 +1,8 @@ +import { Chain } from './Chain'; +import { Establishment } from './Establishment'; + +describe('Establishment', () => { + it('should create', () => { + expect(new Establishment(new Chain('mock', 'mock.jpg', 1), 'Mock street', 1)).toBeTruthy(); + }); +}); diff --git a/src/app/models/Product.spec.ts b/src/app/models/Product.spec.ts new file mode 100644 index 0000000..42f8124 --- /dev/null +++ b/src/app/models/Product.spec.ts @@ -0,0 +1,7 @@ +import { Product } from './Product'; + +describe('Product', () => { + it('should create', () => { + expect(new Product('1212121121', 'Mock Product', 'product.png', 1)).toBeTruthy(); + }); +}); diff --git a/src/app/models/ProductEstablisment.spec.ts b/src/app/models/ProductEstablisment.spec.ts new file mode 100644 index 0000000..63017b0 --- /dev/null +++ b/src/app/models/ProductEstablisment.spec.ts @@ -0,0 +1,16 @@ +import { Chain } from './Chain'; +import { Establishment } from './Establishment'; +import { Product } from './Product'; +import { ProductEstablishment } from './ProductEstablisment'; + +describe('ProductEstablishment', () => { + it('should create', () => { + expect( + new ProductEstablishment( + new Product('12121212', 'mock product', 'mock.jpg', 1), + new Establishment(new Chain('mock', 'mock', 1)), + 1, + ), + ); + }); +}); diff --git a/src/app/models/Purchase.spec.ts b/src/app/models/Purchase.spec.ts new file mode 100644 index 0000000..d8d748a --- /dev/null +++ b/src/app/models/Purchase.spec.ts @@ -0,0 +1,25 @@ +import { Chain } from './Chain'; +import { Establishment } from './Establishment'; +import { Product } from './Product'; +import { Purchase } from './Purchase'; + +describe('Purchase', () => { + let purchase: Purchase; + beforeEach(() => { + purchase = new Purchase( + new Establishment(new Chain('mock', 'image_mock.png', 1), 'mock street', 1), + new Product('121212121221', 'mock product', 'image_mock.png', 1), + 1254.51, + ) + }); + + it('should create', () => { + expect(purchase).toBeTruthy(); + }); + + it('should divide by 100 on price get and multiply by 100 on set', () => { + const PRICE_MOCK = 1475.56; + purchase.price = PRICE_MOCK; + expect(purchase.price).toBe(PRICE_MOCK); + }); +});