-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add some basic tests of at_cli_commons utils.dart
build: add at_cli_commons to the matrix in the GH actions workflow
- Loading branch information
Showing
3 changed files
with
84 additions
and
4 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
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
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,55 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:at_cli_commons/at_cli_commons.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
void main() { | ||
String atSign = '@alice'; | ||
String progName = 'test'; | ||
String uniqueID = '${DateTime.now().millisecondsSinceEpoch}'; | ||
|
||
test('test standardAtClientStoragePath without uniqueID', () { | ||
expect( | ||
standardAtClientStoragePath( | ||
baseDir: '/tmp', | ||
atSign: '@alice', | ||
progName: 'test', | ||
), | ||
'/tmp/.atsign/storage/$atSign/$progName/$defaultPathUniqueID' | ||
.replaceAll('/', Platform.pathSeparator)); | ||
}); | ||
|
||
test('test standardAtClientStoragePath with uniqueID', () { | ||
expect( | ||
standardAtClientStoragePath( | ||
baseDir: '/tmp', | ||
atSign: '@alice', | ||
progName: 'test', | ||
uniqueID: uniqueID, | ||
), | ||
'/tmp/.atsign/storage/$atSign/$progName/$uniqueID' | ||
.replaceAll('/', Platform.pathSeparator)); | ||
}); | ||
|
||
test('test standardAtClientStorageDir', () { | ||
Directory dir = standardAtClientStorageDir( | ||
atSign: atSign, | ||
progName: progName, | ||
uniqueID: uniqueID, | ||
); | ||
if (Platform.isWindows) { | ||
expect( | ||
dir, | ||
standardWindowsAtClientStorageDir( | ||
atSign: atSign, | ||
progName: progName, | ||
uniqueID: uniqueID, | ||
)); | ||
} else { | ||
expect( | ||
dir.path, | ||
'${getHomeDirectory()}/.atsign/storage/$atSign/$progName/$uniqueID' | ||
.replaceAll('/', Platform.pathSeparator)); | ||
} | ||
}); | ||
} |