Validating RequestMeta Model Creation in Insomnia
This test suite validates the request metadata creation functionality in Insomnia’s data model layer. It focuses on error handling and validation of the RequestMeta model, ensuring proper parent-child relationships and data integrity.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
kong/insomnia
packages/insomnia/src/models/__tests__/request-meta.test.ts
import { describe, expect, it } from 'vitest';
import * as models from '../index';
describe('create()', () => {
it('fails when missing parentId', async () => {
expect(() =>
models.requestMeta.create({
pinned: true,
}),
).toThrow('New RequestMeta missing `parentId`');
}); // it('fails when parentId prefix is not that of a Request', async () => {
// expect(() => models.requestMeta.create({ parentId: 'greq_123' })).toThrow(
// 'Expected the parent of RequestMeta to be a Request',
// );
// });
});