This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2226 from cgewecke/truffle-library
Generate truffle library webpack bundle for package main
- Loading branch information
Showing
4 changed files
with
112 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
const assert = require("assert"); | ||
|
||
describe("Truffle Library APIs", () => { | ||
// Avoid `npm test:raw` | ||
if (process.env.NO_BUILD) return; | ||
|
||
let truffle; | ||
before(function() { | ||
this.timeout(5000); | ||
truffle = require("../../../build/library.bundled.js"); | ||
}); | ||
|
||
it("truffle.build API definition", () => { | ||
assert(truffle.build, "build undefined"); | ||
assert(truffle.build.clean, "build.clean undefined"); | ||
assert(truffle.build.build, "build.build undefined"); | ||
}); | ||
|
||
it("truffle.create API definition", () => { | ||
assert(truffle.create, "create undefined"); | ||
assert(truffle.create.contract, "create.contract undefined"); | ||
assert(truffle.create.test, "create.test undefined"); | ||
assert(truffle.create.migration, "create.migration undefined"); | ||
}); | ||
|
||
it("truffle.console API definition", () => { | ||
// This one returns a constructor. | ||
assert(truffle.console, "console undefined"); | ||
}); | ||
|
||
it("truffle.contracts API definition", () => { | ||
assert(truffle.contracts.compile, "contracts.compile undefined"); | ||
assert( | ||
truffle.contracts.collectCompilations, | ||
"contracts.collectCompilations undefined" | ||
); | ||
assert( | ||
truffle.contracts.compileSources, | ||
"contracts.compileSources undefined" | ||
); | ||
assert( | ||
truffle.contracts.reportCompilationStarted, | ||
"contracts.reportCompilationStarted undefined" | ||
); | ||
assert( | ||
truffle.contracts.reportCompilationFinished, | ||
"contracts.reportCompilationFinished undefined" | ||
); | ||
assert( | ||
truffle.contracts.reportNothingToCompile, | ||
"contracts.reportNothingToCompile undefined" | ||
); | ||
assert( | ||
truffle.contracts.writeContracts, | ||
"contracts.writeContracts undefined" | ||
); | ||
}); | ||
|
||
it("truffle.package API definition", () => { | ||
assert(truffle.package.publish, "package.publish undefined"); | ||
assert(truffle.package.install, "package.install undefined"); | ||
assert(truffle.package.digest, "package.digest undefined"); | ||
assert( | ||
truffle.package.publishable_artifacts, | ||
"package.publishable_artifacts undefined" | ||
); | ||
}); | ||
|
||
it("truffle.test API", () => { | ||
assert(truffle.test.run, "test.run undefined"); | ||
assert(truffle.test.createMocha, "test.createMocha undefined"); | ||
assert(truffle.test.getAccounts, "test.getAccounts undefined"); | ||
assert( | ||
truffle.test.compileContractsWithTestFilesIfNeeded, | ||
"test.withTestFiles undefined" | ||
); | ||
assert( | ||
truffle.test.performInitialDeploy, | ||
"test.performInitialDeploy undefined" | ||
); | ||
assert( | ||
truffle.test.defineSolidityTests, | ||
"test.defineSolidityTests undefined" | ||
); | ||
assert(truffle.test.setJSTestGlobals, "test.setJSTestGlobals undefined"); | ||
}); | ||
|
||
it("truffle.version API", () => { | ||
assert(truffle.version, "truffle.version undefined"); | ||
}); | ||
|
||
it("truffle.ganache", () => { | ||
assert(truffle.ganache, "ganache undefined"); | ||
assert(truffle.ganache.provider, "ganache.provider undefined"); | ||
assert(truffle.ganache.server, "ganache.server undefined"); | ||
}); | ||
}); |