Created
September 21, 2012 12:29
-
-
Save mibalan/3761208 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/* Desired format for test */ | |
test("Foo test", function() { | |
var obj = document.getFooObject(); | |
if (ok(obj.someMethod, "FooObject implements <someMethod>")) { | |
var result = obj.someMethod(); | |
equal(result.length, 42, "Result has proper length"); | |
equal(result.bar, "BAZ", "The bar is where it should be"); | |
} | |
}) | |
/* This gets currently written as such */ | |
test("Foo test", function() { | |
var obj = document.getFooObject(); | |
ok(obj.someMethod, "FooObject implements <someMethod>"); | |
var methodSupported = !!obj.someMethod; | |
if (methodSupported) { | |
var result = obj.someMethod(); | |
equal(result.length, 42, "Result has proper length"); | |
equal(result.bar, "BAZ", "The bar is where it should be"); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment