test(models/domain): test instantiation

This commit is contained in:
2026-01-17 22:46:53 -03:00
parent 4c51822bf0
commit af84abe3f8
5 changed files with 63 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
import { Chain } from './Chain';
describe('Chain', () => {
it('should create', () => {
expect(new Chain('mock', 'mock.jpg', 1)).toBeTruthy();
});
});

View 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();
});
});

View File

@@ -0,0 +1,7 @@
import { Product } from './Product';
describe('Product', () => {
it('should create', () => {
expect(new Product('1212121121', 'Mock Product', 'product.png', 1)).toBeTruthy();
});
});

View 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,
),
);
});
});

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