Commit b992652
authored
feat(web): seed demo data (#1466)
* feat(storage): add demo data seed migration and related tests
- Introduced a new migration for seeding demo data for first-time users, including events and tasks with sensible defaults.
- Updated storage migration tests to accommodate new localStorage keys and ensure proper handling of migration flags.
- Added comprehensive tests for the demo data seed migration to verify correct data population and behavior under various conditions.
- Refactored existing migration tests to improve clarity and maintainability.
* refactor(event): remove default somedays creation from EventService
- Eliminated the createDefaultSomedays method from EventService to streamline event management.
- Updated UserService to remove calls to createDefaultSomedays during user initialization, focusing on priority creation instead.
- Adjusted related tests to reflect the removal of default someday events, ensuring consistency in user data setup.
* feat(tests): implement prepareEmptyStorageForTests utility for test setup
- Added a new utility function, prepareEmptyStorageForTests, to streamline the test setup process by clearing localStorage and IndexedDB, and setting a migration flag to prevent demo data seeding.
- Updated multiple test files to utilize this new utility, enhancing consistency and reducing redundancy in test initialization.
- Refactored existing tests to ensure they correctly prepare the storage state before each test, improving reliability and maintainability.
* feat(demo-data): update demo data seed to include all-day event and adjust event counts
- Added an all-day event titled "Deep work day" to the demo data seed, enhancing the variety of events generated for testing.
- Updated the expected event count in tests to reflect the addition of the new all-day event, ensuring accurate verification of event creation.
- Adjusted documentation to clarify the changes in the demo data structure, including the new all-day event and updated counts for today’s events.
* refactor(demo-data): simplify demo data seed documentation
- Removed detailed descriptions of demo data contents from the migration documentation to streamline the information presented.
- Updated the demo data seed migration to maintain clarity while focusing on essential details for first-time users.
* feat(tests): enhance storage tests with mock adapter and migration flag updates
- Introduced a new utility function, createMockStorageAdapter, to streamline the creation of mock storage adapters for testing.
- Updated existing tests to utilize the new mock adapter, improving consistency and reducing redundancy in test setup.
- Refactored migration tests to replace hardcoded migration flag keys with the new DEMO_DATA_SEED_FLAG_KEY, ensuring clarity and maintainability.
- Enhanced the demo data seed migration to utilize the updated flag key, aligning with recent changes in the storage architecture.
* feat(demo-data): add timed events with RFC3339 offset format to demo data seed
- Introduced a new test case to verify the creation of timed events with 15-minute-aligned times in RFC3339 offset format, ensuring no seconds or milliseconds are included.
- Updated the demo data generation logic to align with the new event format, enhancing the consistency and accuracy of the demo data for testing purposes.
- Adjusted existing event creation functions to ensure proper handling of time formatting, improving overall data integrity.
* feat(demo-data): enhance demo data seed with additional event properties
- Added `isAllDay` and `isSomeday` properties to multiple events in the demo data seed, ensuring more accurate representation of event types.
- Renamed an event from "Catch up with a friend" to "Call a friend" and added a description for clarity.
- Updated the demo data generation logic to improve the variety and detail of events for testing purposes.
* feat(demo-data): enhance demo data seed with grid position data for timed events
- Added a new test case to verify that default grid position data is correctly added to seeded timed events, ensuring proper layout handling.
- Updated the demo data generation logic to include grid event assembly for timed events, improving the accuracy of event positioning in the demo data.
- Enhanced existing event descriptions to provide more context for testing scenarios.
* feat(demo-data): enhance demo data seed with event schema validation
- Added a new test case to ensure seeded events conform to their respective schemas, validating both grid and core event structures.
- Updated the demo data generation logic to include position data for timed events, improving layout accuracy in the demo data.
- Enhanced event descriptions for clarity in testing scenarios, ensuring better context for validation checks.1 parent 502b7ac commit b992652
15 files changed
Lines changed: 580 additions & 176 deletions
File tree
- packages
- backend/src
- event/services
- user/services
- web/src
- __tests__/utils/storage
- common
- storage/migrations
- external
- utils/shortcut
- views/Day
- components
- ContextMenu
- Tasks
- context/__tests__
- view
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | 4 | | |
10 | 5 | | |
11 | 6 | | |
| |||
14 | 9 | | |
15 | 10 | | |
16 | 11 | | |
17 | | - | |
18 | | - | |
19 | 12 | | |
20 | 13 | | |
21 | 14 | | |
22 | 15 | | |
23 | 16 | | |
24 | | - | |
25 | 17 | | |
26 | 18 | | |
27 | 19 | | |
28 | 20 | | |
29 | 21 | | |
30 | 22 | | |
31 | 23 | | |
32 | | - | |
33 | 24 | | |
34 | 25 | | |
35 | 26 | | |
| |||
41 | 32 | | |
42 | 33 | | |
43 | 34 | | |
44 | | - | |
45 | 35 | | |
46 | 36 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | 37 | | |
117 | 38 | | |
118 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
| |||
85 | 84 | | |
86 | 85 | | |
87 | 86 | | |
88 | | - | |
89 | 87 | | |
90 | 88 | | |
91 | 89 | | |
| |||
121 | 119 | | |
122 | 120 | | |
123 | 121 | | |
124 | | - | |
| 122 | + | |
125 | 123 | | |
126 | 124 | | |
127 | 125 | | |
| |||
141 | 139 | | |
142 | 140 | | |
143 | 141 | | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | 142 | | |
150 | 143 | | |
151 | 144 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
159 | | - | |
160 | 158 | | |
161 | 159 | | |
162 | 160 | | |
| |||
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| |||
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
Lines changed: 29 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
0 commit comments