2019-02-12 14:02:54 +00:00
|
|
|
/*global describe, it, config*/
|
2018-12-05 04:41:05 +00:00
|
|
|
const assert = require('assert');
|
|
|
|
const MyToken = require('Embark/contracts/MyToken');
|
|
|
|
const MyToken2 = require('Embark/contracts/MyToken2');
|
|
|
|
const EmbarkJS = require('Embark/EmbarkJS');
|
|
|
|
|
|
|
|
config({
|
2019-08-30 20:50:20 +00:00
|
|
|
namesystem: {
|
|
|
|
enabled: true,
|
|
|
|
"register": {
|
|
|
|
"rootDomain": "embark.eth",
|
|
|
|
"subdomains": {
|
|
|
|
"mytoken": "$MyToken",
|
|
|
|
"MyToken2": "$MyToken2"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2018-12-05 04:41:05 +00:00
|
|
|
contracts: {
|
2019-08-30 20:50:20 +00:00
|
|
|
deploy: {
|
|
|
|
"Token": {
|
|
|
|
deploy: false,
|
|
|
|
args: [1000]
|
|
|
|
},
|
|
|
|
"MyToken": {
|
|
|
|
instanceOf: "Token"
|
|
|
|
},
|
|
|
|
"MyToken2": {
|
|
|
|
instanceOf: "Token",
|
|
|
|
args: [2000]
|
|
|
|
}
|
2018-12-05 04:41:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
describe("ENS functions", function() {
|
2019-11-07 15:59:26 +00:00
|
|
|
it('should allow directives in ENS subdomains', async function() {
|
2018-12-05 04:41:05 +00:00
|
|
|
const myTokenAddress = await EmbarkJS.Names.resolve('mytoken.embark.eth');
|
|
|
|
assert.strictEqual(MyToken.options.address, myTokenAddress);
|
2018-12-20 16:55:04 +00:00
|
|
|
|
2018-12-05 04:41:05 +00:00
|
|
|
const myToken2Address = await EmbarkJS.Names.resolve('MyToken2.embark.eth');
|
|
|
|
assert.strictEqual(MyToken2.options.address, myToken2Address);
|
2018-12-20 16:55:04 +00:00
|
|
|
|
2018-12-05 04:41:05 +00:00
|
|
|
const myTokenName = await EmbarkJS.Names.lookup(MyToken.options.address.toLowerCase());
|
|
|
|
assert.strictEqual(myTokenName, 'mytoken.embark.eth');
|
2018-12-20 16:55:04 +00:00
|
|
|
|
2018-12-05 04:41:05 +00:00
|
|
|
const myToken2Name = await EmbarkJS.Names.lookup(MyToken2.options.address.toLowerCase());
|
|
|
|
assert.strictEqual(myToken2Name, 'MyToken2.embark.eth');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|