;;; test-pearl-fixtures.el --- smoke tests for the API fixtures -*- lexical-binding: t; -*- ;; Copyright (C) 2026 Craig Jennings ;; Author: Craig Jennings ;; This program is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . ;;; Commentary: ;; Smoke tests for `testutil-fixtures'. The fixtures exist for the upcoming ;; query/representation tests, which don't exist yet, so without this file the ;; suite would never load the fixtures and a syntax slip or shape change would ;; rot unnoticed. These assertions exercise the file and lock the key shapes ;; the consuming tests will rely on (json-read conventions: missing keys for ;; absent fields, `t' / `:json-false' booleans). ;;; Code: (require 'test-bootstrap (expand-file-name "test-bootstrap.el")) (require 'testutil-fixtures (expand-file-name "testutil-fixtures.el")) (ert-deftest test-pearl-fixture-assigned-page-shape () "The assignedIssues page fixture has nodes and a pageInfo." (let* ((page (testutil-linear-fixture-assigned-issues-page)) (conn (cdr (assoc 'assignedIssues (assoc 'viewer (assoc 'data page)))))) (should (= 2 (length (cdr (assoc 'nodes conn))))) (should (eq :json-false (cdr (assoc 'hasNextPage (assoc 'pageInfo conn))))))) (ert-deftest test-pearl-fixture-null-fields-omits-optionals () "The null-fields issue carries empty/absent project, assignee, and labels." (let ((issue (testutil-linear-fixture-issue-null-fields))) ;; present-but-empty: the key exists with a nil value (JSON null) (should (assoc 'project issue)) (should (null (cdr (assoc 'project issue)))) (should (null (cdr (assoc 'assignee issue)))) ;; labels is an empty connection, not missing (should (null (cdr (assoc 'nodes (assoc 'labels issue))))))) (ert-deftest test-pearl-fixture-custom-views-shape () "The customViews fixture exposes named views with a shared flag." (let* ((views (cdr (assoc 'nodes (assoc 'customViews (assoc 'data (testutil-linear-fixture-custom-views))))))) (should (= 2 (length views))) (should (string-equal "My open work" (cdr (assoc 'name (car views))))) (should (eq t (cdr (assoc 'shared (cadr views))))))) (ert-deftest test-pearl-fixture-comments-oldest-first () "The issue-with-comments fixture orders comments oldest first." (let ((comments (cdr (assoc 'nodes (assoc 'comments (testutil-linear-fixture-issue-with-comments)))))) (should (= 2 (length comments))) (should (string-equal "First comment" (cdr (assoc 'body (car comments))))))) (provide 'test-pearl-fixtures) ;;; test-pearl-fixtures.el ends here