-
Notifications
You must be signed in to change notification settings - Fork 710
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 #44 from roughike/code-cleanup
Code cleanup
- Loading branch information
Showing
10 changed files
with
184 additions
and
75 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
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,86 @@ | ||
import 'package:inkino/data/models/actor.dart'; | ||
import 'package:inkino/redux/app/app_actions.dart'; | ||
import 'package:inkino/redux/app/app_reducer.dart'; | ||
import 'package:inkino/redux/app/app_state.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
void main() { | ||
group('AppReducer', () { | ||
test( | ||
'when called with ActorsUpdatedAction, should not modify existing actors', | ||
() { | ||
var state = new AppState.initial().copyWith( | ||
actorsByName: <String, Actor>{ | ||
'Seth Ladd': new Actor( | ||
name: 'Seth Ladd', | ||
avatarUrl: 'https://seths-avatar-url', | ||
), | ||
'Eric Seidel': new Actor( | ||
name: 'Eric Seidel', | ||
avatarUrl: 'https://erics-avatar-url', | ||
), | ||
}, | ||
); | ||
|
||
var reducedState = appReducer( | ||
state, | ||
new ActorsUpdatedAction(<Actor>[ | ||
new Actor(name: 'Seth Ladd', avatarUrl: null), | ||
new Actor(name: 'Eric Seidel', avatarUrl: null), | ||
new Actor(name: 'Ian Hickson', avatarUrl: null), | ||
]), | ||
); | ||
|
||
expect( | ||
reducedState.actorsByName, | ||
<String, Actor>{ | ||
'Seth Ladd': new Actor( | ||
name: 'Seth Ladd', | ||
avatarUrl: 'https://seths-avatar-url', | ||
), | ||
'Eric Seidel': new Actor( | ||
name: 'Eric Seidel', | ||
avatarUrl: 'https://erics-avatar-url', | ||
), | ||
'Ian Hickson': new Actor( | ||
name: 'Ian Hickson', | ||
avatarUrl: null, | ||
), | ||
}, | ||
); | ||
}); | ||
|
||
test( | ||
'when called with ReceivedActorAvatarsAction, should add urls for actors', | ||
() { | ||
var state = new AppState.initial().copyWith( | ||
actorsByName: <String, Actor>{ | ||
'Seth Ladd': new Actor(name: 'Seth Ladd', avatarUrl: null), | ||
'Eric Seidel': new Actor(name: 'Eric Seidel', avatarUrl: null), | ||
}, | ||
); | ||
|
||
var reducedState = appReducer( | ||
state, | ||
new ReceivedActorAvatarsAction(<Actor>[ | ||
new Actor(name: 'Seth Ladd', avatarUrl: 'https://seths-avatar-url'), | ||
new Actor(name: 'Eric Seidel', avatarUrl: 'https://erics-avatar-url'), | ||
]), | ||
); | ||
|
||
expect( | ||
reducedState.actorsByName, | ||
<String, Actor>{ | ||
'Seth Ladd': new Actor( | ||
name: 'Seth Ladd', | ||
avatarUrl: 'https://seths-avatar-url', | ||
), | ||
'Eric Seidel': new Actor( | ||
name: 'Eric Seidel', | ||
avatarUrl: 'https://erics-avatar-url', | ||
), | ||
}, | ||
); | ||
}); | ||
}); | ||
} |
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