char-fork/llama.cpp

git clone https://git.t4t.associates/char-fork/llama.cpp

Aleksander Grygierui: ESLint config updates (#27700)f1357e499

char/aliceai-t5-moe
2.6 KiB109 linesraw
1<script lang="ts" module>
2	import { defineMeta } from '@storybook/addon-svelte-csf';
3	import SidebarNavigation from '$lib/components/app/navigation/SidebarNavigation/SidebarNavigation.svelte';
4	import { waitFor } from 'storybook/test';
5	import { screen } from 'storybook/test';
6
7	const { Story } = defineMeta({
8		component: SidebarNavigation,
9		parameters: {
10			layout: 'centered'
11		},
12		title: 'Components/SidebarNavigation'
13	});
14</script>
15
16<script lang="ts">
17	// Mock conversations for the sidebar
18	const mockConversations: DatabaseConversation[] = [
19		{
20			currNode: 'msg-1',
21			id: 'conv-1',
22			lastModified: Date.now() - 1000 * 60 * 5, // 5 minutes ago
23			name: 'Getting Started with AI'
24		},
25		{
26			currNode: 'msg-2',
27			id: 'conv-2',
28			lastModified: Date.now() - 1000 * 60 * 60 * 2, // 2 hours ago
29			name: 'Python Programming Help'
30		},
31		{
32			currNode: 'msg-3',
33			id: 'conv-3',
34			lastModified: Date.now() - 1000 * 60 * 60 * 24, // 1 day ago
35			name: 'Creative Writing Ideas'
36		},
37		{
38			currNode: 'msg-4',
39			id: 'conv-4',
40			lastModified: Date.now() - 1000 * 60 * 60 * 24 * 3, // 3 days ago
41			name: 'This is a very long conversation title that should be truncated properly when displayed'
42		},
43		{
44			currNode: 'msg-5',
45			id: 'conv-5',
46			lastModified: Date.now() - 1000 * 60 * 60 * 24 * 7, // 1 week ago
47			name: 'Math Problem Solving'
48		}
49	];
50</script>
51
52<Story
53	asChild
54	name="Default"
55	play={async () => {
56		const { conversationsStore } = await import('$lib/stores/conversations/index.svelte');
57
58		waitFor(() =>
59			setTimeout(() => {
60				conversationsStore.conversations = mockConversations;
61			}, 0)
62		);
63	}}
64>
65	<div class="flex-column h-screen w-72 bg-background">
66		<SidebarNavigation />
67	</div>
68</Story>
69
70<Story
71	asChild
72	name="SearchActive"
73	play={async ({ userEvent }) => {
74		const { conversationsStore } = await import('$lib/stores/conversations/index.svelte');
75
76		waitFor(() =>
77			setTimeout(() => {
78				conversationsStore.conversations = mockConversations;
79			}, 0)
80		);
81
82		// Expand sidebar first, then click Search in the expanded button list
83		const logoTrigger = screen.getByRole('button', { name: /expand navigation/i });
84
85		await userEvent.click(logoTrigger);
86		const searchTrigger = screen.getByText('Search');
87
88		userEvent.click(searchTrigger);
89	}}
90>
91	<div class="flex-column h-screen w-72 bg-background">
92		<SidebarNavigation />
93	</div>
94</Story>
95
96<Story
97	asChild
98	name="Empty"
99	play={async () => {
100		// Mock empty conversations store
101		const { conversationsStore } = await import('$lib/stores/conversations/index.svelte');
102
103		conversationsStore.conversations = [];
104	}}
105>
106	<div class="flex-column h-screen w-72 bg-background">
107		<SidebarNavigation />
108	</div>
109</Story>