Skip to content

Instantly share code, notes, and snippets.

@adamcameron
Created March 17, 2022 08:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamcameron/8532491d75d07d26f6ff3d39be99d532 to your computer and use it in GitHub Desktop.
Save adamcameron/8532491d75d07d26f6ff3d39be99d532 to your computer and use it in GitHub Desktop.
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