Skip to content

Instantly share code, notes, and snippets.

@tianhaoz95
Created October 16, 2019 18:12
Show Gist options
  • Save tianhaoz95/00223fe9cd0768bbc5f578f66ea1e9b5 to your computer and use it in GitHub Desktop.
Save tianhaoz95/00223fe9cd0768bbc5f578f66ea1e9b5 to your computer and use it in GitHub Desktop.
Headless unit test for Flutter
test('Server defaults', () async {
final WebServerDevice device = WebServerDevice();
expect(device.name, 'Headless Server');
expect(device.id, 'headless-server');
expect(device.supportsHotReload, true);
expect(device.supportsHotRestart, true);
expect(device.supportsStartPaused, true);
expect(device.supportsFlutterExit, true);
expect(device.supportsScreenshot, false);
expect(await device.isLocalEmulator, false);
expect(device.getLogReader(app: mockWebApplicationPackage), isInstanceOf<NoOpDeviceLogReader>());
expect(await device.portForwarder.forward(1), 1);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment