Skip to content

Commit

Permalink
test/utils: [add] tests for maybeAppend with new routeState
Browse files Browse the repository at this point in the history
  • Loading branch information
slovnicki committed Jun 29, 2023
1 parent 440f275 commit 5c58af3
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion package/test/utils_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void main() {
expect(Utils.trimmed('/xxx/'), '/xxx');
});

test('Appending', () {
test('Appending without new routeState', () {
const current = RouteInformation(location: '/current');
expect(
Utils.maybeAppend(current, const RouteInformation()).location,
Expand All @@ -149,6 +149,26 @@ void main() {
'/incoming',
);
});

test('Appending with new routeState', () {
const current = RouteInformation(location: '/current');
expect(
Utils.maybeAppend(current, const RouteInformation(state: 42)).state,
42,
);
expect(
Utils.maybeAppend(current,
const RouteInformation(location: 'incoming', state: 42))
.state,
42,
);
expect(
Utils.maybeAppend(current,
const RouteInformation(location: '/incoming', state: 42))
.state,
42,
);
});
});

group('RouteInformation equality', () {
Expand Down

0 comments on commit 5c58af3

Please sign in to comment.