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

SNApp-notes / web / 19448920074

18 Nov 2025 12:05AM UTC coverage: 67.983% (-0.4%) from 68.4%
19448920074

push

github

jcubic
fix lint errors

461 of 703 branches covered (65.58%)

Branch coverage included in aggregate %.

3 of 3 new or added lines in 2 files covered. (100.0%)

70 existing lines in 4 files now uncovered.

830 of 1196 relevant lines covered (69.4%)

461.88 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
    createdAt: new Date('2025-01-01T00:00:00Z'),
33
    updatedAt: new Date('2025-01-01T00:00:00Z')
34
  }
35
});
36

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

54
export const setupMockNotesContext = (
2✔
55
  mockUseNotesContext: ReturnType<typeof vi.fn>,
56
  context: Partial<MockNotesContextValue> = {}
30✔
57
) => {
58
  const mockContext = createMockNotesContext(context);
30✔
59
  mockUseNotesContext.mockReturnValue(mockContext);
30✔
60
  return mockContext;
30✔
61
};
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