Skip to content

Commit

Permalink
chore(bump): checks package (#5305)
Browse files Browse the repository at this point in the history
* chore(bump): checks package
  • Loading branch information
tyllark committed Aug 20, 2024
1 parent e2fdefa commit 0f78b2b
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 44 deletions.
2 changes: 1 addition & 1 deletion actions/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dev_dependencies:
amplify_lints: ^3.0.0
build_runner: ^2.4.9
build_test: ^2.2.0
checks: ^0.2.2
checks: ^0.3.0
json_serializable: 6.8.0
test: ^1.22.1

Expand Down
35 changes: 17 additions & 18 deletions actions/test/node/interop_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void main() {

test('exec', () async {
await check(childProcess.exec('echo', ['Hello'])).completes(
it()
(it) => it
..has((res) => res.exitCode, 'exitCode').equals(0)
..has((res) => res.stdout, 'stdout').equals('Hello\n'),
);
Expand All @@ -54,19 +54,20 @@ void main() {
test('spawn', () async {
final proc = childProcess.spawn('echo', ['Hello']);
unawaited(
check(proc.stdout!.stream).withQueue.inOrder([
// ignore: unawaited_futures
it()..emits(it()..deepEquals(utf8.encode('Hello\n'))),
// ignore: unawaited_futures
it()..isDone(),
]),
expectLater(
proc.stdout!.stream.map(String.fromCharCodes),
emitsInOrder([
'Hello\n',
emitsDone,
]),
),
);
unawaited(
check(proc.stderr!.stream).withQueue.isDone(),
);
unawaited(
check((proc.onClose, proc.onExit).wait).completes(
it()..has((res) => res.$2.toDartInt, 'exitCode').equals(0),
(it) => it..has((res) => res.$2.toDartInt, 'exitCode').equals(0),
),
);
await check(proc.onSpawn).completes();
Expand All @@ -81,22 +82,20 @@ void main() {
stdin: echo.stdout,
);
unawaited(
check(proc.stdout!.stream).withQueue.inOrder([
it()
// ignore: unawaited_futures
..emits(
it()..deepEquals(utf8.encode('Hello\n')),
),
// ignore: unawaited_futures
it()..isDone(),
]),
expectLater(
proc.stdout!.stream.map(String.fromCharCodes),
emitsInOrder([
'Hello\n',
emitsDone,
]),
),
);
unawaited(
check(proc.stderr!.stream).withQueue.isDone(),
);
unawaited(
check((proc.onClose, proc.onExit).wait).completes(
it()..has((res) => res.$2.toDartInt, 'exitCode').equals(0),
(it) => it..has((res) => res.$2.toDartInt, 'exitCode').equals(0),
),
);
await check(proc.onSpawn).completes();
Expand Down
41 changes: 20 additions & 21 deletions actions/test/node/process_manager_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
library;

import 'dart:async';
import 'dart:convert';

import 'package:actions/actions.dart';
import 'package:actions/src/node/process_manager.dart';
Expand All @@ -29,7 +28,7 @@ void main() {
group('run', () {
test('echo', () async {
await check(processManager.run(['echo', 'Hello'])).completes(
it()
(it) => it
..has((res) => res.exitCode, 'exitCode').equals(0)
..has((res) => res.stdout, 'stdout').equals('Hello\n'),
);
Expand All @@ -38,7 +37,7 @@ void main() {
test('pipe', () async {
final echo = childProcess.spawn('echo', ['Hello']);
await check(processManager.run(['tee'], pipe: echo)).completes(
it()
(it) => it
..has((res) => res.exitCode, 'exitCode').equals(0)
..has((res) => res.stdout, 'stdout').equals('Hello\n'),
);
Expand All @@ -52,39 +51,39 @@ void main() {
['echo', 'Hello'],
mode: mode,
);
final expectedOutput = utf8.encode('Hello\n');
unawaited(
check(proc.stdout).withQueue.inOrder([
if (mode != ProcessStartMode.inheritStdio &&
mode != ProcessStartMode.detached)
// ignore: unawaited_futures
it()..emits(it()..deepEquals(expectedOutput)),
// ignore: unawaited_futures
it()..isDone(),
]),
expectLater(
proc.stdout.map(String.fromCharCodes),
emitsInOrder([
if (mode != ProcessStartMode.inheritStdio &&
mode != ProcessStartMode.detached)
'Hello\n',
emitsDone,
]),
),
);
unawaited(
check(proc.stderr).withQueue.isDone(),
);
check(proc.pid).isGreaterThan(0);
await check(proc.exitCode).completes(it()..equals(0));
await check(proc.exitCode).completes((it) => it..equals(0));
});
}

test('start (pipe)', () async {
final echo = childProcess.spawn('echo', ['Hello']);
final proc = await processManager.start(['tee'], pipe: echo);
unawaited(
check(proc.stdout).withQueue.inOrder([
it()
// ignore: unawaited_futures
..emits(it()..deepEquals(utf8.encode('Hello\n'))),
// ignore: unawaited_futures
it()..isDone(),
]),
expectLater(
proc.stdout.map(String.fromCharCodes),
emitsInOrder([
'Hello\n',
emitsDone,
]),
),
);
unawaited(check(proc.stderr).withQueue.isDone());
await check(proc.exitCode).completes(it()..equals(0));
await check(proc.exitCode).completes((it) => it..equals(0));
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/aft/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ dev_dependencies:
amplify_lints: ">=2.0.2 <2.1.0"
build_runner: ^2.4.9
built_value_generator: 8.8.1
checks: ^0.2.2
checks: ^0.3.0
json_serializable: 6.8.0
test: ^1.22.1
test_descriptor: ^2.0.1
Expand Down
6 changes: 3 additions & 3 deletions packages/aft/test/config/config_loader_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ aft:
'workingDirectory',
).equals(workingDirectory)
..has((config) => config.dependencies.toMap(), 'dependencies').which(
it()
(it) => it
..containsKey('json_serializable')
..not(it()..containsKey('built_value')),
..not((it) => it..containsKey('built_value')),
)
..has((config) => config.scripts.toMap(), 'scripts').which(
it()
(it) => it
..containsKey('license')
..containsKey('format'),
);
Expand Down

0 comments on commit 0f78b2b

Please sign in to comment.