thenavisapp
Version:
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
23 lines (17 loc) • 581 B
text/typescript
import test from 'ava';
import WeakableMap from '../source/core/utils/weakable-map.js';
test('works as expected', t => {
const weakable = new WeakableMap();
weakable.set('hello', 'world');
t.true(weakable.has('hello'));
t.false(weakable.has('foobar'));
t.is(weakable.get('hello'), 'world');
t.is(weakable.get('foobar'), undefined);
const object = {};
const anotherObject = {};
weakable.set(object, 'world');
t.true(weakable.has(object));
t.false(weakable.has(anotherObject));
t.is(weakable.get(object), 'world');
t.is(weakable.get(anotherObject), undefined);
});