Skip to content

Commit 1e51b41

Browse files
authored
Migrate injector test to null-safety (#1711)
1 parent 37bf4af commit 1e51b41

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

dwds/test/handlers/injector_test.dart

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
// @dart = 2.9
6-
75
import 'dart:io';
86

97
import 'package:dwds/src/handlers/injector.dart';
@@ -16,13 +14,13 @@ import 'package:test/test.dart';
1614
import '../fixtures/fakes.dart';
1715

1816
void main() {
19-
HttpServer server;
17+
late HttpServer server;
2018
const entryEtag = 'entry etag';
2119
const nonEntryEtag = 'some etag';
2220
final loadStrategy = FakeStrategy();
2321

2422
group('InjectedHandlerWithoutExtension', () {
25-
DwdsInjector injector;
23+
late DwdsInjector injector;
2624
setUp(() async {
2725
injector = DwdsInjector(loadStrategy);
2826
final pipeline = const Pipeline().addMiddleware(injector.middleware);
@@ -117,13 +115,13 @@ void main() {
117115
() async {
118116
final originalResponse = await http.get(Uri.parse(
119117
'http://localhost:${server.port}/entrypoint$bootstrapJsExtension'));
118+
119+
final etagHeader = originalResponse.headers[HttpHeaders.etagHeader];
120+
expect(etagHeader, isNotNull);
120121
final cachedResponse = await http.get(
121122
Uri.parse(
122123
'http://localhost:${server.port}/entrypoint$bootstrapJsExtension'),
123-
headers: {
124-
HttpHeaders.ifNoneMatchHeader:
125-
originalResponse.headers[HttpHeaders.etagHeader]
126-
});
124+
headers: {HttpHeaders.ifNoneMatchHeader: etagHeader!});
127125
expect(cachedResponse.statusCode, HttpStatus.notModified);
128126
});
129127

@@ -209,7 +207,7 @@ void main() {
209207
});
210208

211209
group('InjectedHandlerWithoutExtension using WebSockets', () {
212-
DwdsInjector injector;
210+
late DwdsInjector injector;
213211
setUp(() async {
214212
injector = DwdsInjector(loadStrategy, useSseForInjectedClient: false);
215213
final pipeline = const Pipeline().addMiddleware(injector.middleware);

0 commit comments

Comments
 (0)