[IMP] store: display error if no store found

This commit is contained in:
Géry Debongnie
2019-11-03 23:54:54 +01:00
committed by aab-odoo
parent 8d1dd06340
commit b211e75140
2 changed files with 19 additions and 0 deletions
+16
View File
@@ -48,6 +48,22 @@ describe("connecting a component to store", () => {
expect(fixture.innerHTML).toBe("<div><span>hello</span></div>");
});
test("throw error if no store is found", async () => {
class App extends Component<any, any> {
static template = xml`<div></div>`;
todos = useStore(state => state.todos);
}
let error;
try {
new App();
} catch (e) {
error = e;
}
expect(error).toBeDefined();
expect(error.message).toBe("No store found when connecting 'App'");
});
test("can use useStore twice in a component", async () => {
const state = { a: 1, b: 2 };
const actions = {