Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

Commit

Permalink
Exercise API server
Browse files Browse the repository at this point in the history
  • Loading branch information
jcollins-g committed Jul 31, 2018
1 parent 95b87b9 commit 0802d35
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
7 changes: 0 additions & 7 deletions lib/src/analysis_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@ class AnalysisServerWrapper {
mainPath = _getPathFromName(kMainDart);

serverScheduler = new TaskScheduler();

// Write an analysis_options.yaml file with strong mode enabled.
// TODO(jcollins-g): this is only required for Travis. Find out why, then
// remove this hack.
File optionsFile = new File(_getPathFromName('analysis_options.yaml'));
optionsFile.writeAsStringSync(
'analyzer:\n strong-mode: true\n enablePreviewDart2: $previewDart2\n');
}

Future init() {
Expand Down
15 changes: 15 additions & 0 deletions test/common_server_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,24 @@ void defineTests() {

server = new CommonServer(sdkPath, container, cache, counter);
await server.init();
await server.warmup();

apiServer = new ApiServer(apiPrefix: '/api', prettyPrint: true);
apiServer.addApi(server);

{
var decodedJson = {};
var jsonData = {'source': sampleCodeError};
while (decodedJson.isEmpty) {
var response =
await _sendPostRequest('dartservices/v1/analyze', jsonData);
expect(response.status, 200);
expect(response.headers['content-type'],
'application/json; charset=utf-8');
var data = await response.body.first;
decodedJson = json.decode(utf8.decode(data));
}
}
});

tearDownAll(() {
Expand Down

0 comments on commit 0802d35

Please sign in to comment.