Skip to content

The execution never stops with forEach #22

Description

@killmenot

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions