Permalink
Browse files

spotlight: Add unit test for circular references of siblings. [jddalton]

  • Loading branch information...
1 parent 88e5f8c commit 359e3d3994ef69c9ae5bb8d399c7950f31ecc262 @jdalton jdalton committed Dec 18, 2011
Showing with 13 additions and 2 deletions.
  1. +13 −2 tests/tests.js
View
@@ -204,10 +204,14 @@
deepEqual(result.slice(0, 3), expected, 'multiple matches');
- window.a = { 'foo': { 'b': { 'foo': { 'c': { 'foo': null } } } } };
+ window.a = {
+ 'foo': { 'b': { 'foo': { 'c': { } } } },
+ 'bar': { 'b': { } }
+ };
a.foo.b.foo.c.foo = a;
+ a.bar.b = a.foo.b;
- // qunit can't handle circular references :/
+ // QUnit can't handle circular references :/
result = simplify(spotlight.byName('foo'));
expected = [
rootName + '.a.foo -> (object)',
@@ -217,6 +221,13 @@
deepEqual(result.slice(0, 3), expected, 'circular references');
+ expected = [
+ rootName + '.a.bar.b.foo -> (object)',
+ rootName + '.a.bar.b.foo.c.foo -> (<' + rootName + '.a>)'
+ ];
+
+ deepEqual(result.slice(3, 5), expected, 'sibling containing circular references');
+
result = spotlight.byName(12);
strictEqual(result, null, 'incorrect argument');
});

0 comments on commit 359e3d3

Please sign in to comment.