Skip to content

Commit

Permalink
chore: updated isNonWritable to always strict equal
Browse files Browse the repository at this point in the history
  • Loading branch information
bizob2828 committed Sep 23, 2024
1 parent 27a3432 commit 9feeaed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
12 changes: 3 additions & 9 deletions test/lib/custom-assertions.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,15 @@ function assertCLMAttrs({ segments, enabled: clmEnabled, skipFull = false }) {
* @param {string} params.key key to assign value
* @param {string} params.value expected value of obj[key]
*/
function isNonWritable({ obj, key, value, complex }) {
function isNonWritable({ obj, key, value }) {
assert.throws(function () {
obj[key] = 'testNonWritable test value'
}, new RegExp("(read only property '" + key + "'|Cannot set property " + key + ')'))

if (value) {
assert.equal(obj[key], value)
} else if (complex) {
assert.notStrictEqual(
obj[key],
'testNonWritable test value',
'should not set value when non-writable'
)
assert.strictEqual(obj[key], value)
} else {
assert.notEqual(
assert.notStrictEqual(
obj[key],
'testNonWritable test value',
'should not set value when non-writable'
Expand Down
2 changes: 1 addition & 1 deletion test/unit/shim/shim.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ test('Shim', async function (t) {

await t.test('should be a non-writable property', function (t) {
const { shim } = t.nr
isNonWritable({ obj: shim, key: 'logger', complex: true })
isNonWritable({ obj: shim, key: 'logger' })
})

await t.test('should be a logger to use with the shim', function (t) {
Expand Down

0 comments on commit 9feeaed

Please sign in to comment.