mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-28 18:03:14 +08:00
Github/GitLab test: Try to guess where the test data is
The env in the CI seems to be a bit different
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:path/path.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'package:gitjournal/apis/githost_factory.dart';
|
||||
@ -9,7 +10,18 @@ import 'package:gitjournal/apis/github.dart';
|
||||
void main() {
|
||||
test('Parse json', () async {
|
||||
print("Current Dir: ${Directory.current}");
|
||||
var jsonString = File('test/apis/data/github.json').readAsStringSync();
|
||||
var testDataPath = '';
|
||||
|
||||
var currentDir = Directory.current;
|
||||
var folderName = basename(currentDir.path);
|
||||
|
||||
if (folderName == 'test') {
|
||||
testDataPath = join(currentDir.path, 'apis/data/github.json');
|
||||
} else {
|
||||
testDataPath = join(currentDir.path, 'test/apis/data/github.json');
|
||||
}
|
||||
|
||||
var jsonString = File(testDataPath).readAsStringSync();
|
||||
|
||||
var api = GitHub();
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:path/path.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'package:gitjournal/apis/githost_factory.dart';
|
||||
@ -9,7 +10,18 @@ import 'package:gitjournal/apis/gitlab.dart';
|
||||
void main() {
|
||||
test('Parse json', () async {
|
||||
print("Current Dir: ${Directory.current}");
|
||||
var jsonString = File('test/apis/data/gitlab.json').readAsStringSync();
|
||||
var testDataPath = '';
|
||||
|
||||
var currentDir = Directory.current;
|
||||
var folderName = basename(currentDir.path);
|
||||
|
||||
if (folderName == 'test') {
|
||||
testDataPath = join(currentDir.path, 'apis/data/gitlab.json');
|
||||
} else {
|
||||
testDataPath = join(currentDir.path, 'test/apis/data/gitlab.json');
|
||||
}
|
||||
|
||||
var jsonString = File(testDataPath).readAsStringSync();
|
||||
|
||||
var api = GitLab();
|
||||
|
||||
|
@ -22,9 +22,8 @@
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'package:markdown/markdown.dart' as md;
|
||||
import 'package:test/test.dart';
|
||||
|
||||
/// Parse [[term]]
|
||||
class _WikiLinkSyntax extends md.InlineSyntax {
|
||||
|
Reference in New Issue
Block a user