File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import {
1010} from '../../../src/actions/projects' ;
1111import {
1212 snapshotImported ,
13+ projectRestoredFromLastSession ,
1314} from '../../../src/actions/clients' ;
1415import { gistData } from '../../helpers/factory' ;
1516
@@ -39,6 +40,13 @@ test('snapshotImported', reducerTest(
3940 Immutable . fromJS ( { projectKey} ) ,
4041) ) ;
4142
43+ test ( 'projectRestoredFromLastSession' , reducerTest (
44+ reducer ,
45+ initialState ,
46+ partial ( projectRestoredFromLastSession , { projectKey} ) ,
47+ Immutable . fromJS ( { projectKey} ) ,
48+ ) ) ;
49+
4250test ( 'gistImported' , reducerTest (
4351 reducer ,
4452 initialState ,
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import {
2222} from '../../../src/actions/projects' ;
2323import {
2424 snapshotImported ,
25+ projectRestoredFromLastSession ,
2526} from '../../../src/actions/clients' ;
2627import {
2728 focusLine ,
@@ -103,6 +104,21 @@ tap(project(), importedProject =>
103104 ) ) ,
104105) ;
105106
107+ tap ( project ( ) , rehydratedProject =>
108+ test ( 'projectRestoredFromLastSession' , reducerTest (
109+ reducer ,
110+ states . initial ,
111+ partial (
112+ projectRestoredFromLastSession ,
113+ rehydratedProject ,
114+ ) ,
115+ states . initial . set (
116+ rehydratedProject . projectKey ,
117+ Project . fromJS ( rehydratedProject ) ,
118+ ) ,
119+ ) ) ,
120+ ) ;
121+
106122test ( 'gistImported' , ( t ) => {
107123 t . test ( 'HTML and CSS, no JSON' , reducerTest (
108124 reducer ,
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import {
2121 snapshotImported ,
2222 snapshotImportError ,
2323 snapshotNotFound ,
24+ projectRestoredFromLastSession ,
2425} from '../../../src/actions/clients' ;
2526import { userAuthenticated } from '../../../src/actions/user' ;
2627import applicationLoaded from '../../../src/actions/applicationLoaded' ;
@@ -80,7 +81,7 @@ test('changeCurrentProject()', (assert) => {
8081} ) ;
8182
8283test ( 'applicationLoaded()' , ( t ) => {
83- t . test ( 'with no gist or snapshot ID' , ( assert ) => {
84+ t . test ( 'with no gist or snapshot ID or rehydrated project ' , ( assert ) => {
8485 testSaga ( applicationLoadedSaga , applicationLoaded ( { gistId : null } ) ) .
8586 next ( ) . call ( createProjectSaga ) .
8687 next ( ) . isDone ( ) ;
@@ -105,6 +106,15 @@ test('applicationLoaded()', (t) => {
105106
106107 assert . end ( ) ;
107108 } ) ;
109+
110+ t . test ( 'with rehydrated project' , ( assert ) => {
111+ const rehydratedProject = project ( ) ;
112+ testSaga ( applicationLoadedSaga , applicationLoaded ( { rehydratedProject} ) ) .
113+ next ( ) . put ( projectRestoredFromLastSession ( rehydratedProject ) ) .
114+ next ( ) . isDone ( ) ;
115+
116+ assert . end ( ) ;
117+ } ) ;
108118} ) ;
109119
110120test ( 'importSnapshot()' , ( t ) => {
You can’t perform that action at this time.
0 commit comments