Explorar el Código

Refactor shouldSupportInterfaces helper (#5358)

Hadrien Croubois hace 10 meses
padre
commit
6dacc68c46
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  1. 6 0
      test/utils/introspection/SupportsInterface.behavior.js

+ 6 - 0
test/utils/introspection/SupportsInterface.behavior.js

@@ -93,6 +93,12 @@ const SIGNATURES = {
 const INTERFACE_IDS = mapValues(SIGNATURES, interfaceId);
 
 function shouldSupportInterfaces(interfaces = [], signatures = SIGNATURES) {
+  // case where only signatures are provided
+  if (!Array.isArray(interfaces)) {
+    interfaces = Object.keys(interfaces);
+    signatures = interfaces;
+  }
+
   interfaces.unshift('ERC165');
   signatures.ERC165 = SIGNATURES.ERC165;
   const interfaceIds = mapValues(signatures, interfaceId, ([name]) => interfaces.includes(name));