add server to monorepo.

This commit is contained in:
a.bouhuolia
2023-02-03 11:57:50 +02:00
parent 28e309981b
commit 80b97b5fdc
1303 changed files with 137049 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import { create, expect } from '~/testInit';
import Item from 'models/Item';
// eslint-disable-next-line no-unused-vars
import itemCategory from 'models/ItemCategory';
import {
tenantWebsite,
tenantFactory,
loginRes
} from '~/dbInit';
describe('Model: Item', () => {
it('Should item model belongs to the associated category model.', async () => {
const category = await tenantFactory.create('item_category');
const item = await tenantFactory.create('item', { category_id: category.id });
const itemModel = await Item.tenant().query().where('id', item.id).first();
const itemCategoryModel = await itemModel.$relatedQuery('category');
expect(itemCategoryModel.id).equals(category.id);
});
});