[PR #3144] [MERGED] 🔧 improve unit test stability while using uuid #4705

Closed
opened 2026-02-28 20:59:57 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/3144
Author: @MatissJanis
Created: 7/27/2024
Status: Merged
Merged: 7/27/2024
Merged by: @MatissJanis

Base: masterHead: matiss/migration-tests


📝 Commits (1)

  • ce14931 🔧 improve unit test stability while using uuid

📊 Changes

2 files changed (+17 additions, -0 deletions)

View changed files

📝 packages/loot-core/src/mocks/setup.ts (+11 -0)
upcoming-release-notes/3144.md (+6 -0)

📄 Description

We use uuid package throughout the codebase to generate unique ids. In unit tests - we have mocked it (here https://github.com/actualbudget/actual/blob/master/packages/loot-core/src/mocks/setup.ts#L55-L60). For tests it generates a sequential ID. This works fine for the most part.

Until we add a new migration that also wants to use uuid. Migrations run before all other code. So a new migration using uuid messes up all test snapshots. Suddenly id5 becomes id6.

This solves the problem. No matter how many new migrations will be added - they will not mess up the snapshots that rely on uuid.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/3144 **Author:** [@MatissJanis](https://github.com/MatissJanis) **Created:** 7/27/2024 **Status:** ✅ Merged **Merged:** 7/27/2024 **Merged by:** [@MatissJanis](https://github.com/MatissJanis) **Base:** `master` ← **Head:** `matiss/migration-tests` --- ### 📝 Commits (1) - [`ce14931`](https://github.com/actualbudget/actual/commit/ce1493180ee2917dd2bc35302d24b47c1e629b43) :wrench: improve unit test stability while using uuid ### 📊 Changes **2 files changed** (+17 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/loot-core/src/mocks/setup.ts` (+11 -0) ➕ `upcoming-release-notes/3144.md` (+6 -0) </details> ### 📄 Description We use uuid package throughout the codebase to generate unique ids. In unit tests - we have mocked it (here https://github.com/actualbudget/actual/blob/master/packages/loot-core/src/mocks/setup.ts#L55-L60). For tests it generates a sequential ID. This works fine for the most part. Until we add a new migration that also wants to use uuid. Migrations run before all other code. So a new migration using uuid messes up all test snapshots. Suddenly id5 becomes id6. This solves the problem. No matter how many new migrations will be added - they will not mess up the snapshots that rely on `uuid`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-02-28 20:59:57 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#4705