mirror of
https://github.com/hanskokx/arcane_helper_utils.git
synced 2026-05-14 10:29:07 +02:00
v1.4.7
- Added the `isExpired` and `expiresSoon` getters to JWT tokens. Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -59,6 +59,18 @@ void main() {
|
||||
expect(expiry?.year, 2025); // Based on the exp value in the test token
|
||||
});
|
||||
|
||||
test("jwt.isExpired checks expiration on tokens properly", () {
|
||||
final bool isExpired = validToken.jwt.isExpired;
|
||||
expect(isExpired, isNotNull);
|
||||
expect(isExpired, true);
|
||||
});
|
||||
|
||||
test("jwt.expiresSoon checks expiration on tokens properly", () {
|
||||
final bool expiresSoon = validToken.jwt.expiresSoon;
|
||||
expect(expiresSoon, isNotNull);
|
||||
expect(expiresSoon, true);
|
||||
});
|
||||
|
||||
test("jwt.expiryTime throws an exception for invalid token", () {
|
||||
expect(
|
||||
() => "invalid.token".jwt.expiryTime,
|
||||
|
||||
Reference in New Issue
Block a user