Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web3 utils full test coverage for types #2084

Merged
merged 62 commits into from
Dec 6, 2018
Merged

Web3 utils full test coverage for types #2084

merged 62 commits into from
Dec 6, 2018

Conversation

joshstevens19
Copy link
Contributor

Hi @nivida

I have gone through the utils repo and got the dtslint within all the typings. We have full test coverage on all of the types now (look at `test.ts file, it's to big so you have to expand it ha ha).

I have added this in the npm test step as well which will run before jest. We have everything nearly strongly typed so if you could supply me with the interface of the last few objects below we can have a fully supported ts for web3-utils :)

  • _jsonInterfaceMethodToString - json parameter ?
  • _flattenTypes - puts parameter ?

Have a look through - this is going to be the foundations for all testing of all types in all packages.

Oh and i spotted some docs incorrect while doing it so i corrected that as well.

Cheers

packages/web3-utils/package.json Outdated Show resolved Hide resolved
packages/web3-utils/types/test.ts Outdated Show resolved Hide resolved
packages/web3-utils/types/tsconfig.json Outdated Show resolved Hide resolved
packages/web3-utils/types/tsconfig.json Show resolved Hide resolved
packages/web3-utils/types/tslint.json Show resolved Hide resolved
@joshstevens19
Copy link
Contributor Author

Abstracted everything out into single tests.. much cleaner 👍

@nivida nivida added the Enhancement Includes improvements or optimizations label Dec 1, 2018
@joshstevens19
Copy link
Contributor Author

joshstevens19 commented Dec 2, 2018

@nivida it be good to strongly type these last 2 objects before we merge in

_jsonInterfaceMethodToString - json parameter ?
_flattenTypes - puts parameter ?

Can you let me know what object you expect for those?

@nivida
Copy link
Contributor

nivida commented Dec 2, 2018

@joshstevens19
flattenTypes could be removed this method will no longer be used.
_jsonInterfaceMethodToString: This method get an ABI item json object.

@joshstevens19
Copy link
Contributor Author

can i remove the method for _flattenTypes as well while at it then so they are both in sync ?

Ok will add AbiItem in here for now - will be moved out later in a more generic place once defined.

@nivida
Copy link
Contributor

nivida commented Dec 2, 2018

@joshstevens19
FYI: The ABIItemModel I've created is the wrong object for here. But I think you mean the right one the JSON object we know from the generated ABI.

Yes you can remove this method thanks!

@joshstevens19
Copy link
Contributor Author

_flattenTypes is used in _jsonInterfaceMethodToString at the current time though?

@nivida
Copy link
Contributor

nivida commented Dec 2, 2018

Ou sorry. Yes, then this is the last place this method is used.

@joshstevens19
Copy link
Contributor Author

ok i will remove the export so we do not need it in the types 👍

packages/web3-utils/types/index.d.ts Outdated Show resolved Hide resolved
@joshstevens19 joshstevens19 changed the title Web3 utils full test coverage Web3 utils full test coverage for types Dec 2, 2018
packages/web3-utils/README.md Show resolved Hide resolved
packages/web3-utils/README.md Outdated Show resolved Hide resolved
packages/web3-utils/types/tests/ascii-to-hex-tests.ts Outdated Show resolved Hide resolved
packages/web3-utils/types/tests/ascii-to-hex-tests.ts Outdated Show resolved Hide resolved
packages/web3-utils/types/tests/bytes-to-hex-tests.ts Outdated Show resolved Hide resolved
packages/web3-utils/types/tests/from-ascii-tests.ts Outdated Show resolved Hide resolved
packages/web3-utils/types/tests/ascii-to-hex-tests.ts Outdated Show resolved Hide resolved
packages/web3-utils/types/tests/ascii-to-hex-tests.ts Outdated Show resolved Hide resolved
packages/web3-utils/types/tslint.json Outdated Show resolved Hide resolved
@nivida
Copy link
Contributor

nivida commented Dec 3, 2018

Don't forget to resolve the package.json conflicts. :-)

@joshstevens19
Copy link
Contributor Author

everything should be resolved now 👍

@nivida
Copy link
Contributor

nivida commented Dec 3, 2018

Great! Thanks Josh!
I will have a look at it in Switzerland I'll take off from Dubai in the next 10min.

packages/web3-utils/README.md Outdated Show resolved Hide resolved
packages/web3-utils/package.json Show resolved Hide resolved
packages/web3-utils/types/tests/ascii-to-hex-tests.ts Outdated Show resolved Hide resolved
packages/web3-utils/types/tests/ascii-to-hex-tests.ts Outdated Show resolved Hide resolved
packages/web3-utils/types/tests/ascii-to-hex-tests.ts Outdated Show resolved Hide resolved
packages/web3-utils/types/tests/get-unit-value-tests.ts Outdated Show resolved Hide resolved
packages/web3-utils/types/tests/get-unit-value-tests.ts Outdated Show resolved Hide resolved
packages/web3-utils/types/tests/get-unit-value-tests.ts Outdated Show resolved Hide resolved
packages/web3-utils/types/tests/hex-to-ascii-tests.ts Outdated Show resolved Hide resolved
packages/web3-utils/types/tests/hex-to-ascii-tests.ts Outdated Show resolved Hide resolved
@joshstevens19
Copy link
Contributor Author

wow all your comments i fixed but i rebased and it must of killed all of these grrrrrrr i will sort again when i get a second 👍

@joshstevens19
Copy link
Contributor Author

@nivida so i have fixed those comments again - bloody git! had to do some git black magic to find it .. should be good now 😄

@nivida
Copy link
Contributor

nivida commented Dec 4, 2018

I'll test it tomorrow and when all tests run as expected I'll merge it.
Thanks 👍

@nivida nivida merged commit b6ec6cb into web3:ethereumProvider Dec 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Includes improvements or optimizations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants