Skip to content

Commit

Permalink
Fix typo in List exception messages (#43, fixes #42)
Browse files Browse the repository at this point in the history
  • Loading branch information
strarsis authored and lahmatiy committed Mar 17, 2017
1 parent b9f6733 commit d630914
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions lib/utils/list.js
Expand Up @@ -330,7 +330,7 @@ List.prototype.insert = function(item, before) {
if (before.prev === null) {
// insert to the beginning of list
if (this.head !== before) {
throw new Error('before doesn\'t below to list');
throw new Error('before doesn\'t belong to list');
}

// since head points to before therefore list doesn't empty
Expand Down Expand Up @@ -364,7 +364,7 @@ List.prototype.remove = function(item) {
item.prev.next = item.next;
} else {
if (this.head !== item) {
throw new Error('item doesn\'t below to list');
throw new Error('item doesn\'t belong to list');
}

this.head = item.next;
Expand All @@ -374,7 +374,7 @@ List.prototype.remove = function(item) {
item.next.prev = item.prev;
} else {
if (this.tail !== item) {
throw new Error('item doesn\'t below to list');
throw new Error('item doesn\'t belong to list');
}

this.tail = item.prev;
Expand Down
12 changes: 6 additions & 6 deletions test/list.js
Expand Up @@ -405,12 +405,12 @@ describe('List', function() {
});
});

it('insert head item that doesn\'t below to list', function() {
it('insert head item that doesn\'t belong to list', function() {
var inserted = List.createItem({});

assert.throws(function() {
list2.insert(inserted, list1.head);
}, /^Error: before doesn't below to list$/);
}, /^Error: before doesn't belong to list$/);
});
});

Expand Down Expand Up @@ -457,16 +457,16 @@ describe('List', function() {
});
});

it('remove head item that doesn\'t below to list', function() {
it('remove head item that doesn\'t belong to list', function() {
assert.throws(function() {
list1.remove(list2.head);
}, /^Error: item doesn't below to list$/);
}, /^Error: item doesn't belong to list$/);
});

it('remove tail item that doesn\'t below to list', function() {
it('remove tail item that doesn\'t belong to list', function() {
assert.throws(function() {
list1.remove(list2.tail);
}, /^Error: item doesn't below to list$/);
}, /^Error: item doesn't belong to list$/);
});
});

Expand Down

0 comments on commit d630914

Please sign in to comment.