aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-compiler/test
diff options
context:
space:
mode:
authorF. Eugene Aumson <gene@aumson.org>2018-08-16 07:01:57 +0800
committerF. Eugene Aumson <gene@aumson.org>2018-08-16 07:01:57 +0800
commit89202b7bdffe084511971e331f81dd5878f2a56c (patch)
tree09cfa210a6ef3f4e8cdcd46f940bda6f5e55f72c /packages/sol-compiler/test
parent20ac6936ac19b141723cc88f03acfeeb79b89958 (diff)
downloaddexon-sol-tools-89202b7bdffe084511971e331f81dd5878f2a56c.tar.gz
dexon-sol-tools-89202b7bdffe084511971e331f81dd5878f2a56c.tar.zst
dexon-sol-tools-89202b7bdffe084511971e331f81dd5878f2a56c.zip
clarify recompilation tests
Diffstat (limited to 'packages/sol-compiler/test')
-rw-r--r--packages/sol-compiler/test/compiler_test.ts14
1 files changed, 8 insertions, 6 deletions
diff --git a/packages/sol-compiler/test/compiler_test.ts b/packages/sol-compiler/test/compiler_test.ts
index 08799c14b..7e22ff0ef 100644
--- a/packages/sol-compiler/test/compiler_test.ts
+++ b/packages/sol-compiler/test/compiler_test.ts
@@ -64,7 +64,7 @@ describe('#Compiler', function(): void {
describe('after a successful compilation', () => {
const contract = 'Exchange';
let artifactPath: string;
- let timeCompiled: number;
+ let compilationTimestamp: number;
beforeEach(async () => {
compilerOpts.contracts = [contract];
@@ -75,23 +75,25 @@ describe('#Compiler', function(): void {
await new Compiler(compilerOpts).compileAsync();
- timeCompiled = (await fsWrapper.statAsync(artifactPath)).mtimeMs;
+ compilationTimestamp = (await fsWrapper.statAsync(artifactPath)).mtimeMs;
});
it('recompilation should update artifact when source has changed', async () => {
+ // append some meaningless data to the contract, so that its hash
+ // will change, so that the compiler will decide to recompile it.
fsWrapper.appendFileAsync(join(contractsDir, `${contract}.sol`), ' ');
await new Compiler(compilerOpts).compileAsync();
- const timeRecompiled = (await fsWrapper.statAsync(artifactPath)).mtimeMs;
+ const recompilationTimestamp = (await fsWrapper.statAsync(artifactPath)).mtimeMs;
- expect(timeRecompiled).to.not.equal(timeCompiled);
+ expect(recompilationTimestamp).to.be.greaterThan(compilationTimestamp);
});
it("recompilation should NOT update artifact when source hasn't changed", async () => {
await new Compiler(compilerOpts).compileAsync();
- const timeRecompiled = (await fsWrapper.statAsync(artifactPath)).mtimeMs;
+ const recompilationTimestamp = (await fsWrapper.statAsync(artifactPath)).mtimeMs;
- expect(timeRecompiled).to.equal(timeCompiled);
+ expect(recompilationTimestamp).to.equal(compilationTimestamp);
});
});
it('should only compile what was requested', async () => {