Show accepted signup delivery without a second send step (#62)
This commit is contained in:
1 parent
e84d2d1ad3
commit
3af60f38b1
19 files changed
+421
-69
No files matched your search
@@ -28,6 +28,36 @@ class PendingService implements VerificationService {
|
||||
}
|
||||
|
||||
void main() {
|
||||
test(
|
||||
'accepted delivery initializes sent state without calling the service',
|
||||
() async {
|
||||
final service = PendingService();
|
||||
final provider = VerificationProvider(
|
||||
service,
|
||||
delivery: const VerificationDelivery(
|
||||
email: 'ada@example.com',
|
||||
isSimulated: false,
|
||||
),
|
||||
);
|
||||
addTearDown(provider.dispose);
|
||||
expect(provider.state.status, VerificationStatus.sent);
|
||||
expect(provider.state.isSimulated, isFalse);
|
||||
expect(provider.state.result, isNull);
|
||||
expect(service.calls, 0);
|
||||
final resend = provider.send(email: 'ada@example.com', locale: 'en');
|
||||
expect(provider.state.status, VerificationStatus.sending);
|
||||
expect(service.calls, 1);
|
||||
service.pending.completeError(
|
||||
const VerificationException(VerificationError.internal),
|
||||
);
|
||||
await resend;
|
||||
expect(provider.state.status, VerificationStatus.error);
|
||||
expect(provider.state.result, isNull);
|
||||
provider.reset();
|
||||
expect(provider.state.status, VerificationStatus.idle);
|
||||
},
|
||||
);
|
||||
|
||||
for (final scenario in {
|
||||
'demo-valid': VerificationStatus.verified,
|
||||
'demo-expired': VerificationStatus.expired,
|
||||
|
||||
Reference in new issue
Block a user