Skip to content

test(smokehouse): add numeric comparisons#2356

Merged
paulirish merged 3 commits intomasterfrom
gte_smokehouse
May 27, 2017
Merged

test(smokehouse): add numeric comparisons#2356
paulirish merged 3 commits intomasterfrom
gte_smokehouse

Conversation

@patrickhulce
Copy link
Collaborator

replaces #2353

@samccone samccone self-requested a review May 25, 2017 18:12

const PROTOCOL_TIMEOUT_EXIT_CODE = 67;
const RETRIES = 3;
const NUMERICAL_EXPECTATION_REGEXP = /(<|>)(\d+)/;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/^(<|>)(\d+)$/

to tighten it up a bit.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor

@samccone samccone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm % 1 comment

* - Greater than/less than operators, e.g. "<100", ">90"
* - Regular expressions
* - Strict equality
*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if i am reading your code correctly..

{string|number} actual
{RegExp|string} expected

I think these are the types

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nah it can be any, the Object.is catch-all does boolean and number expectations too, objects will also be passed in but will always be false

Copy link
Member

@paulirish paulirish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is nice. we did this sorta thing in pwmetrics and its been lovely.

one question


const PROTOCOL_TIMEOUT_EXIT_CODE = 67;
const RETRIES = 3;
const NUMERICAL_EXPECTATION_REGEXP = /^(<|>)(\d+)$/;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like it should handle <= as people would expect it, yah?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heh yeah I suppose you're right

@paulirish paulirish merged commit d5854b6 into master May 27, 2017
@paulirish paulirish deleted the gte_smokehouse branch May 27, 2017 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants