aglinxinyuan commented on code in PR #7415:
URL: https://github.com/apache/texera/pull/7415#discussion_r3740043409
##########
frontend/src/app/dashboard/component/user/user-project/user-project-list-item/user-project-list-item.component.spec.ts:
##########
@@ -218,4 +220,98 @@ describe("UserProjectListItemComponent", () => {
expect(refreshSpy).toHaveBeenCalled();
});
});
+ /**
+ * The list item decides in its template what a viewer is allowed to touch
and how much of a long
+ * description to show. The specs above call the save/colour methods
directly, so none of the
+ * rendered gating had been pinned.
+ */
+ describe("rendered item", () => {
+ /** Re-renders the host with the given entry/editable combination. */
+ function render(over: Partial<DashboardProject> = {}, editable = true):
HTMLElement {
+ hostFixture.componentInstance.entry = { ...testProject, ...over };
+ hostFixture.componentInstance.editable = editable;
+ hostFixture.detectChanges();
+ return hostFixture.nativeElement as HTMLElement;
+ }
+
+ it("shows the project name and its creation date", () => {
+ const el = render({ name: "quarterly", creationTime: januaryFirst1970 });
+
+ expect(el.textContent).toContain("quarterly");
+ expect(el.textContent).toContain("1970-01-01");
+ });
Review Comment:
Good catch on both counts, and fixed in e44b491952.
The substring check was weaker than I'd assumed. It happened to kill a
`fullDate` mutation, but it would have sailed past `yyyy-MM-dd HH:mm:ss` — I
re-ran that specific mutation to confirm, and the old assertion survived it
while the new one fails. And you're right about the timezone:
`januaryFirst1970` is 28,800,000 ms, so on a runner far enough west of UTC the
date renders as 1969-12-31 and the test breaks for reasons that have nothing to
do with the format.
Rather than assert a fixed string — which would pin the runner's timezone
instead of the format — it now matches the rendered line as a shape:
```
/^Created: \d{4}-\d{2}-\d{2} \d{2}:\d{2}$/
```
That pins the format exactly, rejects a stray seconds field, and is
indifferent to where it runs.
The other two locations you flagged aren't date assertions, so nothing to
change there.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]