Skip to content

Commit

Permalink
fix API test
Browse files Browse the repository at this point in the history
  • Loading branch information
Barabas5532 committed Jul 23, 2024
1 parent 596ac26 commit 93369bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 50 deletions.
1 change: 0 additions & 1 deletion frontend/lib/robust_websocket.dart
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ class RobustWebsocket extends ChangeNotifier

@override
void dispose() {
_log.shout('dispose');
_disposed = true;
super.dispose();
unawaited(_streamController.close());
Expand Down
54 changes: 5 additions & 49 deletions frontend/test/firmware_api_test/firmware_api_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void main() {
);
});

test(skip: true, 'wifi provisioning', () async {
test('wifi provisioning', () async {
await nvsErase(port: port);
await connectToDutAccessPoint(macAddress);
await setUpWiFi(ssid: networkSsid, password: networkPassphrase);
Expand All @@ -133,63 +133,21 @@ void main() {
});

test('simple test', () async {
final log = Logger('debug');

log.shout('create container');
final container = createContainer(
overrides: [
normalHostProvider.overrideWithValue(dutIpAddress),
],
observers: [ProviderObserverImpl()],
);

/*
final stream = container
.listenAsStream(audioParameterDoubleModelProvider('ampGain'))
.logInfo(
Logger('debug'),
(event) => 'event $event',
);
log.shout('setup expectation');
final expectation = expectLater(
stream,
container.listenAsStream(audioParameterDoubleModelProvider('ampGain')),
emitsInOrder([
isAsyncLoading<double>(),
isAsyncData<double>(closeTo(0.5, 0.000001)),
]),
);

log.shout('pump1');
await pumpEventQueue();
await Future<void>.delayed(const Duration(seconds: 1));
log.shout('pump2');
await pumpEventQueue();
await Future<void>.delayed(const Duration(seconds: 1));
log.shout('pump3');
await pumpEventQueue();
log.shout('wait expectation');
await Future<void>.delayed(const Duration(seconds: 10));
await expectation;
*/

container.listen(audioParameterDoubleModelProvider('ampGain'),
(previous, next) {
Logger('debug').info('prev $previous next $next');
});

/*
container
.listenAsStream(
audioParameterDoubleModelProvider('ampGain'),
)
.listen((event) => Logger('debug').info('event $event'));
*/

await Future<void>.delayed(const Duration(seconds: 10));
});
});
}
Expand All @@ -198,14 +156,12 @@ extension ProviderContainerTestEx on ProviderContainer {
Stream<T> listenAsStream<T>(ProviderListenable<T> provider) {
final controller = StreamController<T>();

Logger('debug').shout('listening');
late final subscription = listen(
final subscription = listen(
provider,
(o, value) {
Logger('debug').shout('provider notified $o $value');
(_, value) {
controller.add(value);
},
fireImmediately: false,
fireImmediately: true,
);

controller.onCancel = () {
Expand Down

0 comments on commit 93369bc

Please sign in to comment.