Skip to content

Commit 1a15da9

Browse files
committed
test: verify order of views after duplication with exact order assertions
1 parent 780b08d commit 1a15da9

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

scenarios/user-journey/form-lifecycle/08-view-management.http

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -378,12 +378,17 @@ GET {{BASE_URL}}/forms/{{formId}}/views
378378
const data = JSON.parse(response.body);
379379
equal(data.length, 5, 'Should now have 5 views');
380380

381-
const views = data.slice().sort((a, b) => a.order - b.order);
382-
const originalIndex = views.findIndex(v => v.id === firstViewId);
383-
const dup1Index = views.findIndex(v => v.id === duplicatedViewId);
384-
const dup2Index = views.findIndex(v => v.id === duplicatedViewId2);
385-
equal(dup1Index > originalIndex, true, 'First duplicate should be after original');
386-
equal(dup2Index > originalIndex, true, 'Second duplicate should be after original');
381+
// Verify exact order values for each view
382+
const secondView = views.find(v => v.id === secondViewId);
383+
const thirdView = views.find(v => v.id === thirdViewId);
384+
const firstView = views.find(v => v.id === firstViewId);
385+
const dup2View = views.find(v => v.id === duplicatedViewId2);
386+
const dup1View = views.find(v => v.id === duplicatedViewId);
387+
equal(secondView.order, 0, 'Second view should have order 0');
388+
equal(thirdView.order, 1, 'Third view should have order 1');
389+
equal(firstView.order, 2, 'First view should have order 2');
390+
equal(dup2View.order, 3, 'Second duplicate should have order 3 (inserted right after original)');
391+
equal(dup1View.order, 4, 'First duplicate should have order 4 (pushed up by second duplicate)');
387392
});
388393
}}
389394

0 commit comments

Comments
 (0)