Skip to content

Commit 563595f

Browse files
committed
test: add more integration tests
1 parent 138172c commit 563595f

File tree

8 files changed

+1755
-893
lines changed

8 files changed

+1755
-893
lines changed

fixtures/metadata-dump/tasks.json

Lines changed: 1538 additions & 281 deletions
Large diffs are not rendered by default.

package-lock.json

Lines changed: 13 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"@types/chroma-js": "^2.4.4",
2626
"@types/js-yaml": "^4.0.9",
2727
"@types/lodash": "^4.17.7",
28+
"@types/luxon": "^3.6.2",
2829
"@types/mdast": "^4.0.4",
2930
"@types/node": "^22.5.5",
3031
"@types/unist": "^3.0.3",
@@ -36,6 +37,7 @@
3637
"commander": "^13.1.0",
3738
"concurrently": "^9.1.2",
3839
"cross-env": "^7.0.3",
40+
"diff": "^8.0.2",
3941
"dotenv": "^16.4.7",
4042
"esbuild": "^0.23.1",
4143
"esbuild-plugin-replace": "^1.4.0",
@@ -70,8 +72,7 @@
7072
"typescript": "^5.6.3",
7173
"vite": "^5.4.6",
7274
"vite-plugin-filter-replace": "^0.1.13",
73-
"vitest": "^2.1.3",
74-
"diff": "^8.0.2"
75+
"vitest": "^2.1.3"
7576
},
7677
"overrides": {
7778
"svelte": "$svelte"
@@ -85,6 +86,7 @@
8586
"immer": "^10.1.1",
8687
"lodash": "^4.17.21",
8788
"lucide-svelte": "^0.441.0",
89+
"luxon": "^3.7.1",
8890
"mdast-util-from-markdown": "^2.0.1",
8991
"mdast-util-to-markdown": "^2.1.0",
9092
"moment-timezone": "^0.5.45",

src/ui/hooks/use-tasks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ export function useTasks(props: {
132132
);
133133

134134
function getDisplayedTasksWithClocksForTimeline(day: Moment) {
135-
return derived(logRecords, ($visibleTasksWithClockProps) => {
136-
const tasksForDay = $visibleTasksWithClockProps[getDayKey(day)] || [];
135+
return derived(logRecords, ($logRecords) => {
136+
const tasksForDay = $logRecords[getDayKey(day)] || [];
137137

138138
return flow(uniqBy(getRenderKey), addHorizontalPlacing)(tasksForDay);
139139
});

src/util/dataview.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { isString, uniqBy } from "lodash/fp";
22
import type { Moment } from "moment";
33
import { STask } from "obsidian-dataview";
44
import { isNotVoid } from "typed-assert";
5+
import { DateTime } from "luxon";
56

67
import {
78
clockKey,
@@ -170,9 +171,12 @@ export function getScheduledDay(props: {
170171
}) {
171172
const { sTask, periodicNotes } = props;
172173

173-
const scheduledPropDay: string = sTask.scheduled?.toFormat?.(
174-
defaultDayFormatForLuxon,
175-
);
174+
const scheduledPropDay: string = (
175+
typeof sTask.scheduled === "string"
176+
? DateTime.fromISO(sTask.scheduled)
177+
: sTask.scheduled
178+
)?.toFormat?.(defaultDayFormatForLuxon);
179+
176180
const dailyNoteDay = periodicNotes
177181
.getDateFromPath(sTask.path, "day")
178182
?.format(defaultDayFormat);

tests/__snapshots__/task-collecting.test.ts.snap

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)