@smartbear/mcp 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,93 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { equals, notEquals, empty, relativeTime, isoTime, toUrlSearchParams } from '../../../insight-hub/client/api/filters.js';
3
- describe('Filter Utilities', () => {
4
- describe('equals', () => {
5
- it('should create eq filter for string value', () => {
6
- const result = equals('test-value');
7
- expect(result).toEqual({ type: 'eq', value: 'test-value' });
8
- });
9
- it('should create eq filter for number value', () => {
10
- const result = equals(42);
11
- expect(result).toEqual({ type: 'eq', value: 42 });
12
- });
13
- });
14
- describe('notEquals', () => {
15
- it('should create ne filter for string value', () => {
16
- const result = notEquals('test-value');
17
- expect(result).toEqual({ type: 'ne', value: 'test-value' });
18
- });
19
- it('should create ne filter for number value', () => {
20
- const result = notEquals(42);
21
- expect(result).toEqual({ type: 'ne', value: 42 });
22
- });
23
- });
24
- describe('empty', () => {
25
- it('should create empty filter for true', () => {
26
- const result = empty(true);
27
- expect(result).toEqual({ type: 'empty', value: 'true' });
28
- });
29
- it('should create empty filter for false', () => {
30
- const result = empty(false);
31
- expect(result).toEqual({ type: 'empty', value: 'false' });
32
- });
33
- });
34
- describe('relativeTime', () => {
35
- it('should create relative time filter with hours', () => {
36
- const result = relativeTime(24, 'h');
37
- expect(result).toEqual({ type: 'eq', value: '24h' });
38
- });
39
- it('should create relative time filter with days', () => {
40
- const result = relativeTime(7, 'd');
41
- expect(result).toEqual({ type: 'eq', value: '7d' });
42
- });
43
- });
44
- describe('isoTime', () => {
45
- it('should create ISO time filter from date', () => {
46
- const date = new Date('2023-01-01T12:00:00.000Z');
47
- const result = isoTime(date);
48
- expect(result).toEqual({ type: 'eq', value: '2023-01-01T12:00:00.000Z' });
49
- });
50
- });
51
- describe('toUrlSearchParams', () => {
52
- it('should convert simple filter object to URL params', () => {
53
- const filters = {
54
- 'error.status': [{ type: 'eq', value: 'open' }],
55
- 'user.email': [{ type: 'ne', value: 'test@example.com' }]
56
- };
57
- const result = toUrlSearchParams(filters);
58
- expect(result.get('filters[error.status][][type]')).toBe('eq');
59
- expect(result.get('filters[error.status][][value]')).toBe('open');
60
- expect(result.get('filters[user.email][][type]')).toBe('ne');
61
- expect(result.get('filters[user.email][][value]')).toBe('test@example.com');
62
- });
63
- it('should handle multiple filters for same field', () => {
64
- const filters = {
65
- 'error.status': [
66
- { type: 'eq', value: 'open' },
67
- { type: 'eq', value: 'in_progress' }
68
- ]
69
- };
70
- const result = toUrlSearchParams(filters);
71
- const allEntries = Array.from(result.entries());
72
- // Should have entries for both filter values
73
- const statusFilters = allEntries.filter(([key]) => key.includes('error.status'));
74
- expect(statusFilters.length).toBeGreaterThan(2); // type and value for each filter
75
- });
76
- it('should handle empty filter object', () => {
77
- const filters = {};
78
- const result = toUrlSearchParams(filters);
79
- expect(result.toString()).toBe('');
80
- });
81
- it('should handle complex filter scenarios', () => {
82
- const filters = {
83
- 'event.since': [{ type: 'eq', value: '7d' }],
84
- 'error.status': [{ type: 'ne', value: 'resolved' }],
85
- 'user.id': [{ type: 'empty', value: 'false' }]
86
- };
87
- const result = toUrlSearchParams(filters);
88
- expect(result.get('filters[event.since][][value]')).toBe('7d');
89
- expect(result.get('filters[error.status][][value]')).toBe('resolved');
90
- expect(result.get('filters[user.id][][value]')).toBe('false');
91
- });
92
- });
93
- });
@@ -1,57 +0,0 @@
1
- import { defineConfig } from 'vitest/config';
2
- export default defineConfig({
3
- test: {
4
- globals: true,
5
- environment: 'node',
6
- coverage: {
7
- provider: 'v8',
8
- reporter: ['text', 'json', 'json-summary', 'html', 'lcov'],
9
- exclude: [
10
- 'dist/**',
11
- 'node_modules/**',
12
- 'tests/**',
13
- '*.config.*',
14
- '**/*.d.ts',
15
- // Auto-generated API client files
16
- 'insight-hub/client/api/*.ts',
17
- 'insight-hub/client/index.ts',
18
- 'insight-hub/client/configuration.ts',
19
- // Main entry point (tested via integration)
20
- 'index.ts',
21
- // Other client implementations (not currently tested)
22
- 'api-hub/client.ts',
23
- 'reflect/client.ts',
24
- // Utility modules
25
- 'common/bugsnag.ts',
26
- 'common/types.ts'
27
- ],
28
- // Coverage thresholds for business logic only
29
- thresholds: {
30
- lines: 75,
31
- functions: 75,
32
- branches: 85,
33
- statements: 75,
34
- // Per-file thresholds for core files
35
- perFile: false
36
- },
37
- // Generate more detailed reports
38
- reportOnFailure: true,
39
- all: true,
40
- // Clean coverage directory before tests
41
- clean: true,
42
- // Include source map support
43
- reportsDirectory: './coverage'
44
- },
45
- // Include TypeScript files
46
- include: ['tests/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
47
- // Setup files
48
- // Placeholder for future setup files. Remove if not needed.
49
- setupFiles: []
50
- },
51
- // Resolve imports correctly for ESM
52
- resolve: {
53
- alias: {
54
- '@': new URL('./src', import.meta.url).pathname
55
- }
56
- }
57
- });
File without changes