Overview
This guide covers testing strategies for both the RSS feed handler and Google Chat webhook integration during local development.Testing the Healthcheck Endpoint
Verify that your server is running correctly:Testing the RSS Feed Handler
The main endpoint processes the Shopify changelog feed and sends updates to Google Chat.Basic Test
Trigger the RSS feed handler:This will actually send messages to your configured Google Chat webhook if there are new items.
With Verbose Output
To see detailed console logs during testing:Testing Google Chat Webhook Integration
Prerequisites
Ensure you have:- A valid Google Chat webhook URL in your
.envfile - The dev server running (
bun run dev)
Test Message Sending
Test Webhook URL Validity
Verify your webhook URL works independently:Testing RSS Feed Parsing
Manual Feed Inspection
Test what the RSS parser returns:Test Date Filtering Logic
The handler only processes items newer than yesterday. To test this:- Check the filtering logic in
rss-handler.ts:40-64 - The
getYesterdayDate()function returns yesterday at midnight - Items are filtered based on their
isoDateorpubDate
Understanding Date Filtering
Understanding Date Filtering
The service uses the following logic:
- Initial Run: Processes items from yesterday onwards (prevents sending old items)
- Subsequent Runs: Would process items newer than the last processed date (in production with state persistence)
- Current Implementation: Always starts from yesterday for each run
getProcessedState() function in rss-handler.ts:19-22.Testing Error Handling
Missing Webhook URL
Test behavior whenWEBHOOK_URL is not set:
Invalid Webhook URL
Test with an invalid webhook URL:Debugging Tips
Enable Detailed Logging
Add console logs to track the flow:Inspect Card Message Structure
Before sending to Google Chat, log the card structure:Check Network Requests
Use curl’s verbose mode to see full request/response:Test with Different RSS Feeds
Temporarily modify theRSS_FEED_URL in rss-handler.ts:4 to test with other feeds:
Using Bun’s Test Runner
While the project doesn’t currently have test files, you can add them:Common Testing Scenarios
No new items to process
No new items to process
Scenario: RSS feed has no items newer than yesterday.Expected: Console shows “No new items to process”, no Google Chat message sent.How to Test: Run the endpoint multiple times within the same day.
Multiple new items
Multiple new items
Scenario: RSS feed has several new items.Expected: Single card message with all items listed, newest first.How to Test: Modify
getYesterdayDate() to return a date further in the past.RSS feed is unavailable
RSS feed is unavailable
Testing in Production-like Environment
To test the cron functionality locally:Vercel cron jobs run in production. For local testing, manually trigger the endpoint or use a tool like
cron on your machine.Simulating Cron Execution
Next Steps
- Review the API Reference for detailed endpoint documentation
- Learn about RSS Handler internals
- Deploy to Vercel for production testing