File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,7 +26,9 @@ def isclass(ref):
2626 # if a js object prototype has more than one own property, it is a class
2727 proto_own_prop_names = pm .eval (
2828 'x=>(x?.prototype ? Object.getOwnPropertyNames(x?.prototype) : [])' )
29- return len (proto_own_prop_names (ref )) > 1
29+ # @TODO: what if instead of coming up with a better way, I just made it more cursed?
30+ is_es6_class = pm .eval ('x => /^class /.test(Function.prototype.toString.call(x))' )
31+ return len (proto_own_prop_names (ref )) > 1 or is_es6_class (ref )
3032
3133
3234def class_name (JSClass ):
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ class TestWallet(unittest.TestCase):
88
99 def test_smoke_keystore_address (self ):
1010 ks = dcp .wallet .get ()
11- self .assertTrue (isinstance ( ks , dcp .wallet .Keystore ))
11+ self .assertTrue (pm . eval ( "(x)=> x instanceof dcp.wallet.Keystore" )( ks . js_ref ))
1212
1313 address = ks .address
1414 self .assertTrue (isinstance (address , dcp .wallet .Address ))
You can’t perform that action at this time.
0 commit comments