aboutsummaryrefslogtreecommitdiff
path: root/tests/testutil-fixtures.el
diff options
context:
space:
mode:
Diffstat (limited to 'tests/testutil-fixtures.el')
-rw-r--r--tests/testutil-fixtures.el105
1 files changed, 105 insertions, 0 deletions
diff --git a/tests/testutil-fixtures.el b/tests/testutil-fixtures.el
new file mode 100644
index 0000000..5c55c7b
--- /dev/null
+++ b/tests/testutil-fixtures.el
@@ -0,0 +1,105 @@
+;;; testutil-fixtures.el --- representative Linear API response fixtures -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2026 Craig Jennings
+
+;; Author: Craig Jennings <c@cjennings.net>
+
+;;; Commentary:
+
+;; Small, representative response fixtures for the issue-query and
+;; representation build. They cover an assignedIssues page, a top-level
+;; issues(filter:) page, custom views, a custom view's issues, an issue with
+;; comments, and an issue with null/missing optional fields.
+;;
+;; Shapes mirror what `json-read' returns from the live API: symbol-keyed
+;; alists, `t' / `:json-false' for JSON booleans, and a missing key (rather
+;; than an explicit value) for absent optional fields. Not a test file (no
+;; `test-' prefix), so the suite runner ignores it; tests `require' it.
+;;
+;; These let normalization, query, and render tests run against stable
+;; inputs without a live workspace. Captured from the documented schema
+;; shapes; replace with real recorded responses once a live key is wired in.
+
+;;; Code:
+
+(defun testutil-linear-fixture-issue-full ()
+ "A fully-populated issue node, every optional field present."
+ '((id . "uuid-1")
+ (identifier . "ENG-42")
+ (title . "Fix the thing")
+ (description . "Line one\nLine two")
+ (priority . 2)
+ (updatedAt . "2026-05-20T12:00:00.000Z")
+ (state . ((id . "state-1") (name . "In Progress") (type . "started") (color . "#fff")))
+ (assignee . ((id . "user-1") (name . "Craig") (email . "c@example.com")))
+ (team . ((id . "team-1") (key . "ENG") (name . "Engineering")))
+ (project . ((id . "proj-1") (name . "Platform")))
+ (cycle . ((id . "cycle-1") (number . 12) (name . "Cycle 12")))
+ (labels . ((nodes . (((id . "lbl-1") (name . "bug"))
+ ((id . "lbl-2") (name . "backend"))))))))
+
+(defun testutil-linear-fixture-issue-null-fields ()
+ "An issue with optional fields absent or null (project/labels/assignee/cycle).
+Description is JSON null; labels is an empty connection."
+ '((id . "uuid-2")
+ (identifier . "ENG-7")
+ (title . "Bare issue")
+ (description)
+ (priority . 0)
+ (updatedAt . "2026-05-19T08:30:00.000Z")
+ (state . ((id . "state-2") (name . "Todo") (type . "unstarted")))
+ (assignee)
+ (team . ((id . "team-1") (key . "ENG") (name . "Engineering")))
+ (project)
+ (cycle)
+ (labels . ((nodes . ())))))
+
+(defun testutil-linear-fixture-assigned-issues-page ()
+ "A viewer.assignedIssues page: two issues, no next page."
+ `((data (viewer (assignedIssues
+ (nodes . (,(testutil-linear-fixture-issue-full)
+ ,(testutil-linear-fixture-issue-null-fields)))
+ (pageInfo (hasNextPage . :json-false) (endCursor . "cursor-1")))))))
+
+(defun testutil-linear-fixture-issues-filter-page ()
+ "A top-level issues(filter:) page: one issue, has a next page."
+ `((data (issues
+ (nodes . (,(testutil-linear-fixture-issue-full)))
+ (pageInfo (hasNextPage . t) (endCursor . "cursor-2"))))))
+
+(defun testutil-linear-fixture-custom-views ()
+ "A customViews connection: one shared workspace view, one personal team view."
+ '((data (customViews
+ (nodes . (((id . "cv-1") (name . "My open work") (description . "Everything open assigned to me")
+ (shared . :json-false) (team) (icon . "Inbox") (color . "#aabbcc")
+ (owner . ((id . "user-1") (name . "Craig"))))
+ ((id . "cv-2") (name . "Eng in progress") (description)
+ (shared . t) (team . ((id . "team-1") (key . "ENG") (name . "Engineering")))
+ (icon) (color)
+ (owner . ((id . "user-1") (name . "Craig"))))))
+ (pageInfo (hasNextPage . :json-false) (endCursor . "cv-cursor"))))))
+
+(defun testutil-linear-fixture-custom-view-issues ()
+ "A customView(id).issues page: the view's filter resolved server-side."
+ `((data (customView
+ (id . "cv-1")
+ (name . "My open work")
+ (issues
+ (nodes . (,(testutil-linear-fixture-issue-full)))
+ (pageInfo (hasNextPage . :json-false) (endCursor . "cvi-cursor")))))))
+
+(defun testutil-linear-fixture-issue-with-comments ()
+ "An issue carrying a comments connection, oldest first."
+ `((id . "uuid-1")
+ (identifier . "ENG-42")
+ (title . "Fix the thing")
+ (description . "Body text")
+ (comments (nodes . (((id . "cm-1") (body . "First comment")
+ (createdAt . "2026-05-18T09:00:00.000Z")
+ (user . ((id . "user-2") (name . "Alice"))))
+ ((id . "cm-2") (body . "Second comment, **bold**")
+ (createdAt . "2026-05-19T10:30:00.000Z")
+ (user . ((id . "user-1") (name . "Craig")))))))))
+
+(provide 'testutil-fixtures)
+;;; testutil-fixtures.el ends here