Skip to content

Commit 9c866eb

Browse files
committed
update empty string mightContain test
1 parent 1292512 commit 9c866eb

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

packages/firestore/test/unit/remote/bloom_filter.test.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,19 +86,15 @@ describe('BloomFilter', () => {
8686

8787
it('mightContain in empty bloom filter should always return false', () => {
8888
const bloomFilter = new BloomFilter(new Uint8Array(0), 0, 0);
89+
expect(bloomFilter.mightContain('')).to.be.false;
8990
expect(bloomFilter.mightContain('abc')).to.be.false;
90-
expect(bloomFilter.mightContain('def')).to.be.false;
9191
});
9292

93-
it('mightContain should always return false for empty string', () => {
94-
const emptyBloomFilter = new BloomFilter(new Uint8Array(0), 0, 0);
95-
const nonEmptyBloomFilter = new BloomFilter(
96-
new Uint8Array([255, 255, 255]),
97-
1,
98-
16
99-
);
100-
expect(emptyBloomFilter.mightContain('')).to.be.false;
101-
expect(nonEmptyBloomFilter.mightContain('')).to.be.false;
93+
it('mightContain on empty string might return false positive result ', () => {
94+
const bloomFilter1 = new BloomFilter(new Uint8Array([1]), 1, 1);
95+
const bloomFilter2 = new BloomFilter(new Uint8Array([255]), 0, 16);
96+
expect(bloomFilter1.mightContain('')).to.be.false;
97+
expect(bloomFilter2.mightContain('')).to.be.true;
10298
});
10399

104100
/**

0 commit comments

Comments
 (0)