"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const DefaultedMap_1 = require("./DefaultedMap");
describe('DefaultedMap', () => {
    it('first access', () => {
        const backfillFn = jest.fn((key) => [key]);
        const map = new DefaultedMap_1.DefaultedMap(backfillFn);
        const result = map.get('foo');
        expect(result).toEqual(['foo']);
        expect(backfillFn).toHaveBeenCalledWith('foo');
    });
    it('second access', () => {
        const backfillFn = jest.fn((key) => [key]);
        const map = new DefaultedMap_1.DefaultedMap(backfillFn);
        const result = map.get('foo');
        expect(result).toEqual(['foo']);
        expect(backfillFn).toHaveBeenCalledTimes(1);
    });
    it('access filled value', () => {
        const backfillFn = jest.fn((key) => [key]);
        const map = new DefaultedMap_1.DefaultedMap(backfillFn);
        map.set('foo', ['bar']);
        const result = map.get('foo');
        expect(result).toEqual(['bar']);
        expect(backfillFn).not.toHaveBeenCalled();
    });
});
//# sourceMappingURL=DefaultedMap.test.js.map