recoil
Version:
Recoil - A state management library for React
24 lines (22 loc) • 628 B
Flow
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @emails oncall+recoil
* @flow strict
* @format
*/
;
const cacheMostRecent = require('../Recoil_cacheMostRecent');
test('cacheMostRecent', () => {
const cache = cacheMostRecent();
expect(cache.get('a')).toBe(undefined);
cache.set('a', 1);
expect(cache.get('a')).toBe(1);
expect(cache.get('b')).toBe(undefined);
cache.set('b', 2);
expect(cache.get('a')).toBe(undefined);
expect(cache.get('b')).toBe(2);
});