-
-
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 #24 from francescovallone/feat/16
feat(#16): add factory constructors to Route and remove abstract modifier
- Loading branch information
Showing
5 changed files
with
88 additions
and
3 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,40 @@ | ||
import 'package:serinus/serinus.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
void main() { | ||
|
||
group('$Route', () { | ||
|
||
test('when a route is created, then it should have the correct path and method', () { | ||
final route = Route(path: '/test', method: HttpMethod.get); | ||
expect(route.path, equals('/test')); | ||
expect(route.method, equals(HttpMethod.get)); | ||
}); | ||
|
||
test('when a route is created with the GET factory constructor, then it should have the correct method', () { | ||
final route = Route.get('/test'); | ||
expect(route.method, equals(HttpMethod.get)); | ||
}); | ||
|
||
test('when a route is created with the POST factory constructor, then it should have the correct method', () { | ||
final route = Route.post('/test'); | ||
expect(route.method, equals(HttpMethod.post)); | ||
}); | ||
|
||
test('when a route is created with the PUT factory constructor, then it should have the correct method', () { | ||
final route = Route.put('/test'); | ||
expect(route.method, equals(HttpMethod.put)); | ||
}); | ||
|
||
test('when a route is created with the DELETE factory constructor, then it should have the correct method', () { | ||
final route = Route.delete('/test'); | ||
expect(route.method, equals(HttpMethod.delete)); | ||
}); | ||
|
||
test('when a route is created with the PATCH factory constructor, then it should have the correct method', () { | ||
final route = Route.patch('/test'); | ||
expect(route.method, equals(HttpMethod.patch)); | ||
}); | ||
}); | ||
|
||
} |