diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-07-16 20:38:27 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-07-16 20:38:27 +0800 |
commit | acff177c547dee049b97e4b051fe22e1efaf992c (patch) | |
tree | 4580187592aac7695c1edae15a6f68eea5b1078c /packages/abi-gen | |
parent | ffeb3194a8f5e68c266f0bc6c70c6c9ba0754ec6 (diff) | |
parent | 6bdee26c3037733ad198d54c1e88f3c7647ad230 (diff) | |
download | dexon-sol-tools-acff177c547dee049b97e4b051fe22e1efaf992c.tar dexon-sol-tools-acff177c547dee049b97e4b051fe22e1efaf992c.tar.gz dexon-sol-tools-acff177c547dee049b97e4b051fe22e1efaf992c.tar.bz2 dexon-sol-tools-acff177c547dee049b97e4b051fe22e1efaf992c.tar.lz dexon-sol-tools-acff177c547dee049b97e4b051fe22e1efaf992c.tar.xz dexon-sol-tools-acff177c547dee049b97e4b051fe22e1efaf992c.tar.zst dexon-sol-tools-acff177c547dee049b97e4b051fe22e1efaf992c.zip |
Merge branch 'v2-prototype' into feature/order-watcher-v2
Diffstat (limited to 'packages/abi-gen')
-rw-r--r-- | packages/abi-gen/test/utils_test.ts | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/packages/abi-gen/test/utils_test.ts b/packages/abi-gen/test/utils_test.ts index c6147df38..820c0c675 100644 --- a/packages/abi-gen/test/utils_test.ts +++ b/packages/abi-gen/test/utils_test.ts @@ -2,7 +2,6 @@ import * as chai from 'chai'; import * as dirtyChai from 'dirty-chai'; import * as fs from 'fs'; import 'mocha'; -import * as sleep from 'sleep'; import * as tmp from 'tmp'; import { utils } from '../src/utils'; @@ -13,8 +12,6 @@ chai.use(dirtyChai); const expect = chai.expect; -const SLEEP_MS = 10; // time to wait before re-timestamping a file - describe('makeOutputFileName()', () => { it('should handle Metacoin usage', () => { expect(utils.makeOutputFileName('Metacoin')).to.equal('metacoin'); @@ -65,19 +62,22 @@ describe('isOutputFileUpToDate()', () => { describe('with an existing output file', () => { let outputFile: string; before(() => { - sleep.msleep(SLEEP_MS); // to ensure different timestamp outputFile = tmp.fileSync( { discardDescriptor: true }, // close file (set timestamp) ).name; + const abiFileModTimeMs = fs.statSync(abiFile).mtimeMs; + const outfileModTimeMs = abiFileModTimeMs + 1; + fs.utimesSync(outputFile, outfileModTimeMs, outfileModTimeMs); }); - it('should return true when output file and is newer than abi file', async () => { + it('should return true when output file is newer than abi file', async () => { expect(utils.isOutputFileUpToDate(abiFile, outputFile)).to.be.true(); }); it('should return false when output file exists but is older than abi file', () => { - sleep.msleep(SLEEP_MS); // to ensure different timestamp - fs.closeSync(fs.openSync(abiFile, 'w')); // touch abi file + const outFileModTimeMs = fs.statSync(outputFile).mtimeMs; + const abiFileModTimeMs = outFileModTimeMs + 1; + fs.utimesSync(abiFile, abiFileModTimeMs, abiFileModTimeMs); expect(utils.isOutputFileUpToDate(abiFile, outputFile)).to.be.false(); }); |