-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: terminology update for priority 3 (MAY), passed/failing -> suppo…
…rted/unsupported (#1150) This change does the following: * Adds migrator for mayFormatted * Updates UI strings for MAY assertion priorities from 'passed' to 'supported'
- Loading branch information
Showing
3 changed files
with
63 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
server/migrations/20240711160607-update-may-terminology.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
'use strict'; | ||
|
||
/** @type {import('sequelize-cli').Migration} */ | ||
const updateMetricsTerminology = async ( | ||
queryInterface, | ||
Sequelize, | ||
oldTerm, | ||
newTerm | ||
) => { | ||
const [reports] = await queryInterface.sequelize.query( | ||
'SELECT id, metrics FROM "TestPlanReport";' | ||
); | ||
|
||
const updatePromises = reports.map(report => { | ||
const { metrics } = report; | ||
|
||
if (metrics.mayFormatted) { | ||
metrics.mayFormatted = metrics.mayFormatted.replace(oldTerm, newTerm); | ||
} | ||
|
||
return queryInterface.sequelize.query( | ||
'UPDATE "TestPlanReport" SET metrics = :metrics WHERE id = :id', | ||
{ | ||
replacements: { | ||
metrics: JSON.stringify(metrics), | ||
id: report.id | ||
}, | ||
type: Sequelize.QueryTypes.UPDATE | ||
} | ||
); | ||
}); | ||
|
||
await Promise.all(updatePromises); | ||
}; | ||
|
||
module.exports = { | ||
up: async (queryInterface, Sequelize) => { | ||
await updateMetricsTerminology( | ||
queryInterface, | ||
Sequelize, | ||
'passed', | ||
'supported' | ||
); | ||
}, | ||
|
||
down: async (queryInterface, Sequelize) => { | ||
await updateMetricsTerminology( | ||
queryInterface, | ||
Sequelize, | ||
'supported', | ||
'passed' | ||
); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters