aboutsummaryrefslogtreecommitdiffstats
path: root/packages/abi-gen/test/utils_test.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-07-17 18:06:35 +0800
committerFabio Berger <me@fabioberger.com>2018-07-17 18:06:35 +0800
commit03a6a088c5f1a086c1f3f02a0a70edaea3603860 (patch)
treebbe67afd2ad3d902444da65964c7401c9d38d63d /packages/abi-gen/test/utils_test.ts
parent1e787a764615bd3df839f2cb117b711be297b9d5 (diff)
parenta9038f2afc974cecf567a9aef50267d29a995e02 (diff)
downloaddexon-sol-tools-03a6a088c5f1a086c1f3f02a0a70edaea3603860.tar
dexon-sol-tools-03a6a088c5f1a086c1f3f02a0a70edaea3603860.tar.gz
dexon-sol-tools-03a6a088c5f1a086c1f3f02a0a70edaea3603860.tar.bz2
dexon-sol-tools-03a6a088c5f1a086c1f3f02a0a70edaea3603860.tar.lz
dexon-sol-tools-03a6a088c5f1a086c1f3f02a0a70edaea3603860.tar.xz
dexon-sol-tools-03a6a088c5f1a086c1f3f02a0a70edaea3603860.tar.zst
dexon-sol-tools-03a6a088c5f1a086c1f3f02a0a70edaea3603860.zip
Merge branch 'v2-prototype' into fix-order-watcher
* v2-prototype: (39 commits) Add chris to website Fix ocean link Move update onboarding step tracking to onboarding flow code Bump npm-run-all from 4.1.2 to 4.1.3 Move format to helper function Fix linter Add assertion to make sure caller to fetchAsync isn't trying to set timeout in a context-specific way Fix linter issues Remove unused import Switch conditional Update yarn.lock and artifact Fix abi-gen tests to not rely on sleep, since it causes intermittent failures Add missing assertion Move type defs to typescript-typingsd Fix linter Make createFinalPayload protected Replace process.browser with detect-node library Export Web3ProviderEngine and RPCSubprovider from 0x.js Export Web3ProviderEngine from subproviders package Update deps ...
Diffstat (limited to 'packages/abi-gen/test/utils_test.ts')
-rw-r--r--packages/abi-gen/test/utils_test.ts14
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();
});