Skip to content

Commit 83bf0ad

Browse files
committed
Add test for base64 decoding.
1 parent 878755d commit 83bf0ad

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import 'package:powersync/powersync.dart';
2+
import 'package:test/test.dart';
3+
4+
void main() {
5+
group('PowerSyncCredentials', () {
6+
test('getExpiryDate', () async {
7+
// Specifically test a token with a "-" character and missing padding
8+
final token =
9+
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ9Pn0-YWIiLCJpYXQiOjE3MDc3Mzk0MDAsImV4cCI6MTcwNzczOTUwMH0=.IVoAtpJ7jfwLbqlyJGYHPCvljLis_fHj2Qvdqlj8AQU';
10+
expect(PowerSyncCredentials.getExpiryDate(token)?.toUtc(),
11+
equals(DateTime.parse('2024-02-12T12:05:00Z')));
12+
});
13+
});
14+
}

0 commit comments

Comments
 (0)