Add client unit testing #74
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
#11 Add tests
luca0N/lanbassador
Reference
luca0N/lanbassador!74
Loading…
Reference in a new issue
No description provided.
Delete branch "dev_client_tests"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Add unit testing to the web app client using Vitest.
karma' tovitest' 3e27dfc024Add client unit testingto WIP: Add client unit testingab7dbb44feedf4cc9aacedf4cc9aac28eff1a35e28eff1a35e38e60eb4e8ab7dbb44fetoedf4cc9aacwas made to revert an erroneous change in the workflowedf4cc9aacto28eff1a35ewas made to fix an outdated source file which referenced the old path for ConfigManager28eff1a35eto38e60eb4e8was made to change the commit message, detailing that partial support for HttpClient was added.HttpClient will replace the direct fetch API used in the web app client because it has unit test support built-in, making it much easier to run this workflow.
ece238097820841f929020841f92903bce136eeaThe previous force-push operations (from
ece2380978to20841f9290, and from20841f9290to3bce136eea) were made to fix syntax errors in the code, and to remove WIP code that is not ready to be committed.The web app client set of tests are almost complete, and the remaining classes/source files that haven't had their unit testing counterpart added are the ones that are out of scope (like PreferencesManager.ts, which deals with browser cookies and is very simple, not too much complexity that can introduce bugs).
I am currently evaluating whether I will add unit testing for components in this pull request. Lanbassador does not have any custom components to test: all components used in the web app come from Material Angular.
Create the following unit tests for the LiveConnection class: 1. should connect: tests if the LiveConnection class is able to connect to the mock WebSocket server. 2. should not connect on protocol version mismatch: tests whether the onConnectionError event is called on protocol mismatch. If the server indicates that the protocol version announced by the client during the initial handshake is unsupported, then connection should fail, and the test shall pass. 3. should receive host history: tests whether LiveConnection can correctly receive the list of previously detected hosts (those in the history queue, which are hosts that have been detected prior to the current connection). In order to accomplish item no. 2 above, LiveConnection had to be slightly modified so that it calls the onConnectionError event, as opposed to throwing an Error.I am currently satisfied with the unit testing in Lanbassador, so this means that the time of merging this pull request is almost here.
WIP: Add client unit testingto Add client unit testingAs laid out in the commit
6a8e328de3message, I had to changeLiveConnectionslightly so that it would call theonConnectionErrorevent instead of throwingErrors on unsuccessful return actions. I have also modified the signature for that event so that it could provide more information about the connection error, instead of it just being a callback with no parameters.The reason behind this decision is that I was unsuccessful at my attempts of getting Vitest to detect those errors being thrown, supposedly due to the fact that they were thrown inside the Subscriber. This pull request has already been dragged out for way too long, so these changes will suffice at this time.