Mercurial > browser-couch
changeset 14:fbee4473dbdd
Added more unit tests and fixed bugs unveiled by them.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Fri, 10 Apr 2009 14:46:52 -0700 |
parents | 07e8dc256570 |
children | 01237459756d |
files | browser-couch.js tests.js |
diffstat | 2 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/browser-couch.js Fri Apr 10 14:41:22 2009 -0700 +++ b/browser-couch.js Fri Apr 10 14:46:52 2009 -0700 @@ -129,7 +129,7 @@ }; this.delete = function Dictionary_delete(key) { - delete keysAndValues[keyIndex[key]]; + keysAndValues.splice(keyIndex[key], 1); sort(); };
--- a/tests.js Fri Apr 10 14:41:22 2009 -0700 +++ b/tests.js Fri Apr 10 14:46:52 2009 -0700 @@ -55,6 +55,10 @@ self.assertEqual(dict.has('foo'), true); self.assertEqual(dict.has('bar'), true); self.assertEqual(dict.has('spatula'), false); + dict.delete('bar'); + self.assertEqual(dict.getLength(), 1); + self.assertEqual(dict.getNthValue(0).a, 'hello'); + self.assertEqual(dict.has('foo'), true); }, testDbView_async: function(self) { BrowserCouch.get(