Commit Graph

12 Commits

Author SHA1 Message Date
Christian Bundy c86865a5ca Add more comprehensive tests
Problem: I've been worried about merging these version bump pull
requests since we don't have many tests, and I *really* don't want to
merge any catostrophic breaking changes anywhere.

Solution: Add some tests that are more comprehensive, starting by
creating a temporary SSB database and keypair and then editing the
profile, previewing a message, publishing a message, etc., until we have
a handful of small functions actually being tested. This won't ensure
that everything works forever, and it *really* doesn't test replication,
but it should help increase our confidence that test success means that
fewer things are broken.
2020-11-22 15:35:15 -08:00
Christian Bundy 0aacf3bbc3 Fix tests and remove workaround
Problem: Recently there was a PR [0] merged with a quickfix to avoid
some test failures, which is something I've been trying to avoid. While
`process.exit()` works fine, I'm worried that it means we don't
understand what's happening under the hood, *plus* I have the [maybe
unjustified?] worry that it might kill the process during a database
write or something dangerous. It looks like this particular test hang
was caused by both a stream and some number of intervals that were left
open.

Solution: Provide a way to close the stream and intervals in `index.js`
and ensure that we do that before closing the server.

[0]: https://github.com/fraction/oasis/pull/462
2020-11-11 08:25:38 -08:00
Alexander Cobleigh e567443925 try workaround 2020-11-11 15:19:05 +01:00
Alexander Cobleigh d88d960c52 reset test/basic.js
this time without cryptix's basic blob test (to see if CI completes)
2020-10-21 14:53:18 +02:00
Henry 4884f264fd add simple test for blob uploads 2020-10-19 10:06:35 +02:00
Henry e7dd215f4d fix common-good setup
somehow it's cli arguments changed
2020-10-19 10:06:34 +02:00
Daan Wynen a40b2eefc1 make the linters happy.
this time they had a *lot* of opinions. :P
2020-05-23 21:14:49 +02:00
Christian Bundy 627e1b3c76 Add tests for CSRF and DNS rebind
Problem: We had these problems in the past and we can't have them again.
Solution: Tests make it really easy to double-check that we remain immune.
2020-04-10 12:33:22 -07:00
Christian Bundy 2968f7d80a Merge https://github.com/fraction/oasis into advisory-fix-1 2020-04-10 10:51:29 -07:00
Christian Bundy 3886b1fc53 Increase test timeout and remove log statements
Problem: The Windows tests seem to be failing, it looks like a timeout
problem? Also there are a handful of debug statements around the code
that can be safely removed.

Solution: Double the timeout length and remove debug statements.
2020-04-06 13:22:07 -07:00
Christian Bundy cb1be6bc8b Fix open sockets that weren't closing during tests
Problem: The test suite isn't closing the database because `app.close()`
only affects the HTTP server. This means that tests don't exit cleanly
and sockets remain open and all sorts of really fun stuff that we don't
want while writing tests.

Solution: Refactor `src/ssb.js` so that we can exit cleanly and have
less rope to hang ourselves with. Add a small lifecycle test that can
help us ensure that the bare minimum lifecycle events are working
correctly, plus now the previous tests are passing on my machine too.
2020-04-06 12:14:58 -07:00
Christian Bundy 3c9ec37d2f Add very basic test suite
Problem: ESLint and TypeScript help catch some types of regressions, but
they don't protect us against obvious stuff like "the server won't
start". This means that humans need to test a bunch of stuff manually,
and that can be really tedious and exhausting.

Solution: Yesterday someone invented this cool concept called "testing"
where you write automated tests for your software to ensure it actually
works the way you expect. It might have beeen invented before yesterday,
I don't know. Anyway, this solution adds a bunch of tests that send HTTP
GET requests to a bunch of endpoints to make sure the server is at least
returning HTTP 200 responses. It also fixes a race condition where HTTP
server was available before the readme / version strings were loaded.
2020-04-03 09:17:13 -07:00