Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAlejandro Molina
3,997 PointsCan someone explain expect(true).to.be.ok further?
What is the difference between using "ok" or "true" for the end of this expect function? I'm not fully understanding the "truthy" concept.
2 Answers
Steven Parker
231,275 PointsTrue is a value, but .ok is a way to test for that value.
A value is considered "truthy" if it would satisfy an if statement. Most values are "truthy". The ones that are not are false, 0, an empty string (""), undefined, null and NaN.
Alejandro Molina
3,997 PointsAlejandro Molina
3,997 PointsAh I see. So it's just a way of making sure that a particular unit test is throwing valid data.