|
@@ -4,6 +4,7 @@ const { expect } = require('chai');
|
|
|
|
|
|
const ERC165CheckerMock = artifacts.require('ERC165CheckerMock');
|
|
|
const ERC165MissingData = artifacts.require('ERC165MissingData');
|
|
|
+const ERC165MaliciousData = artifacts.require('ERC165MaliciousData');
|
|
|
const ERC165NotSupported = artifacts.require('ERC165NotSupported');
|
|
|
const ERC165InterfacesSupported = artifacts.require('ERC165InterfacesSupported');
|
|
|
|
|
@@ -51,6 +52,38 @@ contract('ERC165Checker', function (accounts) {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
+ context('ERC165 malicious return data', function () {
|
|
|
+ beforeEach(async function () {
|
|
|
+ this.target = await ERC165MaliciousData.new();
|
|
|
+ });
|
|
|
+
|
|
|
+ it('does not support ERC165', async function () {
|
|
|
+ const supported = await this.mock.supportsERC165(this.target.address);
|
|
|
+ expect(supported).to.equal(false);
|
|
|
+ });
|
|
|
+
|
|
|
+ it('does not support mock interface via supportsInterface', async function () {
|
|
|
+ const supported = await this.mock.supportsInterface(this.target.address, DUMMY_ID);
|
|
|
+ expect(supported).to.equal(false);
|
|
|
+ });
|
|
|
+
|
|
|
+ it('does not support mock interface via supportsAllInterfaces', async function () {
|
|
|
+ const supported = await this.mock.supportsAllInterfaces(this.target.address, [DUMMY_ID]);
|
|
|
+ expect(supported).to.equal(false);
|
|
|
+ });
|
|
|
+
|
|
|
+ it('does not support mock interface via getSupportedInterfaces', async function () {
|
|
|
+ const supported = await this.mock.getSupportedInterfaces(this.target.address, [DUMMY_ID]);
|
|
|
+ expect(supported.length).to.equal(1);
|
|
|
+ expect(supported[0]).to.equal(false);
|
|
|
+ });
|
|
|
+
|
|
|
+ it('does not support mock interface via supportsERC165InterfaceUnchecked', async function () {
|
|
|
+ const supported = await this.mock.supportsERC165InterfaceUnchecked(this.target.address, DUMMY_ID);
|
|
|
+ expect(supported).to.equal(true);
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
context('ERC165 not supported', function () {
|
|
|
beforeEach(async function () {
|
|
|
this.target = await ERC165NotSupported.new();
|