PrivateBin / PrivateBin

A minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted in the browser using 256 bits AES.
https://privatebin.info/
Other
6.55k stars 814 forks source link

Code quality: Write unit tests for email template generation #1426

Open rugk opened 1 month ago

rugk commented 1 month ago

The problem

https://github.com/PrivateBin/PrivateBin/pull/1421 fixed a bug https://github.com/PrivateBin/PrivateBin/issues/1420, which could have been covered if a unit test would have been there.

The solution

Write (at least) two unit tests:

Alternatives

Additional context

May need some refactor now I think about it or at least the window.open method needs to be stubbed out, so it does not open a mail window with content, but can be tested whether it contains the result. Yeah that should be possible.