Commit Graph

172 Commits

Author SHA1 Message Date
Gnuxie a5afdbe9ad Unit tests for the ban and unban commands. (#542)
* Unit test Ban and UnbanCommands.

Fixes https://github.com/the-draupnir-project/Draupnir/issues/441
will follow up with https://github.com/the-draupnir-project/interface-manager/issues/7.

Part of https://github.com/the-draupnir-project/planning/issues/22.

* Update to @the-draupnir-project/interface-manager@2.1.0.

* Rest parameters can only give one argument from prompts.

* Update to @the-draupnir-project/interface-manager@2.2.0.
2024-09-11 10:24:01 +01:00
Gnuxie 8d1af843d3 Unit test the DraupnirKickCommand. (#539)
* Update to MPS v1.2.1.

This will allow us to use `describeProtectedRoomsSet` in unit tests.

* Update to @the-draupnir-project/interface-manager@1.1.1.

This allows for better type inference from the command and also for
partial keywords to be provided to commands as arguments.

* Unit test the DraupnirKickCommand.
2024-09-09 17:20:09 +01:00
gnuxie 3df3e0eccb unit test Draupnir watch/unwatch commands. 2024-09-09 13:28:16 +01:00
gnuxie 701f5da47f Add ts-auto-mock and ts-node and transformer for better mocks. 2024-09-09 13:27:41 +01:00
gnuxie bdbfadc095 Move to @the-draupnir-project/interface-manager for defining commands. 2024-09-06 17:18:53 +01:00
Gnuxie cc9d4cb9d5 Move to @the-draupnir-project/basic-matrix-types. (#508)
We split out some utility types from the matrix-protection-suite into a library https://github.com/the-draupnir-project/matrix-basic-types



I can't believe that like the extra lines from 

```
import {
} from ...
```

are adding up so much but whatever. 

* Move to @the-draupnir-project/basic-matrix-types.

* Whoopsie missed a test.
2024-08-16 19:12:21 +01:00
Gnuxie 337a6a3b76 Add reuse.software (#486)
We have a lot of verbose headers, and i think now is the best opportunity we have to become reuse compliant given that we just did two other similar maintenance changes (prettier, typescirpt5 & eslint9 & typescript-eslint).

* synapse_antispam resuse headers.

* delete old unused tslint.json.

* Add REUSE to pre-commit config.

* reuse info for config directory.
2024-07-25 10:58:40 +01:00
pre-commit-ci[bot] 3b2036c2db prettier all files 2024-07-22 19:13:57 +01:00
Gnuxie 8973db487b Migrate to eslint-9 flat config, typescript 5, typescript-eslint strictTypeChecked (#476)
* Migrate to eslint-9 strictTypeChecked & typescript 5.

* Update to MPS 0.23.0.

Required for strict type checks.

* Looks like we found a test that was complete garbage, amazing really.

* FIXUP

* Well, the command handler was bugged previously...

The command handler used to always only return the command
without the prefix due to an operator precedence bug.
This meant that when we made the order of operations explicit,
we were now including the prefix of the command in the copy.
So when we parsed arguments the code wasn't expecting the prefix
to be there.

* update to MPS 0.23.1.

MPS 0.23.0 was bugged because we didn't enable
`noUncheckedIndexedAccess` while upgrading to typescript 5.

* Make sure eslint runs on all ts files.

* eslint fixes.

* enable `noUncheckedIndexedAccess` & `exactOptionalPropertyTypes`.

* eslint ignores is clearly not understood by me.

* Update SuperCoolStream for eslint and ts5.

* stricter eslint done i thinks

* Whoops, added on .only somewhere.

* Update MPS.

* fix broken test realted things.

* Well I guess that part of getMessagesByUserIn was part of the interface.

* Fix redactionCommandTest.

* Account for escapeHTML in tests.

* Fix tests.

* stuff not matching with .editorconfig fixes.

* Fix appservice webAPI test.

* Update for MPS 0.23.3.
2024-07-22 16:54:04 +01:00
gnuxie 48c0fec134 Remove acceptInvitesFromSpace.
https://github.com/the-draupnir-project/Draupnir/issues/433.
Sucks balls, mare.
2024-05-22 16:15:58 +01:00
gnuxie a4833bcf3a Fix unban command.
https://github.com/the-draupnir-project/Draupnir/issues/401.
2024-05-06 16:40:03 +01:00
gnuxie 0049dfd367 Update for MPS ProtectedRoomsManager. 2024-05-02 15:57:44 +01:00
gnuxie 2bbca6d27a Update for MPS's PowerLevelMirror. 2024-05-02 15:57:44 +01:00
gnuxie 80ccb64330 Implement RoomStateBackingStore with BetterSqlite. 2024-04-06 20:03:38 +01:00
gnuxie 6957b3e404 Fix eslint (i don't think this was ever working :/) 2024-04-06 20:03:37 +01:00
gnuxie 326d95df67 fix listUnstarted appservice integration test. 2024-04-06 20:03:37 +01:00
gnuxie ad01b09773 Fix appservice provisioning. 2024-04-06 20:03:37 +01:00
gnuxie 0b658fb5d0 fix roomsTests.ts 2024-04-06 20:03:37 +01:00
gnuxie 9a47ec3204 fix redactCommandTest. 2024-04-06 20:03:37 +01:00
gnuxie 02d9712e12 remove standardConsequenceTest
superseded with capability providers in MPS.
We forgot to remove the test.
2024-04-06 20:03:37 +01:00
gnuxie 704e9b94c3 remove roomMembersTest
this is superseded by `SetMembership` from MPS.
we forgot to remove the test.
2024-04-06 20:03:37 +01:00
gnuxie ae93e9c8d4 remove protectionSettingsTest
they now belong in MPS.
2024-04-06 20:03:37 +01:00
gnuxie 0613447e07 Remove banListTest
farewell old friend.
2024-04-06 20:03:37 +01:00
gnuxie 565df8b362 Delete protectedRoomsConfigTest.ts
We just don't have a way to test this right now without changing
a bunch of code. Which we would basically want to do to rewrite
the testing harness anyhow, so it's not worth it right now.
2024-04-06 20:03:37 +01:00
gnuxie c438eca08c Fix commandUtils
Alright, they're not using the safe emitter, but neither are the
consumers.
2024-04-06 20:03:37 +01:00
gnuxie 1d0c57cea8 fix throttleQueueTest 2024-04-06 20:03:37 +01:00
gnuxie c9db033043 fix utilsTest.ts 2024-04-06 20:03:37 +01:00
gnuxie 979bef6013 Revert "Attempt make draupnirFactory accessible to integration tests"
This reverts commit 68ca69882bd7627414951aef11985408fd29dec8.
2024-04-06 20:03:37 +01:00
gnuxie 6d52137501 Attempt make draupnirFactory accessible to integration tests
But this won't work as we'd have to mess about a lot with
the clientsinroommap
2024-04-06 20:03:37 +01:00
gnuxie 6ff8c52aca Remove detectFederationLagTest
idk this one might come back some time but we don't have the protection
and associated command anymore.
2024-04-06 20:03:37 +01:00
gnuxie c3cfad93e7 Fix shutdown room command test. 2024-04-06 20:03:37 +01:00
gnuxie 40ffa2a114 Fix hijack room command test. 2024-04-06 20:03:37 +01:00
gnuxie 692bc298e1 Add 'done' from mocha test context to draupnir test context. 2024-04-06 20:03:37 +01:00
gnuxie 0cb0beecb0 Tidy up helloTest slightly. 2024-04-06 20:03:37 +01:00
gnuxie 96428d617d Fix CommandReaderTest.ts. 2024-04-06 20:03:37 +01:00
gnuxie c1bfcf610e Begin moving from ConsequenceProvider to CapabilityProviderSet.
We gotta sort out the glue and the renderering yet.
2024-04-06 20:03:36 +01:00
gnuxie 8044a78fa6 Fix reportPollerTest (it works!) 2024-04-06 20:03:36 +01:00
gnuxie 2198c34b55 Chore: please typescript in abuseReportTest. 2024-04-06 20:03:36 +01:00
gnuxie 28d220142e Chore: Delete random crap that was accidentally comitted sometime 2024-04-06 20:03:36 +01:00
gnuxie 380f4b1a77 Update for ClientsInRoomsMap rework (MPS). 2024-04-06 20:03:36 +01:00
gnuxie c1215ab045 Create a test/tsconfig.json.
We then run this as part of the build step, then run tsc with the
original project file to get the side effect of emitting the source
files. Since the `test/tsconfig.json` has `noEmit: true`.
2024-04-06 20:03:36 +01:00
gnuxie 0dc7c84afd Fix BanPropagationProtectionTest (it works!)
However, it does hang because something is sat on the event loop,
i can't find out what yet.
2024-04-06 20:03:36 +01:00
gnuxie dba3aefca3 Fix acceptInviteFromSpaceTest. (it works!) 2024-04-06 20:03:36 +01:00
gnuxie e17ebe1ff0 Fix abuseReportTest (it works!). 2024-04-06 20:03:36 +01:00
gnuxie d718967a7c Fix hello test (it works).
Ok so this is pretty shit, i hate the integration test suite now.

The reason why we return the test functions with `as any` in the
hello test is because we had to remove `Record<string, any>` from
mocha's test context interface, otherwise the interface would
have been completely useless. Maybe there is a ts setting though
to not infer any from `this` at all? and just ignore those properties.

The tsconfig.json situation is a bit weird, i don't understand why
it's in this situation. However, it seems like we can try to
https://github.com/jaredpalmer/tsdx/issues/84#issuecomment-489690504
use this workaround so that ts language features work in the test
directory.

I think we should focus on doing as little effort as possible getting
these tests into working condition. If something is too complicated,
it will need removing. If we need to make additional tests,
this entire integration tests directory should be moved
to a legacy-integration directory and we can start afresh.

We should also ideally not integration tests as much as possible
and try to reuse the unit helpers from MPS.
This is even going to be critical later on.
2024-04-06 20:03:36 +01:00
gnuxie cc97c8550e Naively fix appservice integration tests. 2024-04-06 20:03:36 +01:00
gnuxie 3eb3bae085 Instantiate web apis in an appropriate place. 2024-04-06 20:03:36 +01:00
gnuxie 0c2d391ff4 Fix inverted boolean logic in CommandReader.
We couldn't read room references.
2024-04-06 20:03:35 +01:00
gnuxie ac4c447637 Start client in manual launch script.
Not doing this would just cause draupnir to exit.
2024-04-06 20:03:35 +01:00
gnuxie c6f198303d Start fixes to dev environment 2024-04-06 20:03:35 +01:00