Using Testbox is ok to use `expect()` without usin...
# testing
j
Using Testbox is ok to use
expect()
without using
describe
and
it
? meaning just like an `assert()`:
Copy code
function testExpectationExamples () {
		var message = "A custom message can be prepended to the error message!";

		// toBe( expected, [message] ) : Assert something is equal to each other, no case is required
		var value = "myValue";
		expect(value).toBe("myvalue", message);
		expect(value).toBe("myValue", message);
		expect(value).toBe("MYVALUE", message);
}
a
If it works... sure. But why?
j
Our senior dev prefers xUnit style tests but really liked the
expect()
syntax
I was concerned this might be setting us up to break at version change
a
right. Well the one caveat is that I'd add is that yer using a tool in an "inappropriate" way, and ppl coming along after y'all are gonna look at it and go "what the *f**** were you lot thinking?" There's something to be said to using tooling the way it's expected to be used. Also: the BDD style of testing makes one's test feedback way clearer and more organised that xUnit style.
I can't see how Luis would change TestBox to tightly couple those expectations to need to be called n the context of an
it
callback. I can't see what the gain would be.
So you should be safe I reckon. But... I'd really think long and hard about what yer doing (which you might have already done, so... fine!)
TBH though... on other platforms it's pretty common for the expectation / assertion libs to be separate from the test framework anyhow. I'd think if anything, TestBox would be more likely to separate them out than couple them more tightly.
👍 1
l
yes, they are separate
the assertion and expectation libraries are separate from the actual bdd/tdd sytnaxes
1
a
So in theory one could use them on MXUnit or [some other fictitious CFML-based testing framework]
l
In theory
👍 1
🙇 1