Level / abstract-level

Abstract class for a lexicographically sorted key-value database.
MIT License
128 stars 8 forks source link

relax test for simple iterator() #17

Closed ralphtheninja closed 1 year ago

ralphtheninja commented 7 years ago

See https://github.com/Level/abstract-leveldown/blob/master/abstract/iterator-test.js#L125-L128 , also rewrite the test a bit, since it doesn't really make sense to do e.g.

if (key && value) {
  t.ok(key, 'key exists')
  t.ok(value, 'value exists')
}

Maybe instead use a counter that unless the counter is at the end, then key and value should be set, if not, then check for undefined on err, key and value.

Also, remove https://github.com/Level/abstract-leveldown/blob/master/abstract/ranges-test.js#L14-L48 since it's basically the same test and doesn't add any value

vweevers commented 2 years ago

Relevant code is now here:

https://github.com/Level/abstract-level/blob/5bf853a0b7ca882652f3a630d6633da2f6e57f7d/test/iterator-test.js#L163-L197

Which I agree, should not check specific keys or values, just that it got one. In addition, subsequent tests are dependent on the data written in this test, which is not immediately obvious.