Full tests coverage
This commit is contained in:
parent
99134d8556
commit
02d782c3da
157 changed files with 1074 additions and 34670 deletions
|
|
@ -1,32 +0,0 @@
|
|||
import { describe, it, expect } from 'vitest';
|
||||
import { ProductModel } from '../../src/schemas/product.schema.js';
|
||||
|
||||
describe(ProductModel.name, () => {
|
||||
it('is a valid mongoose model', () => {
|
||||
expect(ProductModel.modelName).toBe('Product');
|
||||
});
|
||||
|
||||
it('has expected schema paths', () => {
|
||||
const paths = Object.keys(ProductModel.schema.paths);
|
||||
expect(paths).toContain('householdId');
|
||||
expect(paths).toContain('name');
|
||||
expect(paths).toContain('category');
|
||||
expect(paths).toContain('servingSize');
|
||||
expect(paths).toContain('servingUnit');
|
||||
expect(paths).toContain('nutrition');
|
||||
expect(paths).toContain('tags');
|
||||
expect(paths).toContain('source');
|
||||
expect(paths).toContain('createdBy');
|
||||
expect(paths).toContain('deletedAt');
|
||||
expect(paths).toContain('createdAt');
|
||||
expect(paths).toContain('updatedAt');
|
||||
});
|
||||
|
||||
it('has expected indexes defined', () => {
|
||||
const indexes = ProductModel.schema.indexes();
|
||||
const indexKeys = indexes.map(([key]) => Object.keys(key).join(','));
|
||||
expect(indexKeys).toContain('householdId,name,brand,tags');
|
||||
expect(indexKeys).toContain('householdId,deletedAt,category');
|
||||
expect(indexKeys).toContain('householdId,barcode');
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue