[PR #5675] [CLOSED] test: add regression tests for Prisma migration edge cases #5523

Closed
opened 2026-06-05 15:21:37 -04:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Mintplex-Labs/anything-llm/pull/5675
Author: @Arvuno
Created: 5/21/2026
Status: Closed

Base: masterHead: contrib/anything-llm/prisma-migration-test-v2


📝 Commits (1)

  • c0c0bfa test: add regression tests for Prisma migration edge cases

📊 Changes

1 file changed (+154 additions, -0 deletions)

View changed files

server/prisma/__tests__/migration.test.js (+154 -0)

📄 Description

Summary

  • Added regression tests for Prisma migration edge cases in server/prisma/__tests__/migration.test.js
  • Tests cover: migration idempotency, empty string handling in optional fields, and null vs undefined distinction in Prisma queries

Problem

No tests existed to ensure Prisma migrations are idempotent and handle edge cases like empty strings vs null, and null vs undefined correctly.

Solution

Added Jest tests covering:

  1. Idempotency: Running no-op operations multiple times produces consistent results
  2. Empty string: Empty strings in optional fields are preserved (not coerced to null)
  3. Null vs undefined: null explicitly nullifies a field; undefined leaves the field unchanged
  4. Sequential operations: Multiple sequential updates are idempotent

Tests

cd server && npm test -- --testPathPattern=migration

Risk / Compatibility

  • Risk: LOW
  • Affects: Tests only, no production code changes

🔄 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/Mintplex-Labs/anything-llm/pull/5675 **Author:** [@Arvuno](https://github.com/Arvuno) **Created:** 5/21/2026 **Status:** ❌ Closed **Base:** `master` ← **Head:** `contrib/anything-llm/prisma-migration-test-v2` --- ### 📝 Commits (1) - [`c0c0bfa`](https://github.com/Mintplex-Labs/anything-llm/commit/c0c0bfa1960373690e5e8fdfdeb0e85f64db0fec) test: add regression tests for Prisma migration edge cases ### 📊 Changes **1 file changed** (+154 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `server/prisma/__tests__/migration.test.js` (+154 -0) </details> ### 📄 Description ## Summary - Added regression tests for Prisma migration edge cases in `server/prisma/__tests__/migration.test.js` - Tests cover: migration idempotency, empty string handling in optional fields, and null vs undefined distinction in Prisma queries ## Problem No tests existed to ensure Prisma migrations are idempotent and handle edge cases like empty strings vs null, and null vs undefined correctly. ## Solution Added Jest tests covering: 1. **Idempotency**: Running no-op operations multiple times produces consistent results 2. **Empty string**: Empty strings in optional fields are preserved (not coerced to null) 3. **Null vs undefined**: `null` explicitly nullifies a field; `undefined` leaves the field unchanged 4. **Sequential operations**: Multiple sequential updates are idempotent ## Tests ```bash cd server && npm test -- --testPathPattern=migration ``` ## Risk / Compatibility - Risk: LOW - Affects: Tests only, no production code changes --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-06-05 15:21:37 -04:00
yindo closed this issue 2026-06-05 15:21:37 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#5523