Skip to content

Commit

Permalink
Merge pull request #121 from Supercolony-net/bugfix/doc-traits
Browse files Browse the repository at this point in the history
Fix regression: Pass docs into metadata
  • Loading branch information
xgreenx authored May 27, 2022
2 parents 11c7c37 + aac1968 commit 9358a98
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 16 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
- uses: actions/checkout@v2
- name: Yarn install dependencies
run: |
n v14.18.1
yarn
yarn add ts-node
- name: Redspot Сompile
Expand All @@ -46,7 +47,7 @@ jobs:
yarn build:release
- name: Run Test Mocha
run: |
substrate-contracts-node --tmp --dev -lerror,runtime::contracts=debug,info,error,warning & P1=$!
substrate-contracts-node --tmp --dev & P1=$!
yarn test:mocha & P2=$!
wait $P2
kill $P1
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"@babel/plugin-transform-runtime": "^7.14.2",
"@babel/preset-env": "^7.7.4",
"@babel/register": "^7.7.4",
"@redspot/patract": "^0.13.5",
"@redspot/gas-reporter": "^0.13.5",
"@redspot/chai": "^0.13.4",
"@redspot/gas-reporter": "^0.13.5",
"@redspot/patract": "^0.13.5",
"@types/chai": "^4.3.0",
"@types/chai-as-promised": "^7.1.5",
"@types/mocha": "^8.0.3",
Expand All @@ -21,13 +21,14 @@
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0",
"redspot": "^0.13.5"
"redspot": "^0.13.5",
"ts-node": "^10.8.0"
},
"scripts": {
"build:release": "npx redspot compile --release",
"build": "npx redspot compile",
"test:redspot": "npx redspot test",
"test:mocha": "mocha --require @babel/register --require ts-node/register --require ./tests/setup/hooks.ts --recursive ./tests --extension \".ts\" --exit --timeout 20000",
"test:mocha": "mocha --require @babel/register --require ts-node/register --recursive ./tests --extension \".ts\" --exit --timeout 20000",
"test": "yarn build:release && yarn test:mocha"
}
}
7 changes: 7 additions & 0 deletions tests/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,14 @@ export const setupProxy = (contract, proxy): Contract => {
return patchContractMethods(proxied_contract);
}

function timeout(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}

export const setupContract = async (name, constructor, ...args) => {
await api.disconnect();
await timeout(100);
await api.connect();
const one = new BN(10).pow(new BN(api.registry.chainDecimals[0]))
const signers = await getSigners()
const defaultSigner = await getRandomSigner(signers[0], one.muln(10))
Expand Down
9 changes: 0 additions & 9 deletions tests/setup/hooks.ts

This file was deleted.

6 changes: 4 additions & 2 deletions utils/brush_lang/proc_macros/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,10 @@ pub(crate) fn impl_external_trait(
.unwrap(),
);
let mut attrs = method.attrs.clone();
method.attrs = extract_attr(&mut attrs, "doc");
method.attrs = extract_attr(&mut attrs, "ink");
method.attrs = [extract_attr(&mut attrs, "doc"), extract_attr(&mut attrs, "ink")]
.into_iter()
.flatten()
.collect();
ink_methods.insert(method.sig.ident.to_string(), method);
}
});
Expand Down

0 comments on commit 9358a98

Please sign in to comment.