test(models/domain): test instantiation
This commit is contained in:
7
src/app/models/Chain.spec.ts
Normal file
7
src/app/models/Chain.spec.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import { Chain } from './Chain';
|
||||||
|
|
||||||
|
describe('Chain', () => {
|
||||||
|
it('should create', () => {
|
||||||
|
expect(new Chain('mock', 'mock.jpg', 1)).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
8
src/app/models/Establishment.spec.ts
Normal file
8
src/app/models/Establishment.spec.ts
Normal file
@@ -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();
|
||||||
|
});
|
||||||
|
});
|
||||||
7
src/app/models/Product.spec.ts
Normal file
7
src/app/models/Product.spec.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import { Product } from './Product';
|
||||||
|
|
||||||
|
describe('Product', () => {
|
||||||
|
it('should create', () => {
|
||||||
|
expect(new Product('1212121121', 'Mock Product', 'product.png', 1)).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
16
src/app/models/ProductEstablisment.spec.ts
Normal file
16
src/app/models/ProductEstablisment.spec.ts
Normal file
@@ -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,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
25
src/app/models/Purchase.spec.ts
Normal file
25
src/app/models/Purchase.spec.ts
Normal file
@@ -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);
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user