Skip to content

Commit

Permalink
NTR: add jest test for new cypress duration field
Browse files Browse the repository at this point in the history
  • Loading branch information
boxblinkracer committed Jan 2, 2024
1 parent 09a94ce commit 1b483c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/components/Cypress/TestData.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class TestData {
this._durationMS = 0;

if (data.duration) {
// this is since Cypress v13
this._durationMS = data.duration;
} else {
if (data.attempts !== undefined) {
Expand Down
7 changes: 7 additions & 0 deletions tests/Jest/components/Cypress/TestData.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ test('Duration is correctly summed up from attempts', () => {
expect(result.getDurationMS()).toBe(15);
});

test('New Cypress duration is correctly read', () => {
const result = new TestData({
'duration': 46,
});
expect(result.getDurationMS()).toBe(46);
});

test('Missing attempts lead to a duration of 0', () => {
const result = new TestData({});
expect(result.getDurationMS()).toBe(0);
Expand Down

0 comments on commit 1b483c7

Please sign in to comment.