DiscordChatExporter/DiscordChatExporter.Cli.Tests
Kornelius Rohrschneider 5251ae0e95
Added explicit handling of existing export files
Previously, existing export files had just been overwritten by a new export.
This has been changed; instead, there are now several possible options on how to explicitly handle existing export files:
- Abort aborts the export if the channel had previously been exported.
- Overwrite removes the existing export before exporting the channel again.
- Append appends the existing export, which means that only messages after the last export will be exported.
The option that's used if a previous export is detected is currently hardcoded.

A safeguard has been added to prevent the exporter from accidentally overwriting any existing files.

Additionally, the creation of a Snowflake from a timestamp has been improved: If a Snowflake will be used to determine the messages starting at the given timestamp, it now won't precisely represent that timestamp anymore, but instead be the latest possible Snowflake just before that timestamp.
This is necessary to prevent the first Discord message in that specific millisecond from being excluded (which may have previously happened).
2025-10-25 19:17:00 +02:00
..
Infra Include inline emoji in JSON export (#1311) 2024-11-06 19:23:40 +02:00
Specs Added explicit handling of existing export files 2025-10-25 19:17:00 +02:00
Utils Unify whitespace characters to fix tests 2025-02-04 00:17:57 +02:00
DiscordChatExporter.Cli.Tests.csproj Bump the nuget group with 13 updates (#1431) 2025-10-02 16:08:07 +03:00
Readme.md Use local secret store for tests instead of hand-made solution 2023-01-30 12:16:47 +02:00
xunit.runner.json Get rid of xUnit fixtures 2023-02-11 23:12:15 +02:00

DiscordChatExporter Tests

This test suite runs against a real Discord server, specifically created to exercise different behaviors required by the test scenarios. In order to run these tests locally, you need to join the test server and configure your authentication token.

  1. Join the test server
  2. Locate your Discord authentication token
  3. Add your token to user secrets: dotnet user-secrets set DISCORD_TOKEN <token>
  4. Run the tests: dotnet test

Note

: If you want to add a new test case, please let me know and I will give you the required permissions on the server.