-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat(Utility): expose UUID generator #303
Conversation
d99f9aa
to
7b198da
Compare
Codecov Report
@@ Coverage Diff @@
## release #303 +/- ##
===========================================
+ Coverage 80.53% 80.67% +0.13%
===========================================
Files 94 95 +1
Lines 1115 1123 +8
Branches 186 186
===========================================
+ Hits 898 906 +8
Misses 217 217
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## release #303 +/- ##
===========================================
+ Coverage 80.53% 80.67% +0.13%
===========================================
Files 94 95 +1
Lines 1115 1123 +8
Branches 186 186
===========================================
+ Hits 898 906 +8
Misses 217 217
Continue to review full report at Codecov.
|
@@ -96,6 +96,7 @@ describe(`JWT Token Effects`, function() { | |||
}; | |||
|
|||
test(`should provide a cookie and store cookie message if the cookie is set`, () => { | |||
// tslint:disable-next-line deprecation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is getting deprecated, here, 118, 136, and 155?
@@ -14,6 +14,7 @@ describe(`retryWithBackoff`, function() { | |||
const error = new Error('bar'); | |||
const seenValues: {[idx: number]: number} = {}; | |||
|
|||
// tslint:disable-next-line deprecation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, so I will assume of
is getting deprecated.
Do we have a plan of updating our code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're actually just getting around a TSLint bug. The deprecation rule is triggered even though of
itself is not deprecated; only certain overloads are. We did this a bit here also GetTerminus/terminus-ui#1488
There is an open PR to fix this which would allow us to remove all of these disables. But since TSLint itself is deprecated I'm not holding my breath on it getting fixed.
@@ -50,7 +50,7 @@ describe(`event-objects`, function() { | |||
const actual: KeyboardEvent = createKeyboardEvent('keydown', KEYS.ENTER, target); | |||
expect(actual.code).toEqual(KEYS.ENTER.code); | |||
expect(actual.key).toEqual(KEYS.ENTER.code); | |||
expect(actual.keyCode).toEqual(KEYS.ENTER.keyCode); | |||
expect(actual.code).toEqual(KEYS.ENTER.code); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
duplicate of line 51
have we removed all references to keyCode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
I didn't do a full search as that's not the basis of this PR. I'm honestly not entirely sure how these were missed in the linting PR. They should have been flagged by the deprecation rule when it was implemented.
ngx-tools/src/uuid/uuid.spec.ts
Outdated
|
||
// Test Validity | ||
if (!uuidRegex.test(newUuid)) { | ||
done.fail(new Error('This is the error')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it's only a test but the message could be more descriptive: 'UUID is not valid'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops.. yeah definitely should make that better.
Looks like public-api.ts still needs to be updated. |
7b198da
to
705e5bf
Compare
705e5bf
to
957c842
Compare
957c842
to
3298a8a
Compare
Huh not sure how that got dropped. Re-added to public api 👍 |
@@ -220,7 +220,8 @@ | |||
"tsickle": "^0.34.0", | |||
"tslint": "^5.16.0", | |||
"typescript": "~3.2.1", | |||
"validate-commit-msg": "^2.14.0" | |||
"validate-commit-msg": "^2.14.0", | |||
"window-crypto": "^1.1.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need this to use window.crypto.getRandomValues
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only for testing. Jest doesn't have a polyfill for window.crypto
by default. So in order to test it as accurately as possible, I'm just polyfilling the functionality as a whole (vs just mocking it).
setItem: (key: string, value: any) => { | ||
storage[key] = value || ''; | ||
return storage[key]; | ||
}, | ||
removeItem: (key: string) => delete storage[key], | ||
clear: () => storage = {}, | ||
clear: () => (storage = {}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the parenthesis needed or for better readability?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kind of. Creating an assignment in a return statement can be confusing so we have a lint rule warning about this.
The ()
is just us being explicit that something is happening inside, then it returns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A better way for me to phrase it: It is not more readable, but the intent should be more clear.
ISSUES CLOSED: #91