-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
28a38d7
commit 1a6f528
Showing
5 changed files
with
65 additions
and
8 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
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,37 @@ | ||
import { assert } from 'chai' | ||
import Alt from '../dist/alt-with-runtime' | ||
|
||
const alt = new Alt() | ||
|
||
alt.storeTransforms.push(function (Store) { | ||
Store.test = 'hello' | ||
return Store | ||
}) | ||
|
||
class Store { | ||
constructor() { | ||
this.x = 0 | ||
} | ||
} | ||
|
||
class Store2 { | ||
constructor() { | ||
this.y = 0 | ||
} | ||
} | ||
|
||
export default { | ||
'store transforms': { | ||
'when creating stores alt goes through its series of transforms'() { | ||
const store = alt.createStore(Store) | ||
assert(alt.storeTransforms.length === 1) | ||
assert.isDefined(store.test) | ||
assert(store.test === 'hello', 'store that adds hello to instance transform') | ||
}, | ||
|
||
'unsaved stores get the same treatment'() { | ||
const store2 = alt.createUnsavedStore(Store) | ||
assert.isDefined(store2.test) | ||
}, | ||
}, | ||
} |