Skip to content

Commit bd8e1b8

Browse files
committed
chore: add a test for db reload
1 parent e4a3b37 commit bd8e1b8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/__test__/integration.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,3 +307,18 @@ describe('getWithPrefixLength', () => {
307307
});
308308
}
309309
});
310+
311+
describe('database reload', () => {
312+
it('works as expected', () => {
313+
const geoIp = open(path.join(dataDir, 'GeoIP2-ISP-Test.mmdb'));
314+
const data = actual('GeoIP2-ISP-Test.json');
315+
316+
const address = '175.16.199.1';
317+
assert.deepStrictEqual(geoIp.get(address), null);
318+
319+
const newDatabase = fs.readFileSync(path.join(dataDir, 'GeoIP2-City-Test.mmdb'))
320+
geoIp.load(newDatabase);
321+
322+
assert.notDeepStrictEqual(geoIp.get(address), null);
323+
})
324+
});

0 commit comments

Comments
 (0)