Skip to content

Commit

Permalink
✅ Added initial experiment test
Browse files Browse the repository at this point in the history
  • Loading branch information
MiloradFilipovic committed Aug 21, 2024
1 parent 5d14706 commit 52d7df3
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions packages/editor-ui/src/stores/__tests__/assistant.store.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,26 @@ import {
useAssistantStore,
} from '@/stores/assistant.store';
import type { ChatRequest } from '@/types/assistant.types';
// import { useSettingsStore } from '@/stores/settings.store';
import { usePostHog } from '../posthog.store';
import { useSettingsStore } from '@/stores/settings.store';
// import { useUsersStore } from '@/stores/users.store';
// import { useWorkflowsStore } from '@/stores/workflows.store';
// import { useNDVStore } from '@/stores/ndv.store';

// let settingsStore: ReturnType<typeof useSettingsStore>;
let settingsStore: ReturnType<typeof useSettingsStore>;
// let usersStore: ReturnType<typeof useUsersStore>;
// let workflowsStore: ReturnType<typeof useWorkflowsStore>;
// let ndvStore: ReturnType<typeof useNDVStore>;
let posthogStore: ReturnType<typeof usePostHog>;

describe('AI Assistant store', () => {
beforeEach(() => {
setActivePinia(createPinia());
// settingsStore = useSettingsStore();
settingsStore = useSettingsStore();
// usersStore = useUsersStore();
// workflowsStore = useWorkflowsStore();
// ndvStore = useNDVStore();
posthogStore = usePostHog();
});

it('initializes with default values', () => {
Expand Down Expand Up @@ -227,6 +230,14 @@ describe('AI Assistant store', () => {
expect(assistantStore.currentSessionId).toBeUndefined();
});

it('should disable assistant for control experiment group', () => {
const assistantStore = useAssistantStore();

posthogStore.getVariant = vi.fn().mockReturnValue('control');
// TODO: Mock isAssistantEnabled and route
expect(assistantStore.canShowAssistant).toBe(false);
});

// TODO: To test:
// - canShowAssistant
// - canShowAssistantButtons
Expand Down

0 comments on commit 52d7df3

Please sign in to comment.