Over the past two weeks, I completed the migration of the project’s automated tests from Jest to Vitest and got the changes merged. After that, I started a new task: researching how to detect when two accounts log in under the same role. Week 7 began with a setback, as I was admitted to the hospital on Monday with severe stomach pain and spent the day receiving treatment and resting.
Learning Vitest and Migrating the Tests
When I returned on Tuesday, I watched Vitest tutorials before changing any project code. I learned how a test is structured: describe() groups related tests, it() defines a single test case, and expect() checks whether the result matches what we expect.
I then migrated 11 existing test files from Jest to Vitest, including the tests for Marks, Players, Events, Results and the Dashboard. The main difference I had to understand was how each framework handles mocks, which are fake versions of real functions used during testing. For example, a mocked navigation function does not actually move to another page. Instead, it records how it was called and returns a value we set in advance, so the test can check what the application tried to do.
Adding Tests for the Settings Page
I also added 11 new tests for the Settings page, covering saving changes, uploading files, editing templates and previewing PDFs, including the template editor and PDF preview I built in Week 5.
Each test renders the Settings page with mock data instead of the real database, acts like a user, and then checks the result. For example, one test clicks the Save button and checks that the updated settings are sent with the correct values, while another checks that a waiting message appears when a PDF is outdated or missing.
Getting Started on My Backend Project
During our weekly meeting in Week 8, Dr Shawn and I agreed that I would work on a backend project that solves a real problem within the company. My first step is to identify a suitable problem and prepare a proposal explaining how the solution would benefit the company.
Detecting Shared Logins
Alongside the proposal, I was given a separate task: building an alert system that detects when two similar accounts log in under the same role. This is exactly the problem I faced in Week 3, when I accidentally assigned the role “Judge 1” to two different judges during an event, and the system treated their scores as if they came from one judge. Dr Shawn advised me to focus on detection within the admin dashboard first.
The risk is that when two devices are logged in as the same judge, both save marks under the same role, so one device can quietly overwrite the other’s marks without anyone noticing. My research focused on detecting this from the login side, such as checking whether the same role is logged in on more than one device at the same time, and how the admin dashboard could flag it for review.
Next Week’s Plan
Next week, I plan to turn my research into a proposed solution for detecting shared logins and discuss it with Dr Shawn. After Dr Shawn reviews it, I will refine the solution based on the feedback and write it up as a GitHub issue, so the plan is clear before implementation begins.
At the same time, I will continue looking for a suitable problem for my backend project, so that I can start preparing that proposal as well.
0 Comments