From b081d62276378b3168c92c06153fd59db0589535 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 24 May 2026 13:44:34 -0500 Subject: feat: pearl — manage Linear issues from org-mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pearl fetches Linear issues into an org file and syncs edits back. It covers list / custom views / saved queries, per-issue and bulk rendering with comments inline, conflict-aware sync of descriptions, titles, and comments, field commands for priority / state / assignee / labels, and a transient dispatch menu. The render folds to a scannable outline and nests issues under a sortable parent. Based on and inspired by Gael Blanchemain's linear-emacs. --- tests/test-pearl-issues.el | 73 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 tests/test-pearl-issues.el (limited to 'tests/test-pearl-issues.el') diff --git a/tests/test-pearl-issues.el b/tests/test-pearl-issues.el new file mode 100644 index 0000000..0976e0a --- /dev/null +++ b/tests/test-pearl-issues.el @@ -0,0 +1,73 @@ +;;; test-pearl-issues.el --- Tests for pearl issue fetch/create -*- 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: + +;; Tests for issue creation with `request' stubbed, focused on +;; `pearl--created-issue' (the success-checking helper that prevents +;; phantom "created" reports) and the create-issue async path. + +;;; Code: + +(require 'test-bootstrap (expand-file-name "test-bootstrap.el")) +(require 'testutil-request (expand-file-name "testutil-request.el")) + +;;; pearl--created-issue (pure) + +(ert-deftest test-pearl-created-issue-success-returns-node () + "A successful create returns the issue node." + (let ((issue (pearl--created-issue + '((data (issueCreate (success . t) + (issue (id . "i1") (identifier . "ENG-1") (title . "T")))))))) + (should (string-equal "ENG-1" (cdr (assoc 'identifier issue)))))) + +(ert-deftest test-pearl-created-issue-soft-fail-returns-nil () + "A soft failure (success=false, issue=null) returns nil, not a phantom node." + (should (null (pearl--created-issue + '((data (issueCreate (success . :json-false) (issue)))))))) + +(ert-deftest test-pearl-created-issue-graphql-error-returns-nil () + "A GraphQL error body (no data) returns nil." + (should (null (pearl--created-issue '((errors . (((message . "bad"))))))))) + +(ert-deftest test-pearl-created-issue-empty-response-returns-nil () + "A nil/empty response returns nil." + (should (null (pearl--created-issue nil)))) + +;;; pearl-create-issue-async + +(ert-deftest test-pearl-create-issue-async-success-passes-issue () + "A successful create passes the issue node to the callback." + (let ((got 'unset)) + (testutil-linear-with-response + '((data (issueCreate (success . t) + (issue (id . "i1") (identifier . "ENG-1") (title . "T"))))) + (pearl-create-issue-async "T" "" "team" (lambda (i) (setq got i)))) + (should (string-equal "ENG-1" (cdr (assoc 'identifier got)))))) + +(ert-deftest test-pearl-create-issue-async-soft-fail-passes-nil () + "A soft failure passes nil to the callback rather than a phantom issue." + (let ((got 'unset)) + (testutil-linear-with-response + '((data (issueCreate (success . :json-false) (issue)))) + (pearl-create-issue-async "T" "" "team" (lambda (i) (setq got i)))) + (should (null got)))) + +(provide 'test-pearl-issues) +;;; test-pearl-issues.el ends here -- cgit v1.2.3