-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
63d1cb2
commit 3873d70
Showing
3 changed files
with
61 additions
and
13 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 |
---|---|---|
|
@@ -33,4 +33,3 @@ jobs: | |
- name: dart test | ||
working-directory: packages/noports_core | ||
run: dart test | ||
|
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
50 changes: 49 additions & 1 deletion
50
packages/noports_core/test/sshnp_params/sshnp_result_test.dart
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 |
---|---|---|
@@ -1 +1,49 @@ | ||
void main() {} | ||
import 'package:noports_core/sshnp.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
void main() { | ||
group('SSHNPResult', () { | ||
group('Subclass Confirmation', () { | ||
test('SSHNPSuccess test', () { | ||
expect(SSHNPSuccess(), isA<SSHNPResult>()); | ||
}); | ||
test('SSHNPCommand test', () { | ||
final res = SSHNPCommand(host: 'localhost', localPort: 22); | ||
expect(res, isA<SSHNPSuccess>()); | ||
}); | ||
test('SSHNPNoOpSuccess test', () { | ||
final res = SSHNPNoOpSuccess(); | ||
expect(res, isA<SSHNPResult>()); | ||
expect(res, isA<SSHNPSuccess>()); | ||
}); | ||
test('SSHNPFailure test', () { | ||
expect(SSHNPFailure(), isA<SSHNPResult>()); | ||
}); | ||
test('SSHNPError test', () { | ||
final res = SSHNPError('error message'); | ||
expect(res, isA<SSHNPResult>()); | ||
expect(res, isA<SSHNPFailure>()); | ||
}); | ||
}); | ||
group('SSHNPCommand', () { | ||
test('toString() test', () { | ||
final command = SSHNPCommand( | ||
localPort: 22, | ||
host: 'localhost', | ||
remoteUsername: 'myUsername', | ||
localSshOptions: ['-L 127.0.0.1:8080:127.0.0.1:80'], | ||
privateKeyFileName: '~/.ssh/myPrivateKeyFile', | ||
); | ||
expect( | ||
command.toString(), | ||
equals( | ||
'ssh -p 22 ${optionsWithPrivateKey.join(' ')} ' | ||
'-L 127.0.0.1:8080:127.0.0.1:80 ' | ||
'myUsername@localhost ' | ||
'-i ~/.ssh/myPrivateKeyFile', | ||
), | ||
); | ||
}); | ||
}); | ||
}); | ||
} |