Testing Workspace Label Assignment in Insomnia
This test suite validates the workspace label functionality in Insomnia, focusing on the getWorkspaceLabel utility. It ensures correct label assignment for different workspace scopes, specifically testing document and collection labels.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
kong/insomnia
packages/insomnia/src/common/__tests__/strings.test.ts
import { describe, expect, it } from 'vitest';
import * as models from '../../models';
import { WorkspaceScopeKeys } from '../../models/workspace';
import { getWorkspaceLabel } from '../get-workspace-label';
import { strings } from '../strings';
describe('getWorkspaceLabel', () => {
it('should return document label', () => {
const w = models.workspace.init();
w.scope = WorkspaceScopeKeys.design;
expect(getWorkspaceLabel(w)).toBe(strings.document);
});
it('should return collection label', () => {
const w = models.workspace.init();
w.scope = WorkspaceScopeKeys.collection;
expect(getWorkspaceLabel(w)).toBe(strings.collection);
});
});