aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-doc/test/solidity_doc_generator_test.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-09-29 00:20:24 +0800
committerFabio Berger <me@fabioberger.com>2018-09-29 00:20:24 +0800
commit9ae60d0abe0ea32eb9dbfc48a9168d1996c674a0 (patch)
treecfdf41b5727cfeeea3b4586478078501cb92c825 /packages/sol-doc/test/solidity_doc_generator_test.ts
parent005a2e12bac3e0ca8762f627ec5e9df6d2991d6e (diff)
downloaddexon-sol-tools-9ae60d0abe0ea32eb9dbfc48a9168d1996c674a0.tar.gz
dexon-sol-tools-9ae60d0abe0ea32eb9dbfc48a9168d1996c674a0.tar.zst
dexon-sol-tools-9ae60d0abe0ea32eb9dbfc48a9168d1996c674a0.zip
Export class instead of function
Diffstat (limited to 'packages/sol-doc/test/solidity_doc_generator_test.ts')
-rw-r--r--packages/sol-doc/test/solidity_doc_generator_test.ts20
1 files changed, 13 insertions, 7 deletions
diff --git a/packages/sol-doc/test/solidity_doc_generator_test.ts b/packages/sol-doc/test/solidity_doc_generator_test.ts
index c780d3d31..ba08ebd00 100644
--- a/packages/sol-doc/test/solidity_doc_generator_test.ts
+++ b/packages/sol-doc/test/solidity_doc_generator_test.ts
@@ -5,16 +5,20 @@ import 'mocha';
import { DocAgnosticFormat, Event, SolidityMethod } from '@0xproject/types';
-import { generateSolDocAsync } from '../src/solidity_doc_generator';
+import { SolDoc } from '../src/sol_doc';
import { chaiSetup } from './util/chai_setup';
chaiSetup.configure();
const expect = chai.expect;
+let solDoc: SolDoc;
describe('#SolidityDocGenerator', () => {
+ before(() => {
+ solDoc = new SolDoc();
+ });
it('should generate a doc object that matches the devdoc-free TokenTransferProxy fixture', async () => {
- const doc = await generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, [
+ const doc = await solDoc.generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, [
'TokenTransferProxyNoDevdoc',
]);
expect(doc).to.not.be.undefined();
@@ -22,8 +26,8 @@ describe('#SolidityDocGenerator', () => {
verifyTokenTransferProxyABIIsDocumented(doc, 'TokenTransferProxyNoDevdoc');
});
const docPromises: Array<Promise<DocAgnosticFormat>> = [
- generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`),
- generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, []),
+ solDoc.generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`),
+ solDoc.generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, []),
];
docPromises.forEach(docPromise => {
it('should generate a doc object that matches the TokenTransferProxy fixture with its dependencies', async () => {
@@ -48,7 +52,7 @@ describe('#SolidityDocGenerator', () => {
});
});
it('should generate a doc object that matches the TokenTransferProxy fixture', async () => {
- const doc: DocAgnosticFormat = await generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, [
+ const doc: DocAgnosticFormat = await solDoc.generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, [
'TokenTransferProxy',
]);
verifyTokenTransferProxyABIIsDocumented(doc, 'TokenTransferProxy');
@@ -56,7 +60,7 @@ describe('#SolidityDocGenerator', () => {
describe('when processing all the permutations of devdoc stuff that we use in our contracts', () => {
let doc: DocAgnosticFormat;
before(async () => {
- doc = await generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, ['NatspecEverything']);
+ doc = await solDoc.generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, ['NatspecEverything']);
expect(doc).to.not.be.undefined();
expect(doc.NatspecEverything).to.not.be.undefined();
});
@@ -159,7 +163,9 @@ describe('#SolidityDocGenerator', () => {
});
});
it('should document a method that returns multiple values', async () => {
- const doc = await generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, ['MultipleReturnValues']);
+ const doc = await solDoc.generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, [
+ 'MultipleReturnValues',
+ ]);
expect(doc.MultipleReturnValues).to.not.be.undefined();
expect(doc.MultipleReturnValues.methods).to.not.be.undefined();
let methodWithMultipleReturnValues: SolidityMethod | undefined;