• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jcubic / 10xDevs / 19946653658

04 Dec 2025 10:56PM UTC coverage: 62.673%. Remained the same
19946653658

push

github

jcubic
10xDev Project

303 of 501 branches covered (60.48%)

Branch coverage included in aggregate %.

555 of 864 new or added lines in 49 files covered. (64.24%)

4 existing lines in 1 file now uncovered.

555 of 868 relevant lines covered (63.94%)

214.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.71
/src/mocks/notes-context.ts
1
import { vi } from 'vitest';
2
import type { NoteTreeNode } from '@/types/tree';
3
import type { SaveStatus } from '@/types/notes';
4

5
// Define the context value type inline since it's not exported from NotesContext
6
export interface MockNotesContextValue {
7
  notes: NoteTreeNode[];
8
  selectedNoteId: number | null;
9
  saveStatus: SaveStatus;
10
  setNotes: ReturnType<typeof vi.fn>;
11
  setSaveStatus: ReturnType<typeof vi.fn>;
12
  updateNoteContent: ReturnType<typeof vi.fn>;
13
  updateNoteName: ReturnType<typeof vi.fn>;
14
  markNoteDirty: ReturnType<typeof vi.fn>;
15
  getSelectedNote: ReturnType<typeof vi.fn>;
16
  getNote: ReturnType<typeof vi.fn>;
17
  selectNote: ReturnType<typeof vi.fn>;
18
}
19

20
export const createMockNote = (
2✔
21
  id: number,
22
  name: string = `Note ${id}`,
23✔
23
  content: string = 'Test content',
23✔
24
  dirty: boolean = false
23✔
25
): NoteTreeNode => ({
23✔
26
  id,
27
  name,
28
  selected: false,
29
  data: {
30
    content,
31
    dirty
32
  }
33
});
34

35
export const createMockNotesContext = (
2✔
36
  overrides?: Partial<MockNotesContextValue>
37
): MockNotesContextValue => ({
30✔
38
  notes: [],
39
  selectedNoteId: null,
40
  saveStatus: 'idle' as SaveStatus,
41
  setNotes: vi.fn(),
42
  setSaveStatus: vi.fn(),
43
  updateNoteContent: vi.fn(),
44
  updateNoteName: vi.fn(),
45
  markNoteDirty: vi.fn(),
NEW
46
  getSelectedNote: vi.fn(() => null),
×
NEW
47
  getNote: vi.fn(() => null),
×
48
  selectNote: vi.fn(),
49
  ...overrides
50
});
51

52
export const setupMockNotesContext = (
2✔
53
  mockUseNotesContext: ReturnType<typeof vi.fn>,
54
  context: Partial<MockNotesContextValue> = {}
30✔
55
) => {
56
  const mockContext = createMockNotesContext(context);
30✔
57
  mockUseNotesContext.mockReturnValue(mockContext);
30✔
58
  return mockContext;
30✔
59
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc