mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-21 07:46:58 +02:00
Test iD.util.editDistance
This commit is contained in:
@@ -24,6 +24,24 @@ describe('iD.Util', function() {
|
||||
expect(iD.util.getPrototypeOf(new a())).to.eql({ foo: 'foo' });
|
||||
});
|
||||
|
||||
describe('#editDistance', function() {
|
||||
it('returns zero for same strings', function() {
|
||||
expect(iD.util.editDistance('foo', 'foo')).to.eql(0);
|
||||
});
|
||||
|
||||
it('reports an insertion of 1', function() {
|
||||
expect(iD.util.editDistance('foo', 'fooa')).to.eql(1);
|
||||
});
|
||||
|
||||
it('reports a replacement of 1', function() {
|
||||
expect(iD.util.editDistance('foob', 'fooa')).to.eql(1);
|
||||
});
|
||||
|
||||
it('does not fail on empty input', function() {
|
||||
expect(iD.util.editDistance('', '')).to.eql(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#asyncMap', function() {
|
||||
it('handles correct replies', function() {
|
||||
iD.util.asyncMap([1, 2, 3],
|
||||
|
||||
Reference in New Issue
Block a user