-
Notifications
You must be signed in to change notification settings - Fork 1.4k
rename t.ok()
to t.truthy()
and t.notOk()
to t.falsy()
#716
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
Changes from 1 commit
fed5812
ce28519
2ed8103
0d12f75
3ca6bd1
14288c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -739,7 +739,7 @@ Assertions are mixed into the [execution object](#t) provided to each test callb | |
|
||
```js | ||
test(t => { | ||
t.ok('unicorn'); // assertion | ||
t.truthy('unicorn'); // assertion | ||
}); | ||
``` | ||
|
||
|
@@ -753,11 +753,11 @@ Passing assertion. | |
|
||
Failing assertion. | ||
|
||
### `.ok(value, [message])` | ||
### `.truthy(value, [message])` | ||
|
||
Assert that `value` is truthy. | ||
|
||
### `.notOk(value, [message])` | ||
### `.falsy(value, [message])` | ||
|
||
Assert that `value` is falsy. | ||
|
||
|
@@ -843,14 +843,14 @@ test(t => { | |
const a = /foo/; | ||
const b = 'bar'; | ||
const c = 'baz'; | ||
t.ok(a.test(b) || b === c); | ||
t.truthy(a.test(b) || b === c); | ||
}); | ||
``` | ||
|
||
Will output: | ||
|
||
``` | ||
t.ok(a.test(b) || b === c) | ||
t.truthy(a.test(b) || b === c) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| | | | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add two spaces to align There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated. Thanks @jfmengels and @forresst |
||
| "bar" "bar" "baz" | ||
false | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import test from '../../'; | ||
|
||
test('this is a passing test', t => { | ||
t.ok(true); | ||
t.truthy(true); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
}); | ||
|
||
test('this is a failing test', t => { | ||
t.ok(false); | ||
t.truthy(false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was going to go through and update some of these to a more sensible test, but decided to opt for a direct refactor. I'll go through and update these to be better 👍 |
||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,11 @@ import test from '../../'; | |
test.serial(t => { | ||
const a = 'foo'; | ||
|
||
t.ok(a === 'bar'); | ||
t.truthy(a === 'bar'); | ||
}); | ||
|
||
test.serial(t => { | ||
const a = 'bar'; | ||
|
||
t.ok(a === 'foo', 'with message'); | ||
t.truthy(a === 'foo', 'with message'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, these should just be |
||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ test.cb('long running', t => { | |
}, {alwaysLast: true}); | ||
|
||
setTimeout(() => { | ||
t.ok(true); | ||
t.truthy(true); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
t.end(); | ||
}); | ||
|
||
|
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.
t.true()