Skip to content

Instantly share code, notes, and snippets.

@adamcameron
Created Mar 17, 2022
Embed
What would you like to do?
Code for request.testBox fail
component {
request.testBox.debug("in pseudo constructor")
static {
request.testBox.debug("in static constructor")
}
function init() {
request.testBox.debug("in constructor")
}
function testMe() {
request.testBox.debug("in method")
}
}
import test.BaseSpec
component extends=BaseSpec {
function run() {
describe("Testing request.testbox.debug", () => {
it("should write to debug buffer", () => {
request.testbox.debug("hi?")
expect(this.$debugBuffer).toHaveLength(1)
expect(this.$debugBuffer[1].data).toBe("hi?")
})
fit("should write to debug buffer when called from a SUT", () => {
sut = new Adam()
sut.testMe()
messagesOnly = this.$debugBuffer.map((debugEntry) => debugEntry.data)
expect(messagesOnly).toHaveLength(4)
expect(messagesOnly).toBe([
"in static constructor",
"in pseudo constructor",
"in constructor",
"in method"
])
})
})
}
}
Component [test.unit.Adam] has no accessible Member with name [$DEBUGBUFFER]
Stacktrace The Error Occurred in
/app/testbox/system/BaseSpec.cfc: line 1451
1449: // add to debug output
1450: arrayAppend(
1451: this.$debugBuffer,
1452: {
1453: data : newVar,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment