Skip to content

Commit

Permalink
Simplify logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed May 7, 2023
1 parent 8744b23 commit b94bd58
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/plugins/instance/main.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { each } from 'test-each'

import { ErrorSubclasses } from '../../helpers/plugin.test.js'

const { hasOwnProperty: hasOwn } = Object.prototype

each(ErrorSubclasses, ({ title }, ErrorClass) => {
test(`plugin.instanceMethods are set on known errors | ${title}`, (t) => {
t.is(typeof new ErrorClass('message').getInstance, 'function')
Expand All @@ -15,7 +13,7 @@ each(ErrorSubclasses, ({ title }, ErrorClass) => {
})

test(`plugin.instanceMethods are inherited | ${title}`, (t) => {
t.false(hasOwn.call(new ErrorClass('message'), 'getInstance'))
t.false(Object.hasOwn(new ErrorClass('message'), 'getInstance'))
})

test(`plugin.instanceMethods are not enumerable | ${title}`, (t) => {
Expand Down
4 changes: 1 addition & 3 deletions src/subclass/create.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { each } from 'test-each'

import { ErrorClasses } from '../helpers/main.test.js'

const { hasOwnProperty: hasOwn } = Object.prototype

each(ErrorClasses, ({ title }, ErrorClass) => {
test(`Does not modify invalid classes | ${title}`, (t) => {
class custom extends Object {}
Expand All @@ -25,7 +23,7 @@ each(ErrorClasses, ({ title }, ErrorClass) => {

test(`error.name is correct | ${title}`, (t) => {
const error = new ErrorClass('test')
t.false(hasOwn.call(error, 'name'))
t.false(Object.hasOwn(error, 'name'))
t.is(error.name, ErrorClass.name)
})

Expand Down

0 comments on commit b94bd58

Please sign in to comment.