Update isArray_ function and add test coverage

This commit is contained in:
Josh Susser
2010-02-24 19:35:32 -08:00
parent 5e3eb884ca
commit 6ca766d5ea
3 changed files with 20 additions and 11 deletions

View File

@@ -20,4 +20,21 @@ describe("jasmine.util", function() {
expect(destination).toEqual({foo: null});
});
});
describe("isArray_", function() {
it("should return true if the argument is an array", function() {
expect(jasmine.isArray_([])).toBe(true);
expect(jasmine.isArray_(['a'])).toBe(true);
expect(jasmine.isArray_(new Array())).toBe(true);
});
it("should return false if the argument is not an array", function() {
expect(jasmine.isArray_(undefined)).toBe(false);
expect(jasmine.isArray_({})).toBe(false);
expect(jasmine.isArray_(function() {})).toBe(false);
expect(jasmine.isArray_('foo')).toBe(false);
expect(jasmine.isArray_(5)).toBe(false);
expect(jasmine.isArray_(null)).toBe(false);
});
});
});