@0x/contract-artifacts: Fix contract-artifacts tests

This commit is contained in:
Lawrence Forman 2020-10-20 23:24:42 -04:00
parent 72fc0c845a
commit 5df74d35d0

View File

@ -1,14 +1,17 @@
import * as chai from 'chai'; import * as chai from 'chai';
import { get } from 'lodash'; import {get} from 'lodash';
import 'mocha'; import 'mocha';
import * as artifacts from '../src/index'; import * as artifacts from '../src/index';
import { ObjectMap } from '../../types/lib'; import {FORBIDDEN_PROPERTIES, REQUIRED_PROPERTIES} from '../src/transform';
import { FORBIDDEN_PROPERTIES, REQUIRED_PROPERTIES } from '../src/transform';
const expect = chai.expect; const expect = chai.expect;
interface ObjectMap<T> {
[name: string]: T;
}
// For pure functions, we use local EVM execution in `@0x/base-contract` instead // For pure functions, we use local EVM execution in `@0x/base-contract` instead
// of making an eth_call. This requires the `deployedBytecode` from compiler output. // of making an eth_call. This requires the `deployedBytecode` from compiler output.
const CONTRACTS_WITH_PURE_FNS = [ const CONTRACTS_WITH_PURE_FNS = [
@ -24,7 +27,7 @@ const CONTRACTS_WITH_PURE_FNS = [
describe('Contract Artifacts', () => { describe('Contract Artifacts', () => {
it('should not include forbidden attributes', () => { it('should not include forbidden attributes', () => {
const forbiddenPropertiesByArtifact: { [name: string]: string[] } = {}; const forbiddenPropertiesByArtifact: {[name: string]: string[]} = {};
for (const [artifactName, artifact] of Object.entries(artifacts)) { for (const [artifactName, artifact] of Object.entries(artifacts)) {
for (const forbiddenProperty of FORBIDDEN_PROPERTIES) { for (const forbiddenProperty of FORBIDDEN_PROPERTIES) {
const rejectedValue = get(artifact, forbiddenProperty); const rejectedValue = get(artifact, forbiddenProperty);