Files
bigcapital/server/tests/models/ItemCategories.test.js
Ahmed Bouhuolia 70809cb05c WIP Items module.
2019-09-03 02:07:28 +02:00

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);
});
});