MattIPv4 / DNS-over-Discord

1.1.1.1 works from a Discord server, thanks to the 1.1.1.1 bot. Invite the bot to your Discord server to start using DNS over Discord.
https://dns-over-discord.v4.wtf/invite
Apache License 2.0
275 stars 27 forks source link

Add end-to-end testing for dig command #68

Open MattIPv4 opened 1 year ago

MattIPv4 commented 1 year ago

For now, I'm only worried about testing the dig command. This will lay the ground-work for testing other commands down the road.

Implement end-to-end testing that simulates a valid interaction call from Discord to the worker (likely using wrangler in the dry-run mode and miniflare to run it in a simulated Workers environment), and ensure that the expected response is received. This will also need network calls mocked so that we can ensure the correct follow-up API calls are made to Discord, as the dig command handles responding asynchronously after the request.

To be clear, this is a pretty complex issue that involves setting up all the ground-work for testing in this repo, as well as fully mocking the Discord API calls involved in the interactions flow.

The end goal here is to have a test suite that can call the dig command (with any domain, any types, any options) as if it were a Discord user running a command, and we can validate that the bot will respond as we expect.