-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create parse_local_storage_test.dart
- Loading branch information
1 parent
718c7f6
commit 14cc510
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import 'package:flutter_parse/flutter_parse.dart'; | ||
import 'package:flutter_parse/src/parse_local_storage.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
void main() { | ||
group('Parse Local Storage', () { | ||
setUpAll(() { | ||
final ParseConfiguration _configuration = ParseConfiguration( | ||
server: 'SERVER', | ||
applicationId: 'APPLICATION_ID', | ||
clientKey: 'CLIENT_KEY', | ||
enableLogging: true, | ||
); | ||
Parse.initialize(_configuration); | ||
}); | ||
|
||
const String key1 = 'default local storage must be empty'; | ||
test(key1, () async { | ||
final localStorage = await parseLocalStorage.get(key1); | ||
|
||
expect(localStorage.isEmpty, isTrue); | ||
}); | ||
|
||
const String key2 = 'adding local storage with an item must not be empty'; | ||
test(key2, () async { | ||
final localStorage = await parseLocalStorage.get(key2); | ||
await localStorage.setItem('first', 1); | ||
|
||
expect(localStorage.isEmpty, isFalse); | ||
expect(localStorage.getItem('first'), 1); | ||
}); | ||
|
||
const String key3 = | ||
'remove after adding local storage with an item must be empty'; | ||
test(key3, () async { | ||
final localStorage = await parseLocalStorage.get(key3); | ||
await localStorage.setItem('second', 2); | ||
|
||
expect(localStorage.isEmpty, isFalse); | ||
expect(localStorage.getItem('second'), 2); | ||
|
||
await localStorage.delete(); | ||
expect(localStorage.isEmpty, isTrue); | ||
}); | ||
}); | ||
} |