-
Notifications
You must be signed in to change notification settings - Fork 6
Implement CalendarService #154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kevinlee-06
wants to merge
10
commits into
main
Choose a base branch
from
NTUT-Calendar-Service
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+149
−9
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f3b87e9
feat: implement CalendarService for fetching NTUT academic calendar e…
kevinlee-06 6cf79c2
test: add reference tests for CalendarService and calModeApp JSON
kevinlee-06 f65a132
docs: update last updated date and add CalendarService to services list
kevinlee-06 c45fb28
fix: run dart format
kevinlee-06 d229d16
fix: comment out debug code
kevinlee-06 8723d27
Update test/services/calendar_service_test.dart
kevinlee-06 064c0ba
Update test/services/calendar_service_test.dart
kevinlee-06 8989283
Update lib/services/calendar_service.dart
kevinlee-06 33a637e
Merge branch 'main' into NTUT-Calendar-Service
kevinlee-06 0b873f1
refactor: consolidate academic calendar event fetching into PortalSer…
kevinlee-06 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,59 @@ | ||
| import 'package:flutter_test/flutter_test.dart'; | ||
| import 'package:tattoo/services/firebase_service.dart'; | ||
| import 'package:tattoo/services/portal_service.dart'; | ||
|
|
||
| import '../test_helpers.dart'; | ||
|
|
||
| void main() { | ||
| group('PortalService (Calendar) Tests', () { | ||
| late PortalService portalService; | ||
|
|
||
| setUpAll(() { | ||
| TestCredentials.validate(); | ||
| }); | ||
|
|
||
| setUp(() async { | ||
| portalService = PortalService(FirebaseService()); | ||
| await portalService.login( | ||
| TestCredentials.username, | ||
| TestCredentials.password, | ||
| ); | ||
kevinlee-06 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| await respectfulDelay(); | ||
| }); | ||
|
|
||
| test('should return calendar events for a semester date range', () async { | ||
| final events = await portalService.getCalendar( | ||
| DateTime(2025, 1, 1), | ||
| DateTime(2025, 6, 30), | ||
| ); | ||
|
|
||
| expect(events, isNotEmpty, reason: 'Semester should have events'); | ||
|
|
||
| // Verify structure of first non-holiday event (skip holidays with empty titles) | ||
| final namedEvents = events.where((e) => e.calTitle != null).toList(); | ||
| expect( | ||
| namedEvents, | ||
| isNotEmpty, | ||
| reason: 'Semester should have at least one event with a non-null title', | ||
| ); | ||
| final event = namedEvents.first; | ||
| expect(event.calTitle, isNotNull, reason: 'Event should have a title'); | ||
| expect( | ||
| event.calStart, | ||
| isNotNull, | ||
| reason: 'Event should have a start time', | ||
| ); | ||
| }); | ||
|
|
||
| test('should return empty list for a date range with no events', () async { | ||
| // A single day far in the past unlikely to have events | ||
| final events = await portalService.getCalendar( | ||
| DateTime(2000, 1, 1), | ||
| DateTime(2000, 1, 2), | ||
| ); | ||
|
|
||
| // May still contain weekend/holiday markers, but should be a valid list | ||
| expect(events, isA<List>()); | ||
| }); | ||
| }); | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.