-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 in ONE/vitruvius from release/v1.2.0 to master
* commit '4051898a3d64fc5b569962497468c054e58c9f20': chore(package): iterate version to 1.2.0 feat(immutable): add support for redux-immutable
- Loading branch information
Showing
13 changed files
with
449 additions
and
129 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`collectBuiltState should build a mutable state 1`] = ` | ||
Object { | ||
"other": Immutable.Map { | ||
baz: "test", | ||
}, | ||
"stuff": Immutable.Map { | ||
foo: "test", | ||
}, | ||
"things": Immutable.Map { | ||
bar: "test", | ||
}, | ||
} | ||
`; | ||
|
||
exports[`collectBuiltState should build an immutable state 1`] = ` | ||
Immutable.Map { | ||
stuff: Immutable.Map { | ||
foo: "test", | ||
}, | ||
things: Immutable.Map { | ||
bar: "test", | ||
}, | ||
other: Immutable.Map { | ||
baz: "test", | ||
}, | ||
} | ||
`; |
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,81 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`vitruviusImmutable should build the expected state for a flat tree of reducers 1`] = ` | ||
Immutable.Map { | ||
stuff: Immutable.Map { | ||
foo: "test", | ||
}, | ||
things: Immutable.Map { | ||
bar: "test", | ||
}, | ||
other: Immutable.Map { | ||
baz: "test", | ||
}, | ||
} | ||
`; | ||
|
||
exports[`vitruviusImmutable should build the expected state for a nested tree of reducers 1`] = ` | ||
Immutable.Map { | ||
stuff: Immutable.Map { | ||
foo: "test", | ||
}, | ||
nested: Immutable.Map { | ||
things: Immutable.Map { | ||
bar: "test", | ||
}, | ||
other: Immutable.Map { | ||
baz: "test", | ||
}, | ||
}, | ||
} | ||
`; | ||
|
||
exports[`vitruviusImmutable should handle a mix of reducers having and not having buildInitialState method 1`] = ` | ||
Immutable.Map { | ||
stuff: Immutable.Map { | ||
foo: "test", | ||
}, | ||
things: Immutable.Map { | ||
bar: "test", | ||
}, | ||
other: Immutable.Map { | ||
baz: "test", | ||
}, | ||
} | ||
`; | ||
|
||
exports[`vitruviusImmutable should handle all reducers having buildInitialState method 1`] = ` | ||
Immutable.Map { | ||
stuff: Immutable.Map { | ||
foo: "test", | ||
}, | ||
things: Immutable.Map { | ||
bar: "test", | ||
}, | ||
other: Immutable.Map { | ||
baz: "test", | ||
}, | ||
} | ||
`; | ||
|
||
exports[`vitruviusImmutable should handle no reducers having buildInitialState method 1`] = ` | ||
Immutable.Map { | ||
} | ||
`; | ||
|
||
exports[`vitruviusImmutable should return an initialState that is acceptable to redux's createStore 1`] = ` | ||
Immutable.Map { | ||
stuff: Immutable.Map { | ||
foo: "test", | ||
}, | ||
things: Immutable.Map { | ||
bar: "test", | ||
}, | ||
other: Immutable.Map { | ||
baz: "test", | ||
}, | ||
static: Immutable.Map { | ||
static: true, | ||
}, | ||
} | ||
`; |
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,78 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`vitruvius should build the expected state for a flat tree of reducers 1`] = ` | ||
Object { | ||
"other": Immutable.Map { | ||
baz: "test", | ||
}, | ||
"stuff": Immutable.Map { | ||
foo: "test", | ||
}, | ||
"things": Immutable.Map { | ||
bar: "test", | ||
}, | ||
} | ||
`; | ||
|
||
exports[`vitruvius should build the expected state for a nested tree of reducers 1`] = ` | ||
Object { | ||
"nested": Object { | ||
"other": Immutable.Map { | ||
baz: "test", | ||
}, | ||
"things": Immutable.Map { | ||
bar: "test", | ||
}, | ||
}, | ||
"stuff": Immutable.Map { | ||
foo: "test", | ||
}, | ||
} | ||
`; | ||
|
||
exports[`vitruvius should handle a mix of reducers having and not having buildInitialState method 1`] = ` | ||
Object { | ||
"other": Immutable.Map { | ||
baz: "test", | ||
}, | ||
"stuff": Immutable.Map { | ||
foo: "test", | ||
}, | ||
"things": Immutable.Map { | ||
bar: "test", | ||
}, | ||
} | ||
`; | ||
|
||
exports[`vitruvius should handle all reducers having buildInitialState method 1`] = ` | ||
Object { | ||
"other": Immutable.Map { | ||
baz: "test", | ||
}, | ||
"stuff": Immutable.Map { | ||
foo: "test", | ||
}, | ||
"things": Immutable.Map { | ||
bar: "test", | ||
}, | ||
} | ||
`; | ||
|
||
exports[`vitruvius should handle no reducers having buildInitialState method 1`] = `Object {}`; | ||
|
||
exports[`vitruvius should return an initialState that is acceptable to redux's createStore 1`] = ` | ||
Object { | ||
"other": Immutable.Map { | ||
baz: "test", | ||
}, | ||
"static": Immutable.Map { | ||
static: true, | ||
}, | ||
"stuff": Immutable.Map { | ||
foo: "test", | ||
}, | ||
"things": Immutable.Map { | ||
bar: "test", | ||
}, | ||
} | ||
`; |
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,54 @@ | ||
/* | ||
* Copyright (c) 2017 American Express Travel Related Services Company, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License | ||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
* or implied. See the License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
|
||
import { Map } from 'immutable'; | ||
import collectBuiltState from '../src/collectBuiltState'; | ||
import { | ||
stuffReducer, | ||
thingsReducer, | ||
otherReducer, | ||
staticReducer, | ||
} from './fixtures'; | ||
|
||
describe('collectBuiltState', () => { | ||
const locals = { data: 'test' }; | ||
|
||
it('should build an immutable state', () => { | ||
const result = collectBuiltState({ | ||
reducers: { | ||
stuff: stuffReducer, | ||
things: thingsReducer, | ||
other: otherReducer, | ||
static: staticReducer, | ||
}, | ||
locals, | ||
defaultState: new Map(), | ||
}); | ||
expect(result).toMatchSnapshot(); | ||
}); | ||
|
||
it('should build a mutable state', () => { | ||
const result = collectBuiltState({ | ||
reducers: { | ||
stuff: stuffReducer, | ||
things: thingsReducer, | ||
other: otherReducer, | ||
static: staticReducer, | ||
}, | ||
locals, | ||
defaultState: {}, | ||
}); | ||
expect(result).toMatchSnapshot(); | ||
}); | ||
}); |
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,27 @@ | ||
/* | ||
* Copyright (c) 2017 American Express Travel Related Services Company, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License | ||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
* or implied. See the License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
|
||
import vitruviusImmutable from '../src/immutable'; | ||
import vitruviusImmutableExport from '../immutable'; | ||
import { runVitruviusTests } from './fixtures'; | ||
|
||
jest.mock('../lib/immutable', () => require('../src/immutable'), { virtual: true }); | ||
|
||
runVitruviusTests('vitruviusImmutable', vitruviusImmutable); | ||
|
||
describe('vitruviusImmutable export', () => { | ||
it('should export vitruviusImmutable', () => { | ||
expect(vitruviusImmutableExport.name).toBe('vitruviusImmutable'); | ||
}); | ||
}); |
Oops, something went wrong.