Open seriouslysean opened 9 months ago
can I give it a try ? @seriouslysean
@KathanrDave yeah for sure! Mind explaining a little about what you had in mind?
I think for this first pass, you can start with something small to make sure it even works. I think it would be best to use vittest since it’s api compatible with jest and I like the jest api.
The other thing you could start with would be making a mock event and validating that the ICS file is properly generated from it using something like a snapshot which wouldn’t involve any sort of dynamic data or ai api access.
yes @seriouslysean I was thinking to implement it without api access for the start. Get back to you with it.
JSON and event generation would both benefit from it, or at least some of the utility functions. This is a little tricky because it likely involves both having known articles that we've parsed in the past, and expected JSON output to validate the new return from.
For instance, imagine a test against the following:
Article HTML: https://github.com/seriouslysean/monster-hunter-now-events/blob/main/fixtures/20231001_news-oct-2023/index.html Expected JSON output: https://github.com/seriouslysean/monster-hunter-now-events/blob/main/fixtures/20231001_news-oct-2023/events.json
I don't think we can use them direct from the fixtures because they get regenerated when all articles are force pulled, so I think specific test cases would need to live in a
tests/*
directory.The given test would then:
I know this will use API credits for the OpenAI API , but I don't know a better way of handling that short of a free API instead.