WIP server side.

This commit is contained in:
Ahmed Bouhuolia
2020-01-22 02:09:45 +02:00
parent de905d7e7c
commit 488709088b
123 changed files with 14885 additions and 771 deletions

View File

@@ -9,8 +9,8 @@ describe('Model: Item', () => {
const category = await create('item_category');
const item = await create('item', { category_id: category.id });
const itemModel = await Item.where('id', item.id).fetch();
const itemCategoryModel = await itemModel.category().fetch();
const itemModel = await Item.query().where('id', item.id);
const itemCategoryModel = await itemModel.$relatedQuery('category');
expect(itemCategoryModel.attributes.id).equals(category.id);
});
@@ -20,8 +20,8 @@ describe('Model: Item', () => {
await create('item_metadata', { item_id: item.id });
await create('item_metadata', { item_id: item.id });
const itemModel = await Item.where('id', item.id).fetch();
const itemMetadataCollection = await itemModel.metadata().fetch();
const itemModel = await Item.query().where('id', item.id);
const itemMetadataCollection = await itemModel.$relatedQuery('metadata');
expect(itemMetadataCollection.length).equals(2);
});