Skip to content

Commit c973327

Browse files
committed
test: fixing broken maxSteps tests, removing icons.test
1 parent 2f296fc commit c973327

4 files changed

Lines changed: 11 additions & 38 deletions

File tree

src/core/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function parseWidthHeight(value) {
4040
* @property {boolean} autoSave - Whether to auto-save data
4141
* @property {number} maxWrites - Maximum number of writes allowed
4242
* @property {number} minWriteInterval - Minimum interval between writes
43-
* @property {number}maxSteps - Maximum rows in stepper tables
43+
* @property {number} maxSteps - Maximum rows in stepper tables
4444
* @property {string} randomSeed - Seed for random number generation
4545
* @property {string} deployURL - URL where app is deployed
4646
* @property {string} labURL - URL of the lab website

src/core/stepper/Stepper.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,9 @@ export class Stepper extends StepState {
181181
const itemsToAdd = Array.isArray(items) ? items : [items]
182182

183183
// Check if adding these items would exceed maxSteps
184-
if (this._states.length + itemsToAdd.length > config.maxStepperRows) {
185-
this._log.error(
186-
`Cannot append ${itemsToAdd.length} rows as it exceeds the safety limit of ${config.maxStepperRows}`
187-
)
188-
throw new Error(
189-
`Cannot append ${itemsToAdd.length} rows as it exceeds the safety limit of ${config.maxStepperRows}`
190-
)
184+
if (this._states.length + itemsToAdd.length > config.maxSteps) {
185+
this._log.error(`Cannot append ${itemsToAdd.length} rows as it exceeds the safety limit of ${config.maxSteps}`)
186+
throw new Error(`Cannot append ${itemsToAdd.length} rows as it exceeds the safety limit of ${config.maxSteps}`)
191187
}
192188

193189
// Try to add each item individually
@@ -233,9 +229,9 @@ export class Stepper extends StepState {
233229
const totalCombinations = processedColumns.reduce((total, [_, arr]) => total * arr.length, 1)
234230

235231
// Check if adding these combinations would exceed maxSteps
236-
if (this._states.length + totalCombinations > config.maxStepperRows) {
232+
if (this._states.length + totalCombinations > config.maxSteps) {
237233
throw new Error(
238-
`Cannot create ${totalCombinations} combinations: would exceed maximum of ${config.maxStepperRows} rows`
234+
`Cannot create ${totalCombinations} combinations: would exceed maximum of ${config.maxSteps} rows`
239235
)
240236
}
241237

@@ -314,8 +310,8 @@ export class Stepper extends StepState {
314310
const maxLength = Math.max(...processedColumns.map(([_, arr]) => arr.length))
315311

316312
// Check if adding these combinations would exceed maxSteps
317-
if (this._states.length + maxLength > config.maxStepperRows) {
318-
throw new Error(`Cannot create ${maxLength} combinations: would exceed maximum of ${config.maxStepperRows} rows`)
313+
if (this._states.length + maxLength > config.maxSteps) {
314+
throw new Error(`Cannot create ${maxLength} combinations: would exceed maximum of ${config.maxSteps} rows`)
319315
}
320316

321317
// Check if any column has a different length

tests/vitest/core/stepper/Stepper.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ describe('Stepper test', () => {
286286
})
287287

288288
it('should throw error when appending would exceed safety limit', () => {
289-
const maxRows = Number(config.maxStepperRows)
289+
const maxRows = Number(config.maxSteps)
290290
const items = Array(maxRows + 1).fill({ color: 'red', shape: 'circle' })
291291
expect(() => {
292292
stepper.append(items)
@@ -338,7 +338,7 @@ describe('Stepper test', () => {
338338
})
339339

340340
it('should throw error when outer would exceed safety limit', () => {
341-
const maxRows = Number(config.maxStepperRows)
341+
const maxRows = Number(config.maxSteps)
342342
// Create arrays that would generate more combinations than maxSteps
343343
const trials = {
344344
x: Array(100).fill('x'),
@@ -865,7 +865,7 @@ describe('Stepper test', () => {
865865
})
866866

867867
it('should throw error when zip would exceed safety limit', () => {
868-
const maxRows = Number(config.maxStepperRows)
868+
const maxRows = Number(config.maxSteps)
869869

870870
// Create arrays that would exceed the limit when zipped
871871
const trials = {

tests/vitest/core/utils/icons.test.js

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)