mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-13 11:20:31 +00:00
23 lines
725 B
JavaScript
23 lines
725 B
JavaScript
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);
|
|
});
|
|
});
|