-
Notifications
You must be signed in to change notification settings - Fork 45
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 #90 from tonlabs/1.1.1-rc
1.1.1 rc
- Loading branch information
Showing
8 changed files
with
104 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import fs from 'fs' | ||
import path from 'path' | ||
|
||
import { doneTests, initTests, deleteFolderRecursive } from './init' | ||
import { StringTerminal, runCommand } from '..' | ||
|
||
const outPath = path.resolve(__dirname, '..', '..', `${Date.now()}-tmp`) | ||
|
||
beforeAll(initTests) | ||
afterAll(doneTests) | ||
beforeEach(() => deleteFolderRecursive(outPath)) | ||
afterEach(() => deleteFolderRecursive(outPath)) | ||
|
||
test('Should create HelloWallet.tvc in user defined output directory', async () => { | ||
const solPath = path.resolve(__dirname, '..', '..', 'contracts', 'HelloWallet.sol') | ||
|
||
const terminal = new StringTerminal() | ||
await runCommand(terminal, 'sol compile', { | ||
file: solPath, | ||
outputDir: outPath, | ||
}) | ||
expect(terminal.stderr.trim()).toEqual('') | ||
|
||
const tvcFile = path.resolve(outPath, 'HelloWallet.tvc') | ||
expect(fs.existsSync(tvcFile)).toBeTruthy() | ||
}) | ||
|
||
test('Should warn user to use options in camelCase', async () => { | ||
const solPath = path.resolve(__dirname, '..', '..', 'contracts', 'HelloWallet.sol') | ||
const terminal = new StringTerminal() | ||
try { | ||
await runCommand(terminal, 'sol compile', { | ||
file: solPath, | ||
'hello-world': 'hi!', | ||
}) | ||
throw Error("This function didn't throw") | ||
} catch (err: any) { | ||
expect(err.message).toMatch(/Unknow option: hello-world/) | ||
} | ||
}) |
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,32 @@ | ||
import path from 'path' | ||
|
||
import { doneTests, initTests, deleteFiles } from './init' | ||
import { StringTerminal, runCommand } from '..' | ||
|
||
beforeAll(initTests) | ||
afterAll(doneTests) | ||
|
||
test('Shoud create HelloWallet.abi.json file', async () => { | ||
const solPath = path.resolve(__dirname, '..', '..', 'contracts', 'HelloWallet.sol') | ||
const terminal = new StringTerminal() | ||
await runCommand(terminal, 'sol compile', { | ||
file: solPath, | ||
}) | ||
expect(terminal.stderr.trim()).toEqual('') | ||
}) | ||
|
||
test('Shoud create HelloWalletContract.js file', async () => { | ||
const wrappedJs = path.resolve(__dirname, '..', '..', 'HelloWalletContract.js') | ||
deleteFiles([wrappedJs]) | ||
|
||
const terminal = new StringTerminal() | ||
await runCommand(terminal, 'js wrap', { | ||
file: path.resolve(__dirname, '..', '..', 'HelloWallet.abi.json'), | ||
}) | ||
expect(terminal.stderr.trim()).toEqual('') | ||
|
||
const { HelloWalletContract } = await import(wrappedJs) | ||
expect(typeof HelloWalletContract).toEqual('object') | ||
|
||
deleteFiles([wrappedJs]) | ||
}) |
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