From 3643756d49844ac6786f4f20545269c60b239739 Mon Sep 17 00:00:00 2001 From: Jan Romann Date: Sat, 30 Dec 2023 13:58:47 +0100 Subject: [PATCH] test: add tests for InteractionOutput class --- test/core/interaction_output_test.dart | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 test/core/interaction_output_test.dart diff --git a/test/core/interaction_output_test.dart b/test/core/interaction_output_test.dart new file mode 100644 index 00000000..9f29d5d3 --- /dev/null +++ b/test/core/interaction_output_test.dart @@ -0,0 +1,34 @@ +// Copyright 2023 Contributors to the Eclipse Foundation. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +// +// SPDX-License-Identifier: BSD-3-Clause + +import 'dart:convert'; + +import 'package:dart_wot/src/core/content.dart'; +import 'package:dart_wot/src/core/content_serdes.dart'; +import 'package:dart_wot/src/core/interaction_output.dart'; +import 'package:test/test.dart'; + +void main() { + group('InteractionOutput should', () { + test('output the correct value', () async { + const inputValue = 'foo'; + final input = utf8.encode(inputValue); + + final contentSerdes = ContentSerdes(); + final content = Content( + 'text/plain', + Stream.fromIterable([ + input, + ]), + ); + + final interactionOutput = InteractionOutput(content, contentSerdes); + + final value = await interactionOutput.value(); + expect(value, inputValue); + }); + }); +}