Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Commit

Permalink
Updated integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
schwartz-concordium committed Dec 16, 2023
1 parent 63d01a7 commit c778ea7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env:
flutter_version: 3.13.6
iphone_model: iPhone 8
android_profile: Nexus 6
android_api_level: 32
android_api_level: 29
android_target: google_apis

jobs:
Expand Down
44 changes: 21 additions & 23 deletions integration_test/secret_storage/secret_storage_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void main() {
}
});

testWidgets("When set, read and delete from storage, then update storage correctly", (widgetTester) async {
test("When set, read and delete from storage, then update storage correctly", () async {
// Arrange
await storage.setPassword("password");
const String key = "foo";
Expand All @@ -61,15 +61,15 @@ void main() {
expect(beforeDelete, value);
});

testWidgets("Given no password set, when check if exist, then return false", (widgetTester) async {
test("Given no password set, when check if exist, then return false", () async {
// Act
final actual = await storage.hasPassword();

// Assert
expect(actual, false);
});

testWidgets("When set password, then password is set and one can unlock", (widgetTester) async {
test("When set password, then password is set and one can unlock", () async {
// Arrange
const String password = "foobar";

Expand All @@ -85,7 +85,7 @@ void main() {
expect(succeeded, true);
});

testWidgets("When unlock with wrong password, then return false", (widgetTester) async {
test("When unlock with wrong password, then return false", () async {
// Arrange
const String password = "foobar";
await storage.setPassword(password);
Expand All @@ -97,7 +97,7 @@ void main() {
expect(unlocked, false);
});

testWidgets("Given no password set, when trying to unlock, then throw exception", (widgetTester) async {
test("Given no password set, when trying to unlock, then throw exception", () async {
// Arrange
dynamic actualError;

Expand All @@ -113,22 +113,20 @@ void main() {
expect((actualError as SecretStorageException).error, SecretStorageError.noPassword);
});

if (kIsWeb) {
testWidgets("Given web, when not unlocked, then throw exception box hasn't been opened", (widgetTester) async {
// Arrange
const String key = "foo";
dynamic actualError;

// Act
try {
await storage.read(key);
} on SecretStorageException catch (e) {
actualError = e;
}

// Assert
expect(actualError, isA<SecretStorageException>());
expect((actualError as SecretStorageException).error, SecretStorageError.encryptedBoxNotOpened);
});
}
test("Given web, when not unlocked, then throw exception box hasn't been opened", () async {
// Arrange
const String key = "foo";
dynamic actualError;

// Act
try {
await storage.read(key);
} on SecretStorageException catch (e) {
actualError = e;
}

// Assert
expect(actualError, isA<SecretStorageException>());
expect((actualError as SecretStorageException).error, SecretStorageError.encryptedBoxNotOpened);
}, skip: !kIsWeb);
}

0 comments on commit c778ea7

Please sign in to comment.