recoil
Version:
Recoil - A state management library for React
33 lines (30 loc) • 920 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-local
* @format
*/
;
const {
getRecoilTestFn
} = require('../../testing/Recoil_TestingUtils');
let store, getRecoilValueAsLoadable, errorSelector;
const testRecoil = getRecoilTestFn(() => {
const {
makeStore
} = require('../../testing/Recoil_TestingUtils');
({
getRecoilValueAsLoadable
} = require('../../core/Recoil_RecoilValueInterface'));
errorSelector = require('../Recoil_errorSelector');
store = makeStore();
});
declare function getError(recoilValue: any): Error;
testRecoil('errorSelector - string', () => {
const mySelector = errorSelector('My Error');
expect(getError(mySelector).message).toEqual(expect.stringContaining('My Error'));
});