Skip to content

Migrate injector test to null-safety #1711

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions dwds/test/handlers/injector_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// @dart = 2.9

import 'dart:io';

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

void main() {
HttpServer server;
late HttpServer server;
const entryEtag = 'entry etag';
const nonEntryEtag = 'some etag';
final loadStrategy = FakeStrategy();

group('InjectedHandlerWithoutExtension', () {
DwdsInjector injector;
late DwdsInjector injector;
setUp(() async {
injector = DwdsInjector(loadStrategy);
final pipeline = const Pipeline().addMiddleware(injector.middleware);
Expand Down Expand Up @@ -117,13 +115,13 @@ void main() {
() async {
final originalResponse = await http.get(Uri.parse(
'http://localhost:${server.port}/entrypoint$bootstrapJsExtension'));

final etagHeader = originalResponse.headers[HttpHeaders.etagHeader];
expect(etagHeader, isNotNull);
final cachedResponse = await http.get(
Uri.parse(
'http://localhost:${server.port}/entrypoint$bootstrapJsExtension'),
headers: {
HttpHeaders.ifNoneMatchHeader:
originalResponse.headers[HttpHeaders.etagHeader]
});
headers: {HttpHeaders.ifNoneMatchHeader: etagHeader!});
expect(cachedResponse.statusCode, HttpStatus.notModified);
});

Expand Down Expand Up @@ -209,7 +207,7 @@ void main() {
});

group('InjectedHandlerWithoutExtension using WebSockets', () {
DwdsInjector injector;
late DwdsInjector injector;
setUp(() async {
injector = DwdsInjector(loadStrategy, useSseForInjectedClient: false);
final pipeline = const Pipeline().addMiddleware(injector.middleware);
Expand Down