@@ -64,5 +64,76 @@ void main() {
6464 final value2 = await interactionOutput.value ();
6565 expect (value1, value2);
6666 });
67+
68+ test (
69+ "throw a NotReadableException when calling the arrayBuffer() method "
70+ "twice" , () async {
71+ final contentSerdes = ContentSerdes ();
72+ final content = Content (
73+ "text/plain" ,
74+ const Stream .empty (),
75+ );
76+
77+ final interactionOutput = InteractionOutput (
78+ content,
79+ contentSerdes,
80+ Form (Uri .parse ("http://example.org" )),
81+ const DataSchema (),
82+ );
83+
84+ await interactionOutput.arrayBuffer ();
85+
86+ final result = interactionOutput.arrayBuffer ();
87+ await expectLater (
88+ result,
89+ throwsA (
90+ isA <NotReadableException >(),
91+ ),
92+ );
93+ });
94+ });
95+
96+ test (
97+ "throw a NotReadableException in the value() method when no schema is "
98+ "defined" , () async {
99+ final contentSerdes = ContentSerdes ();
100+ final content = Content (
101+ "text/plain" ,
102+ const Stream .empty (),
103+ );
104+
105+ final interactionOutput = InteractionOutput (
106+ content,
107+ contentSerdes,
108+ Form (Uri .parse ("http://example.org" )),
109+ null ,
110+ );
111+
112+ final result = interactionOutput.value ();
113+ await expectLater (
114+ result,
115+ throwsA (
116+ isA <NotReadableException >(),
117+ ),
118+ );
119+ });
120+
121+ test ("allow accessing the form field" , () async {
122+ final contentSerdes = ContentSerdes ();
123+ final content = Content (
124+ "text/plain" ,
125+ const Stream .empty (),
126+ );
127+
128+ final uri = Uri .parse ("http://example.org" );
129+
130+ final interactionOutput = InteractionOutput (
131+ content,
132+ contentSerdes,
133+ Form (uri),
134+ const DataSchema (),
135+ );
136+
137+ expect (interactionOutput.form.href, uri);
67138 });
68139}
0 commit comments