Merge branch 'v2-prototype' into v2-contract-wrappers-WIP

This commit is contained in:
Leonid Logvinov
2018-07-05 17:00:50 +03:00
committed by GitHub
13 changed files with 575 additions and 92 deletions

View File

@@ -1,4 +1,14 @@
[
{
"version": "0.2.13",
"changes": [
{
"note":
"Fix bug in string enum assertion. We erroneously were checking against the enum keys, not values",
"pr": 821
}
]
},
{
"timestamp": 1529397769,
"version": "0.2.12",

View File

@@ -41,8 +41,8 @@ export const assert = {
value: string,
stringEnum: any /* There is no base type for every string enum */,
): void {
const doesBelongToStringEnum = !_.isUndefined(stringEnum[value]);
const enumValues = _.keys(stringEnum);
const enumValues = _.values(stringEnum);
const doesBelongToStringEnum = _.includes(enumValues, value);
const enumValuesAsStrings = _.map(enumValues, enumValue => `'${enumValue}'`);
const enumValuesAsString = enumValuesAsStrings.join(', ');
assert.assert(