mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
WIP Items module.
This commit is contained in:
16
server/tests/models/ItemCategories.test.js
Normal file
16
server/tests/models/ItemCategories.test.js
Normal file
@@ -0,0 +1,16 @@
|
||||
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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user