mirror of
https://github.com/status-im/sourcecred.git
synced 2025-01-27 12:55:14 +00:00
Extract a TestLocalStore
(#527)
Summary: Test code should probably always use a checked, memory-backed local storage implementation. This endpoint will help users not forget to include the checks. wchargin-branch: test-local-store
This commit is contained in:
parent
8655838b2c
commit
e0c97fee9e
@ -2,7 +2,7 @@
|
||||
import React from "react";
|
||||
import {shallow} from "enzyme";
|
||||
|
||||
import MemoryLocalStore from "../memoryLocalStore";
|
||||
import TestLocalStore from "../memoryLocalStore";
|
||||
import {pagerank} from "../../core/attribution/pagerank";
|
||||
import {App} from "./App";
|
||||
|
||||
@ -96,20 +96,17 @@ function example() {
|
||||
}
|
||||
|
||||
describe("app/credExplorer/App", () => {
|
||||
function makeLocalStore() {
|
||||
return new MemoryLocalStore();
|
||||
}
|
||||
it("renders with clean state", () => {
|
||||
shallow(<App localStore={makeLocalStore()} />);
|
||||
shallow(<App localStore={new TestLocalStore()} />);
|
||||
});
|
||||
it("renders with graph and adapters set", () => {
|
||||
const app = shallow(<App localStore={makeLocalStore()} />);
|
||||
const app = shallow(<App localStore={new TestLocalStore()} />);
|
||||
const {graph, adapters} = example();
|
||||
const data = {graph, adapters, pagerankResult: null};
|
||||
app.setState({data});
|
||||
});
|
||||
it("renders with graph and adapters and pagerankResult", () => {
|
||||
const app = shallow(<App localStore={makeLocalStore()} />);
|
||||
const app = shallow(<App localStore={new TestLocalStore()} />);
|
||||
const {graph, adapters, pagerankResult} = example();
|
||||
const data = {graph, adapters, pagerankResult};
|
||||
app.setState({data});
|
||||
|
6
src/app/testLocalStore.js
Normal file
6
src/app/testLocalStore.js
Normal file
@ -0,0 +1,6 @@
|
||||
// @flow
|
||||
|
||||
import CheckedLocalStore from "./checkedLocalStore";
|
||||
import MemoryLocalStore from "./memoryLocalStore";
|
||||
|
||||
export default new CheckedLocalStore(new MemoryLocalStore());
|
Loading…
x
Reference in New Issue
Block a user