aboutsummaryrefslogtreecommitdiffstats
path: root/packages/assert
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-07-05 22:00:50 +0800
committerGitHub <noreply@github.com>2018-07-05 22:00:50 +0800
commit01c6efeaf10524a9f412c7c638c99afcf0fd3070 (patch)
treefa5dc6f41c56970dd82e9bf0a8d407dee43f823b /packages/assert
parent22cf7bee5b089384d43e6df0101699491c17847f (diff)
parent87a7a4ad2d55641cbe06d7157df0d8f0996d033a (diff)
downloaddexon-sol-tools-01c6efeaf10524a9f412c7c638c99afcf0fd3070.tar
dexon-sol-tools-01c6efeaf10524a9f412c7c638c99afcf0fd3070.tar.gz
dexon-sol-tools-01c6efeaf10524a9f412c7c638c99afcf0fd3070.tar.bz2
dexon-sol-tools-01c6efeaf10524a9f412c7c638c99afcf0fd3070.tar.lz
dexon-sol-tools-01c6efeaf10524a9f412c7c638c99afcf0fd3070.tar.xz
dexon-sol-tools-01c6efeaf10524a9f412c7c638c99afcf0fd3070.tar.zst
dexon-sol-tools-01c6efeaf10524a9f412c7c638c99afcf0fd3070.zip
Merge branch 'v2-prototype' into v2-contract-wrappers-WIP
Diffstat (limited to 'packages/assert')
-rw-r--r--packages/assert/CHANGELOG.json10
-rw-r--r--packages/assert/src/index.ts4
2 files changed, 12 insertions, 2 deletions
diff --git a/packages/assert/CHANGELOG.json b/packages/assert/CHANGELOG.json
index 883d55f5b..b44cac4a1 100644
--- a/packages/assert/CHANGELOG.json
+++ b/packages/assert/CHANGELOG.json
@@ -1,5 +1,15 @@
[
{
+ "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",
"changes": [
diff --git a/packages/assert/src/index.ts b/packages/assert/src/index.ts
index 95c7b658b..8e18416c5 100644
--- a/packages/assert/src/index.ts
+++ b/packages/assert/src/index.ts
@@ -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(