From 28b7e4cecadce207d532b8d42346c3823450a35f Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Tue, 17 Feb 2026 19:14:14 -0600 Subject: refactor: tests: standardize naming, consolidate files, and expand testutil - Expand testutil-wttrin.el with shared fixtures and macros (testutil-wttrin-with-clean-weather-buffer, testutil-wttrin-mock-http-response, sample ANSI/weather constants) - Consolidate cache tests: port unique tests from cleanup-cache-constants and cleanup-cache-refactored into cleanup-cache-if-needed, delete obsolete files - Extract startup-delay tests into dedicated file - Add setup/teardown and (require 'testutil-wttrin) to all test files - Rename all 160 tests to follow test---- convention - Rename integration test file and add detailed docstrings - Update Makefile glob to discover new integration test naming pattern Co-Authored-By: Claude Opus 4.6 --- tests/test-wttrin-mode-line-startup-delay.el | 56 ++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 tests/test-wttrin-mode-line-startup-delay.el (limited to 'tests/test-wttrin-mode-line-startup-delay.el') diff --git a/tests/test-wttrin-mode-line-startup-delay.el b/tests/test-wttrin-mode-line-startup-delay.el new file mode 100644 index 0000000..af98b20 --- /dev/null +++ b/tests/test-wttrin-mode-line-startup-delay.el @@ -0,0 +1,56 @@ +;;; test-wttrin-mode-line-startup-delay.el --- Tests for wttrin-mode-line-startup-delay -*- lexical-binding: t; -*- + +;; Copyright (C) 2025 Craig Jennings + +;;; Commentary: + +;; Unit tests for wttrin-mode-line-startup-delay defcustom. +;; Tests that the startup delay variable exists and has reasonable defaults. + +;;; Code: + +(require 'ert) +(require 'wttrin) +(require 'testutil-wttrin) + +;;; Setup and Teardown + +(defun test-wttrin-mode-line-startup-delay-setup () + "Setup for startup delay tests." + (testutil-wttrin-setup)) + +(defun test-wttrin-mode-line-startup-delay-teardown () + "Teardown for startup delay tests." + (testutil-wttrin-teardown)) + +;;; Normal Cases + +(ert-deftest test-wttrin-mode-line-startup-delay-normal-exists () + "Test that wttrin-mode-line-startup-delay defcustom exists." + (test-wttrin-mode-line-startup-delay-setup) + (unwind-protect + (should (boundp 'wttrin-mode-line-startup-delay)) + (test-wttrin-mode-line-startup-delay-teardown))) + +(ert-deftest test-wttrin-mode-line-startup-delay-normal-is-number () + "Test that startup delay is a number." + (test-wttrin-mode-line-startup-delay-setup) + (unwind-protect + (should (numberp wttrin-mode-line-startup-delay)) + (test-wttrin-mode-line-startup-delay-teardown))) + +;;; Boundary Cases + +(ert-deftest test-wttrin-mode-line-startup-delay-boundary-reasonable-range () + "Test that startup delay default value is in reasonable range (1-10 seconds)." + (test-wttrin-mode-line-startup-delay-setup) + (unwind-protect + ;; Check the defcustom's standard value, not current runtime value + ;; (other tests may set it to 0 for faster testing) + (let ((default-value (eval (car (get 'wttrin-mode-line-startup-delay 'standard-value))))) + (should (>= default-value 1)) + (should (<= default-value 10))) + (test-wttrin-mode-line-startup-delay-teardown))) + +(provide 'test-wttrin-mode-line-startup-delay) +;;; test-wttrin-mode-line-startup-delay.el ends here -- cgit v1.2.3