fix: change assertFieldValue in test helpers to use deepEqual (#6739)

This commit is contained in:
Samriddhi
2023-01-09 23:21:13 +05:30
committed by GitHub
parent f1e5f22423
commit 5dbcaeb4e2
3 changed files with 7 additions and 7 deletions

View File

@@ -126,7 +126,7 @@ suite('Angle Fields', function() {
function() {
return null;
},
value: 2, expectedValue: 1},
value: 2, expectedValue: '1'},
{title: 'Force Mult of 30 Validator',
validator:
function(newValue) {
@@ -150,7 +150,7 @@ suite('Angle Fields', function() {
});
test('When Not Editing', function() {
this.field.setValue(suiteInfo.value);
assertFieldValue(this.field, suiteInfo.expectedValue);
assertFieldValue(this.field, +suiteInfo.expectedValue);
});
});
});

View File

@@ -202,11 +202,11 @@ suite('Number Fields', function() {
function() {
return null;
},
value: 2, expectedValue: 1},
value: 2, expectedValue: '1'},
{title: 'Force End with 6 Validator',
validator:
function(newValue) {
return String(newValue).replace(/.$/, '6');
return +String(newValue).replace(/.$/, '6');
},
value: 25, expectedValue: 26},
{title: 'Returns Undefined Validator', validator: function() {}, value: 2,
@@ -226,7 +226,7 @@ suite('Number Fields', function() {
});
test('When Not Editing', function() {
this.field.setValue(suiteInfo.value);
assertFieldValue(this.field, suiteInfo.expectedValue);
assertFieldValue(this.field, +suiteInfo.expectedValue);
});
});
});

View File

@@ -73,8 +73,8 @@ export function assertFieldValue(field, expectedValue, expectedText = undefined)
if (expectedText === undefined) {
expectedText = String(expectedValue);
}
chai.assert.equal(actualValue, expectedValue, 'Value');
chai.assert.equal(actualText, expectedText, 'Text');
chai.assert.deepEqual(actualValue, expectedValue);
chai.assert.deepEqual(actualText, expectedText);
}
/**