Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The execution never stops with forEach #22

Open
killmenot opened this issue Jul 26, 2018 · 0 comments
Open

The execution never stops with forEach #22

killmenot opened this issue Jul 26, 2018 · 0 comments

Comments

@killmenot
Copy link
Contributor

Hi @robtweed

During fixing memory db that I use for tests I found an interesting scenario that breaks forEachChild. The execution never stops for me.

It relates with the following functionality:
https://github.com/robtweed/ewd-document-store/blob/master/lib/proto/forEach.js#L78

The test case:

var documentStore = new DocumentStore(db); // db - GTM
var documentNode = new documentStore.DocumentNode('temp');

documentNode.delete();

var foo = {
  a: 'this is a',
  b: 'this is b',
  Barton: 'J',
  Briggs: 'A',
  Davies: 'D',
  Davis: 'T',
  Douglas: 'N',
  c: ['a', 's', 'd'],
  d: {
    a: 'a',
    b: 'b'
  }
};

documentNode.$('foo').setDocument(foo);

documentNode.$('foo').forEachChild({
  range: {
    to: '123'
  }
}, function (nodeName, node) {
  // do somethng
});

Even if the test case is not correct, I think we need to handle this behaviour. Another question, could you please provide me with example of correct test case for https://github.com/robtweed/ewd-document-store/blob/master/lib/proto/forEach.js#L78 I guess it should work with arrays only

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant