Antoine du Hamel
b4a7d9f987
lib: make validateObject less affected by prototype tampering
...
PR-URL: https://github.com/nodejs/node/pull/42929
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2022-07-11 09:48:41 +01:00
mawaregetsuka
302fd02f71
lib: improve the coverage of the validator
...
PR-URL: https://github.com/nodejs/node/pull/42443
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2022-04-02 23:57:44 +01:00
voltrexmaster
b24ab473d5
test: use simplfied validator
...
The validators test should use the simplified `validateArray()`
validator.
PR-URL: https://github.com/nodejs/node/pull/39753
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com >
2021-08-15 11:08:49 -07:00
Rich Trott
330f25ef82
test: prepare for consistent comma-dangle lint rule
...
Make changes so that tests will pass when the comma-dangle settings
applied to the rest of the code base are also applied to tests.
PR-URL: https://github.com/nodejs/node/pull/37930
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is >
2021-04-01 23:14:29 -07:00
ExE Boss
beee53884d
lib: fix WebIDL object and dictionary type conversion
...
PR-URL: https://github.com/nodejs/node/pull/37047
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-02-08 17:02:16 -08:00
Denys Otrishko
6914b3798c
test: add tests for validateNumber/validateString
...
PR-URL: https://github.com/nodejs/node/pull/34672
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: Pranshu Srivastava <rexagod@gmail.com >
Reviewed-By: Ricky Zhou <0x19951125@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2020-08-09 14:51:08 -07:00
Denys Otrishko
c405e9b23c
lib: improve value validation utils
...
Add common validators: `validateArray`, `validateBoolean`,
`validateObject` and appropriate tests.
PR-URL: https://github.com/nodejs/node/pull/31480
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2020-02-10 21:40:41 +02:00
Ruben Bridgewater
e038d6a1cd
test: refactor common.expectsError
...
This completely refactors the `expectsError` behavior: so far it's
almost identical to `assert.throws(fn, object)` in case it was used
with a function as first argument. It had a magical property check
that allowed to verify a functions `type` in case `type` was passed
used in the validation object. This pattern is now completely removed
and `assert.throws()` should be used instead.
The main intent for `common.expectsError()` is to verify error cases
for callback based APIs. This is now more flexible by accepting all
validation possibilites that `assert.throws()` accepts as well. No
magical properties exist anymore. This reduces surprising behavior
for developers who are not used to the Node.js core code base.
This has the side effect that `common` is used significantly less
frequent.
PR-URL: https://github.com/nodejs/node/pull/31092
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2019-12-31 15:54:20 +01:00
cjihrig
3238232fc4
lib: rename validateSafeInteger to validateInteger
...
validateInteger() was renamed to validateSafeInteger() in
https://github.com/nodejs/node/pull/26572 . However, this
function also works with unsafe integers. This commit restores
the old name, and adds some basic tests.
PR-URL: https://github.com/nodejs/node/pull/29184
Refs: https://github.com/nodejs/node/pull/26572
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2019-08-19 11:55:22 -04:00