Skip to content

Commit

Permalink
expose test matrix through /testing folder
Browse files Browse the repository at this point in the history
  • Loading branch information
dwarakaprasad committed Mar 3, 2024
1 parent a2a4016 commit 18239b3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/support/matrix-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const appendTitle = (title, config, value) => {

export const fromMatrix = configMatrix => {
const configEntries = Object.entries(configMatrix);
const samples = configEntries.reduce((previousValue, currentValue) => {
const samples = configEntries.reduce((previousValue: any, currentValue: [string, any]) => {
const [config, configValues] = currentValue;
if (previousValue.length === 0) {
return configValues.map(value => [
Expand Down Expand Up @@ -37,15 +37,15 @@ export const fromMatrix = configMatrix => {
const applyExtendedMatrix = (matrixEntries, configMatrix) => {
const configEntries = Object.entries(configMatrix);
const additionalMatrixTemp = configEntries.reduce(
(currentArray, [configName, configValues]) => {
(currentArray, [configName, configValues]: [string, any]) => {
const currentConfigObjects = configValues.map(configValue => ({ [configName]: configValue }));
return currentArray
.map(existingConfig => currentConfigObjects.map(currentObject => ({ ...existingConfig, ...currentObject })))
.flat();
},
[{}],
);
const additionalMatrix = [];
const additionalMatrix: any = [];
while (additionalMatrixTemp.length > 0) {
additionalMatrix.push(additionalMatrixTemp.shift());
if (additionalMatrixTemp.length > 0) {
Expand All @@ -56,7 +56,7 @@ const applyExtendedMatrix = (matrixEntries, configMatrix) => {
let matrixName = entry[0];
const matrixConfig = entry[1];
let newValues = additionalMatrix[matrixIndex % additionalMatrix.length];
Object.entries(newValues).forEach(([configName, configValue]) => {
Object.entries(newValues).forEach(([configName, configValue]: [string, any]) => {
if (typeof configValue === 'object' && !Array.isArray(configValue)) {
const additionalValues = configValue.additional;
configValue = configValue.value;
Expand Down
9 changes: 9 additions & 0 deletions testing/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
export { default as getGenerator } from './get-generator.js';
export * from './helpers.js';

// test matrix
export * from '../test/support/application-samples.js';
export * from '../test/support/client-samples.js';
export { default as checkEnforcements } from '../test/support/check-enforcements.js';
export * from '../test/support/entity-samples.js';
export * from '../test/support/matrix-utils.js';
export * from '../test/support/matcher.js';
export * from '../test/support/server-samples.js';

0 comments on commit 18239b3

Please sign in to comment.