mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 04:10:32 +00:00
17 lines
599 B
JavaScript
17 lines
599 B
JavaScript
import { create, expect } from '~/testInit';
|
|
import '@/models/Item';
|
|
import ItemCategory from '@/models/ItemCategory';
|
|
|
|
describe('Model: ItemCategories', () => {
|
|
it('Shoud item category model has many associated items.', async () => {
|
|
const category = await create('item_category');
|
|
await create('item', { category_id: category.id });
|
|
await create('item', { category_id: category.id });
|
|
|
|
const categoryModel = await ItemCategory.where('id', category.id).fetch();
|
|
const categoryItems = await categoryModel.items().fetch();
|
|
|
|
expect(categoryItems.length).equals(2);
|
|
});
|
|
});
|