-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for root everything and nested modules
- Loading branch information
Ben Crowl
committed
Jul 10, 2017
1 parent
57c4057
commit 01e9efd
Showing
6 changed files
with
228 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { expect } from "chai" | ||
import * as Vue from "vue" | ||
import * as Vuex from "vuex" | ||
import { buildStore } from "./store" | ||
import { RootState } from "./store/index" | ||
import { getStoreBuilder, StoreBuilder, ModuleBuilder } from "../index" | ||
import { Store } from "vuex" | ||
|
||
interface OuterState { str: string, inner: InnerState } | ||
interface InnerState { int: number } | ||
|
||
describe("Create a store", () => | ||
{ | ||
let outerBuilder: ModuleBuilder<OuterState> | ||
let innerBuilder: ModuleBuilder<InnerState> | ||
let storeBuilder: StoreBuilder<{}> | ||
beforeEach(() => | ||
{ | ||
storeBuilder = getStoreBuilder("nested-store") | ||
outerBuilder = storeBuilder.module("outer", <OuterState>{ str: "hello, world." }) | ||
innerBuilder = outerBuilder.module("inner", <InnerState>{ int: 42 }) | ||
// innerBuilder = storeBuilder.module("outer/inner", { int: 42 }) | ||
}) | ||
|
||
describe("that includes nested modules", () => | ||
{ | ||
it("should access nested value", () => | ||
{ | ||
const store = storeBuilder.vuexStore() | ||
const readState = outerBuilder.state() | ||
|
||
expect(readState().inner.int).to.equal(42) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.