Files
GitJournal/test/core/worker_queue_test.dart
Vishesh Handa fc4eb60c6f Add a WorkerQueue class
This is meant to reduce the code duplication between the LinksLoader and
the MdYamlDocLoader class. So far, it just highlights how fragile
the message passing is between Isolates.
2021-08-09 11:38:05 +02:00

33 lines
747 B
Dart

import 'package:test/test.dart';
import 'package:gitjournal/core/worker_queue.dart';
void main() {
group('WorkerQueue', () {
test('Simple', () async {
var func = (int input) => input + 5;
var worker = WorkerQueue(func);
expect(await worker.call(2), 7);
expect(await worker.call(3), 8);
}, skip: true);
test('Simple2', () async {
var worker = WorkerQueue(func2);
expect(await worker.call(2), 7);
expect(await worker.call(3), 8);
}, skip: true);
test('Simple3', () async {
var worker = WorkerQueue(func3);
expect(await worker.call(2), 7);
expect(await worker.call(3), 8);
});
});
}
int func2(int a) => a + 5;
dynamic func3(dynamic a) => (a as int) + 5;