Complete verification links and preserve verified login email (#60)
This commit is contained in:
1 parent
30f06c2f8f
commit
5f3b443e7b
25 files changed
+270
-32
No files matched your search
@@ -42,6 +42,12 @@ void main() {
|
||||
addTearDown(provider.dispose);
|
||||
await provider.confirm(scenario.key);
|
||||
expect(provider.state.status, scenario.value);
|
||||
expect(
|
||||
provider.state.result?.verifiedEmail,
|
||||
scenario.value == VerificationStatus.verified
|
||||
? 'alex@example.com'
|
||||
: null,
|
||||
);
|
||||
expect(
|
||||
provider.state.isSimulated,
|
||||
scenario.value == VerificationStatus.verified,
|
||||
@@ -75,7 +81,23 @@ void main() {
|
||||
service.pending.complete(const VerificationResult(isSimulated: true));
|
||||
await operation;
|
||||
expect(provider.state.status, VerificationStatus.idle);
|
||||
expect(provider.state.result, isNull);
|
||||
});
|
||||
test(
|
||||
'a later failed confirmation clears the previous verified identity',
|
||||
() async {
|
||||
final provider = VerificationProvider(
|
||||
const DummyVerificationService(delay: Duration.zero),
|
||||
);
|
||||
addTearDown(provider.dispose);
|
||||
await provider.confirm('demo-valid');
|
||||
expect(provider.state.result?.verifiedEmail, 'alex@example.com');
|
||||
final operation = provider.confirm('bad');
|
||||
expect(provider.state.result, isNull);
|
||||
await operation;
|
||||
expect(provider.state.result, isNull);
|
||||
},
|
||||
);
|
||||
test('dispose discards late exception', () async {
|
||||
final service = PendingService();
|
||||
final provider = VerificationProvider(service);
|
||||
|
||||
Reference in new issue
Block a user