net-snmp 3.19.0 → 3.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/index.js +1 -1
- package/package.json +1 -1
- package/test/object-types.test.js +11 -0
package/README.md
CHANGED
@@ -3465,6 +3465,10 @@ Example programs are included under the module's `example` directory.
|
|
3465
3465
|
|
3466
3466
|
* Remove deprecated isArray call and fix agent string constraints check
|
3467
3467
|
|
3468
|
+
## Version 3.19.1 - 03/03/2025
|
3469
|
+
|
3470
|
+
* Fix integer constraints check
|
3471
|
+
|
3468
3472
|
# License
|
3469
3473
|
|
3470
3474
|
Copyright (c) 2020 Mark Abrahams <mark@abrahams.co.nz>
|
package/index.js
CHANGED
@@ -672,7 +672,7 @@ ObjectTypeUtil.isValid = function (type, value, constraints) {
|
|
672
672
|
if ( isNaN(parsedValue) || ! Number.isInteger(parsedValue) || parsedValue < MIN_SIGNED_INT32 || parsedValue > MAX_SIGNED_INT32 ) {
|
673
673
|
return false;
|
674
674
|
}
|
675
|
-
if ( constraints && ObjectTypeUtil.doesIntegerMeetConstraints (parsedValue, constraints) ) {
|
675
|
+
if ( constraints && ! ObjectTypeUtil.doesIntegerMeetConstraints (parsedValue, constraints) ) {
|
676
676
|
return false;
|
677
677
|
}
|
678
678
|
return true;
|
package/package.json
CHANGED
@@ -72,6 +72,17 @@ describe('Object Types', function() {
|
|
72
72
|
assert.equal(snmp.ObjectTypeUtil.isValid(snmp.ObjectType.Integer, 2147483648), false);
|
73
73
|
});
|
74
74
|
});
|
75
|
+
// Tests for constraints
|
76
|
+
describe('An integer at the bottom of the valid range is a valid Integer type', function() {
|
77
|
+
it('returns true', function() {
|
78
|
+
assert.equal(snmp.ObjectTypeUtil.isValid(snmp.ObjectType.Integer, 0, { ranges: [{ min: 0, max: 10 }] }), true);
|
79
|
+
});
|
80
|
+
});
|
81
|
+
describe('An integer outside the valid range is not an valid Integer type', function() {
|
82
|
+
it('returns false', function() {
|
83
|
+
assert.equal(snmp.ObjectTypeUtil.isValid(snmp.ObjectType.Integer, 11, { ranges: [{ min: 0, max: 10 }] }), false);
|
84
|
+
});
|
85
|
+
});
|
75
86
|
});
|
76
87
|
|
77
88
|
describe('isValid() - OctetString', function() {
|