Comments (10)
@zivkaziv @ealush I can see other unit tests are failing. does that expected ? I will add unit test for isNegative & isPositive and then raise pr.
from vest.
@ealush @zivkaziv unit tests are working fine. But on my local example of vest with vanilla is not working. I will check it. Thanks.
from vest.
what should happen when:
enforce(0).isNegative() // ❓
or
enforce(0).isPositive() // ❓
from vest.
Hey @sagivStekolshik, that's an excellent question.
The truth is that whether zero is positive or negative is context dependent, and sometimes it is regarded as neither.
This means that we can arbitrarily decide how we want to treat it.
For example, we could decide that in both cases it is false
enforce(0).isNegative() // false
enforce(0).isPositive() // false
or even treat it always as true
enforce(0).isNegative() // true
enforce(0).isPositive() // true
In our case, I think it would be most intuitive to start with the negative case:
negative is everything that's smaller than zero
value < 0
So anything else would be considered as positive.
In that scenario 0
would be treated as positive.
The one exception is - how to deal with signed zero -0
, because:
-0 === 0 // true
Object.is(-0, 0) // false
But since signed zero is so rare in js, it might not even be worth looking at.
from vest.
My idea was using Math.sign()
to get the number or string(works as well)
sign function returns 0 or -0 according to MDN
so going the 0 -> false
route will be easier
going the 0 isPositive number
will be even easier as it can be the "negative" of isNegative
from vest.
Hi @ealush
I would like to work on this issue.
Please assign to me. I already started working on it and is there any diagram or documentation to get started?
Thanks,
from vest.
Is this issue still open?
from vest.
Hi @ealush
I would like to work on this issue.
Please assign to me. I already started working on it and is there any diagram or documentation to get started?
Thanks,
Is this issue still open?
Yes. No need to assign anyone, simply submit a pr and we'll get it merged 🙂
from vest.
@ganeshpatil0101 do you have a branch you can share with those changes that do not work? I might be able to help.
from vest.
@ealush Please review and merge the PR #433
New unit tests are added & all tests are passed.
I request you to test this feature with one real example as I am having issues to setup a vest - vanilla example on local.
Please let me know you if there any changes required.
Thanks.
from vest.
Related Issues (20)
- Dynamic fields HOT 6
- Vest@5 is ready! Help test it!
- Last next release does not include development builds in dist HOT 4
- Debounce HOT 9
- Pending info in summary HOT 7
- Omit without when HOT 5
- `skip` and `only` on the same level HOT 5
- Subscribe HOT 6
- Migration guide example code - eager -> mode HOT 1
- Problem with OmitWhen executing code when condition is true HOT 2
- Done and empty suite HOT 3
- In SvelteKit, all the asynchronous tests below do not work at all. HOT 1
- Cannot find name 'Predicate'. Did you mean 'Predicates'? HOT 5
- only.group missing HOT 4
- Stateless suite HOT 2
- isDate alway fails HOT 7
- Multiple groups using same tests function HOT 2
- Eager mode does not work in a group/omitWhen/skipWhen HOT 5
- Support for nested suites HOT 2
- isNotEmpty on a numeric field HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vest.