Fix bug in remove, improve tests.
This commit is contained in:
@ -64,26 +64,45 @@ describe('EnumerableSet', function () {
|
||||
|
||||
it('adds and removes multiple values', async function () {
|
||||
// []
|
||||
|
||||
await this.set.add(accountA);
|
||||
await this.set.add(accountC);
|
||||
|
||||
// [A, C]
|
||||
|
||||
await this.set.remove(accountA);
|
||||
await this.set.remove(accountB);
|
||||
|
||||
// [C]
|
||||
|
||||
await this.set.add(accountB);
|
||||
|
||||
// [C, B]
|
||||
|
||||
await this.set.add(accountA);
|
||||
await this.set.remove(accountC);
|
||||
|
||||
// [A, B]
|
||||
|
||||
expect(await this.set.contains(accountA)).to.equal(true);
|
||||
expect(await this.set.contains(accountB)).to.equal(true);
|
||||
expect(await this.set.contains(accountC)).to.equal(false);
|
||||
await this.set.add(accountA);
|
||||
await this.set.add(accountB);
|
||||
|
||||
expect(await this.set.enumerate()).to.have.same.members([ accountA, accountB ]);
|
||||
// [A, B]
|
||||
|
||||
await this.set.add(accountC);
|
||||
await this.set.remove(accountA);
|
||||
|
||||
// [B, C]
|
||||
|
||||
await this.set.add(accountA);
|
||||
await this.set.remove(accountB);
|
||||
|
||||
// [A, C]
|
||||
|
||||
expect(await this.set.contains(accountA)).to.equal(true);
|
||||
expect(await this.set.contains(accountB)).to.equal(false);
|
||||
expect(await this.set.contains(accountC)).to.equal(true);
|
||||
|
||||
expect(await this.set.enumerate()).to.have.same.members([ accountA, accountC ]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user