trashclaw / tests /test_timestamp.py
elyanlabs's picture
Source snapshot of github.com/Scottcjn/trashclaw@6dce9ed
53b2ac9 verified
Raw History Blame Contribute Delete
722 Bytes
# SPDX-License-Identifier: MIT
"""Tests for the timestamp plugin."""
import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "plugins"))
from timestamp import run
def test_now():
result = run(now=True)
assert "Unix:" in result
assert "UTC:" in result
def test_unix_to_date():
result = run(unix=0)
assert "1970" in result
def test_date_to_unix():
result = run(date="2026-03-25T12:00:00")
assert "Unix:" in result
assert "2026-03-25" in result
def test_invalid_date():
result = run(date="not-a-date")
assert "Error" in result or "could not parse" in result
def test_default_shows_now():
result = run()
assert "Current Time" in result