import 'reflect-metadata'; import {CategorizationController} from '../src/controllers/CategorizationController'; import { product1 } from './productMock'; let categorizationController: CategorizationController; // eslint-disable-next-line @typescript-eslint/require-await beforeAll(async () => { categorizationController = new CategorizationController(); }); describe('Categorization Controller', () => { it('Categorization by sku and breadcrumb OK', async () => { expect( await categorizationController.doCategorization(product1, 'mcy', 'UY') ).toEqual('Apparel & Accessories > Clothing > Wedding & Bridal Party Dresses > Wedding Dresses'); }); it('Categorization by breadcrumb OK', async () => { expect( await categorizationController.doCategorization(product1, 'ebay', 'UY') ).toEqual('Other'); }); it('Categorization by keyword OK', async () => { expect( await categorizationController.doCategorization(product1, 'amz', 'UY') ).toEqual('Apparel & Accessories > Jewelry'); }); it('Categorization vendor not exist', async () => { expect.assertions(2); try { await categorizationController.doCategorization(product1, 'amzsds', 'UY'); } catch (e) { expect(e).toBeInstanceOf(Error); expect(e).toHaveProperty('message', 'Vendor does not exist in our database'); } }); });