From 2f4bcee5cea9c753226fe982275f0661a2e0d38a Mon Sep 17 00:00:00 2001 From: Scott Kyle Date: Tue, 3 Nov 2015 14:45:06 -0800 Subject: [PATCH] Update test to ensure unique listener callback behavior --- tests/RealmTests.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/RealmTests.js b/tests/RealmTests.js index e288dd7a..dc12c852 100644 --- a/tests/RealmTests.js +++ b/tests/RealmTests.js @@ -289,8 +289,11 @@ module.exports = BaseTest.extend({ var secondNotificationCount = 0; function secondNotification(realm, name) { secondNotificationCount++; - }; - realm.addListener('change', secondNotification) + } + + // The listener should only be added once. + realm.addListener('change', secondNotification); + realm.addListener('change', secondNotification); realm.write(function() {}); TestCase.assertEqual(notificationCount, 2);