|
1 | 1 | import { render, screen, fireEvent, waitFor } from '@testing-library/react'; |
2 | 2 | import { expect, test, describe, vi, beforeEach } from 'vitest'; |
| 3 | +import type { LDContext } from 'launchdarkly-js-client-sdk'; |
3 | 4 | import { ContextItem } from '../ui/Toolbar/components/new/Contexts/ContextItem'; |
4 | 5 | import { ContextsProvider } from '../ui/Toolbar/context/api/ContextsProvider'; |
5 | 6 | import '@testing-library/jest-dom/vitest'; |
6 | 7 | import React from 'react'; |
7 | | -import { Context } from '../ui/Toolbar/types/ldApi'; |
8 | 8 | import { loadContexts, saveContexts } from '../ui/Toolbar/utils/localStorage'; |
9 | 9 |
|
10 | 10 | // Mock localStorage utilities |
@@ -63,8 +63,7 @@ vi.mock('motion/react', () => ({ |
63 | 63 | })); |
64 | 64 |
|
65 | 65 | describe('ContextItem', () => { |
66 | | - const mockContext: Context = { |
67 | | - id: 'test-context-id-123', |
| 66 | + const mockContext: LDContext = { |
68 | 67 | kind: 'user', |
69 | 68 | key: 'test-user-123', |
70 | 69 | name: 'Test User', |
@@ -124,7 +123,7 @@ describe('ContextItem', () => { |
124 | 123 |
|
125 | 124 | describe('Delete Functionality', () => { |
126 | 125 | test('deletes context when delete button is clicked', async () => { |
127 | | - const storedContexts: Context[] = [mockContext]; |
| 126 | + const storedContexts: LDContext[] = [mockContext]; |
128 | 127 | (loadContexts as any).mockReturnValue(storedContexts); |
129 | 128 |
|
130 | 129 | render( |
@@ -160,7 +159,7 @@ describe('ContextItem', () => { |
160 | 159 | }); |
161 | 160 |
|
162 | 161 | test('prevents deletion when context is active (button not rendered)', async () => { |
163 | | - const storedContexts: Context[] = [mockContext]; |
| 162 | + const storedContexts: LDContext[] = [mockContext]; |
164 | 163 | (loadContexts as any).mockReturnValue(storedContexts); |
165 | 164 |
|
166 | 165 | render( |
|
0 commit comments