-
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.
Merge pull request #1179 from w3c/releases
Includes changes recently included in the [releases branch](https://github.com/w3c/aria-at-app/tree/releases) through #1178. [Latest CHANGELOG.md update: v1.6.0](https://github.com/w3c/aria-at-app/blob/releases/CHANGELOG.md#160-2024-07-29)
- Loading branch information
Showing
18 changed files
with
3,590 additions
and
33 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
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
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
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
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
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
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
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
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
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,64 @@ | ||
'use strict'; | ||
|
||
const { getMetrics } = require('shared'); | ||
const populateData = require('../services/PopulatedData/populateData'); | ||
const runnableTestsResolver = require('../resolvers/TestPlanReport/runnableTestsResolver'); | ||
const finalizedTestResultsResolver = require('../resolvers/TestPlanReport/finalizedTestResultsResolver'); | ||
const { | ||
updateTestPlanReportById | ||
} = require('../models/services/TestPlanReportService'); | ||
const getGraphQLContext = require('../graphql-context'); | ||
|
||
/** @type {import('sequelize-cli').Migration} */ | ||
module.exports = { | ||
async up(queryInterface, Sequelize) { | ||
return queryInterface.sequelize.transaction(async transaction => { | ||
const context = getGraphQLContext({ req: { transaction } }); | ||
|
||
const testPlanReports = await queryInterface.sequelize.query( | ||
`select distinct on ("TestPlanReport".id) "TestPlanReport".id, metrics | ||
from "TestPlanReport" | ||
join public."TestPlanRun" testPlanRun on "TestPlanReport".id = testPlanRun."testPlanReportId" | ||
where jsonb_array_length(testPlanRun."testResults") > 0;`, | ||
{ | ||
type: Sequelize.QueryTypes.SELECT, | ||
transaction | ||
} | ||
); | ||
|
||
for (const testPlanReport of testPlanReports) { | ||
const { testPlanReport: testPlanReportPopulated } = await populateData( | ||
{ testPlanReportId: testPlanReport.id }, | ||
{ context } | ||
); | ||
const runnableTests = runnableTestsResolver( | ||
testPlanReportPopulated, | ||
null, | ||
context | ||
); | ||
const finalizedTestResults = await finalizedTestResultsResolver( | ||
testPlanReportPopulated, | ||
null, | ||
context | ||
); | ||
const metrics = getMetrics({ | ||
testPlanReport: { | ||
...testPlanReportPopulated, | ||
finalizedTestResults, | ||
runnableTests | ||
} | ||
}); | ||
await updateTestPlanReportById({ | ||
id: testPlanReportPopulated.id, | ||
values: { | ||
metrics: { | ||
...testPlanReportPopulated.metrics, | ||
...metrics | ||
} | ||
}, | ||
transaction | ||
}); | ||
} | ||
}); | ||
} | ||
}; |
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
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
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,26 @@ | ||
/** | ||
* @param {number} value | ||
* @param {number} total | ||
* @param {boolean} ignoreError - to account for cases where having a NaN is "expected" | ||
* @returns {number} | ||
*/ | ||
const calculatePercentage = (value, total, { ignoreError = true } = {}) => { | ||
if (!ignoreError && total === 0) { | ||
throw new Error("Unable to divide. 'total' cannot be 0."); | ||
} | ||
return (value / total) * 100; | ||
}; | ||
|
||
const trimDecimals = (number, decimals = 0) => { | ||
if (decimals === undefined || decimals <= 0) { | ||
return Math.floor(number); | ||
} else { | ||
let factor = Math.pow(10, decimals); | ||
return Math.floor(number * factor) / factor; | ||
} | ||
}; | ||
|
||
module.exports = { | ||
calculatePercentage, | ||
trimDecimals | ||
}; |
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
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
const calculations = require('./calculations'); | ||
const convertAssertionPriority = require('./convertAssertionPriority'); | ||
const getMetrics = require('./getMetrics'); | ||
module.exports = { convertAssertionPriority, getMetrics }; | ||
|
||
module.exports = { calculations, convertAssertionPriority, getMetrics }; |
Oops, something went wrong.