This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
function run() { | |
describe("Comparing behaviour of isObject across CF and Lucee", () => { | |
describe("Tests using isObject", () => { | |
describe("Tests when argument is scoped", () => { | |
var isObjectChecker = (component object) => isObject(arguments.object) | |
it("is a baseline happy path", () => { | |
var o = new Http() | |
expect(isObjectChecker(o)).toBeTrue() | |
}) | |
it("should throw an exception if the argument is not defined (THIS FAILS ON LUCEE)", () => { | |
expect(() => { | |
isObjectChecker() | |
}).toThrow() | |
}) | |
}) | |
describe("Analogous testing without explicit scoping", () => { | |
var isObjectCheckerWithoutExplicitScope = (component object) => isObject(object) | |
it("is a baseline happy path", () => { | |
var o = new Http() | |
expect(isObjectCheckerWithoutExplicitScope(o)).toBeTrue() | |
}) | |
it("should throw an exception if the argument is not defined (THIS PASSES ON LUCEE, WHICH IS INCONGRUOUS WITH EQUIVALENT SCOPED TEST)", () => { | |
expect(() => { | |
isObjectCheckerWithoutExplicitScope() | |
}).toThrow() | |
}) | |
}) | |
}) | |
describe("Analogous testing with isValid", () => { | |
describe("Tests when argument is scoped", () => { | |
var isValidComponentChecker = (component object) => isValid("component", arguments.object) | |
it("is a baseline happy path", () => { | |
var o = new Http() | |
expect(isValidComponentChecker(o)).toBeTrue() | |
}) | |
it("should throw an exception if the argument is not defined (THIS FAILS ON LUCEE)", () => { | |
expect(() => { | |
isValidComponentChecker() | |
}).toThrow() | |
}) | |
}) | |
describe("Analogous testing without explicit scoping", () => { | |
var isValidComponentCheckerWithoutExplicitScope = (component object) => isValid("component", object) | |
it("is a baseline happy path", () => { | |
var o = new Http() | |
expect(isValidComponentCheckerWithoutExplicitScope(o)).toBeTrue() | |
}) | |
it("should throw an exception if the argument is not defined (THIS PASSES ON LUCEE, WHICH IS INCONGRUOUS WITH EQUIVALENT SCOPED TEST)", () => { | |
expect(() => { | |
isValidComponentCheckerWithoutExplicitScope() | |
}).toThrow() | |
}) | |
}) | |
}) | |
describe("Analogous testing with isNull", () => { | |
describe("Tests when argument is scoped", () => { | |
var isNullChecker = (component object) => isNull(arguments.object) | |
it("is a baseline happy path", () => { | |
var o = new Http() | |
expect(isNullChecker(o)).toBeFalse() | |
}) | |
it("should not throw an exception if the argument is not defined", () => { | |
expect(() => { | |
isNullChecker() | |
}).notToThrow() | |
}) | |
}) | |
describe("Analogous testing with isNull without explicit scoping", () => { | |
var isNullCheckerWithoutExplicitScope = (component object) => isNull(object) | |
it("is a baseline happy path", () => { | |
var o = new Http() | |
expect(isNullCheckerWithoutExplicitScope(o)).toBeFalse() | |
}) | |
it("should not throw an exception if the argument is not defined", () => { | |
expect(() => { | |
isNullCheckerWithoutExplicitScope() | |
}).notToThrow() | |
}) | |
}) | |
}) | |
}) | |
} | |
tinyTest.runTests() | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment