Testing Git Repository Creation and Workspace Integration in Insomnia
This test suite validates Git repository operations in the Insomnia codebase, specifically focusing on repository creation and workspace metadata linking. The tests ensure proper initialization and association of Git repositories with workspace components.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
kong/insomnia
packages/insomnia/src/models/helpers/__tests__/git-repository-operations.test.ts
import { describe, expect, it } from 'vitest';
import * as models from '../../index';
import { createGitRepository } from '../git-repository-operations';
describe('gitRepositoryOperations', () => {
describe('createGitRepository', () => {
it('should create and link to workspace meta', async () => {
const repoId = 'git_1';
const workspaceId = 'wrk_1';
await createGitRepository(workspaceId, {
_id: repoId,
});
const wMetas = await models.workspaceMeta.all();
expect(wMetas).toHaveLength(1);
const wMeta = wMetas[0];
expect(wMeta.parentId).toBe(workspaceId);
expect(wMeta.gitRepositoryId).toBe(repoId);
});
});
});