mirror of
https://github.com/foss42/apidash.git
synced 2025-08-06 13:51:20 +08:00
Update tests
This commit is contained in:
@ -9,6 +9,7 @@ import 'http_response_models.dart';
|
|||||||
final historyMetaModel1 = HistoryMetaModel(
|
final historyMetaModel1 = HistoryMetaModel(
|
||||||
historyId: 'historyId1',
|
historyId: 'historyId1',
|
||||||
requestId: 'requestId1',
|
requestId: 'requestId1',
|
||||||
|
apiType: APIType.rest,
|
||||||
url: 'https://api.apidash.dev/humanize/social',
|
url: 'https://api.apidash.dev/humanize/social',
|
||||||
method: HTTPVerb.get,
|
method: HTTPVerb.get,
|
||||||
timeStamp: DateTime(2024, 1, 1),
|
timeStamp: DateTime(2024, 1, 1),
|
||||||
@ -26,6 +27,7 @@ final historyRequestModel1 = HistoryRequestModel(
|
|||||||
final historyMetaModel2 = HistoryMetaModel(
|
final historyMetaModel2 = HistoryMetaModel(
|
||||||
historyId: 'historyId2',
|
historyId: 'historyId2',
|
||||||
requestId: 'requestId2',
|
requestId: 'requestId2',
|
||||||
|
apiType: APIType.rest,
|
||||||
url: 'https://api.apidash.dev/case/lower',
|
url: 'https://api.apidash.dev/case/lower',
|
||||||
method: HTTPVerb.post,
|
method: HTTPVerb.post,
|
||||||
timeStamp: DateTime(2024, 1, 1),
|
timeStamp: DateTime(2024, 1, 1),
|
||||||
@ -43,6 +45,7 @@ final historyRequestModel2 = HistoryRequestModel(
|
|||||||
final Map<String, dynamic> historyMetaModelJson1 = {
|
final Map<String, dynamic> historyMetaModelJson1 = {
|
||||||
"historyId": "historyId1",
|
"historyId": "historyId1",
|
||||||
"requestId": "requestId1",
|
"requestId": "requestId1",
|
||||||
|
"apiType": "rest",
|
||||||
"name": "",
|
"name": "",
|
||||||
"url": "https://api.apidash.dev/humanize/social",
|
"url": "https://api.apidash.dev/humanize/social",
|
||||||
"method": "get",
|
"method": "get",
|
||||||
@ -60,6 +63,7 @@ final Map<String, dynamic> historyRequestModelJson1 = {
|
|||||||
final Map<String, dynamic> historyMetaModelJson2 = {
|
final Map<String, dynamic> historyMetaModelJson2 = {
|
||||||
"historyId": "historyId2",
|
"historyId": "historyId2",
|
||||||
"requestId": "requestId2",
|
"requestId": "requestId2",
|
||||||
|
"apiType": "rest",
|
||||||
"name": "",
|
"name": "",
|
||||||
"url": "https://api.apidash.dev/case/lower",
|
"url": "https://api.apidash.dev/case/lower",
|
||||||
"method": "post",
|
"method": "post",
|
||||||
|
@ -388,6 +388,7 @@ const httpRequestModelGet4Json = <String, dynamic>{
|
|||||||
"isParamEnabledList": null,
|
"isParamEnabledList": null,
|
||||||
"bodyContentType": "json",
|
"bodyContentType": "json",
|
||||||
"body": null,
|
"body": null,
|
||||||
|
"query": null,
|
||||||
"formData": null
|
"formData": null
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -408,6 +409,7 @@ const httpRequestModelPost10Json = <String, dynamic>{
|
|||||||
"body": '''{
|
"body": '''{
|
||||||
"text": "I LOVE Flutter"
|
"text": "I LOVE Flutter"
|
||||||
}''',
|
}''',
|
||||||
|
"query": null,
|
||||||
'formData': [
|
'formData': [
|
||||||
{'name': 'token', 'value': 'xyz', 'type': 'text'},
|
{'name': 'token', 'value': 'xyz', 'type': 'text'},
|
||||||
{'name': 'imfile', 'value': '/Documents/up/1.png', 'type': 'file'}
|
{'name': 'imfile', 'value': '/Documents/up/1.png', 'type': 'file'}
|
||||||
|
@ -13,6 +13,7 @@ void main() {
|
|||||||
final mockModel = HistoryMetaModel(
|
final mockModel = HistoryMetaModel(
|
||||||
historyId: 'historyId',
|
historyId: 'historyId',
|
||||||
requestId: 'requestId',
|
requestId: 'requestId',
|
||||||
|
apiType: APIType.rest,
|
||||||
url: 'https://api.apidash.dev',
|
url: 'https://api.apidash.dev',
|
||||||
method: HTTPVerb.get,
|
method: HTTPVerb.get,
|
||||||
timeStamp: DateTime.now(),
|
timeStamp: DateTime.now(),
|
||||||
|
@ -11,6 +11,7 @@ void main() {
|
|||||||
HistoryMetaModel(
|
HistoryMetaModel(
|
||||||
historyId: 'historyId',
|
historyId: 'historyId',
|
||||||
requestId: 'requestId',
|
requestId: 'requestId',
|
||||||
|
apiType: APIType.rest,
|
||||||
url: 'https://api.apidash.dev',
|
url: 'https://api.apidash.dev',
|
||||||
method: HTTPVerb.get,
|
method: HTTPVerb.get,
|
||||||
timeStamp: DateTime.now(),
|
timeStamp: DateTime.now(),
|
||||||
@ -30,6 +31,7 @@ void main() {
|
|||||||
SidebarHistoryCard(
|
SidebarHistoryCard(
|
||||||
id: '1',
|
id: '1',
|
||||||
models: sampleModels,
|
models: sampleModels,
|
||||||
|
apiType: APIType.rest,
|
||||||
method: HTTPVerb.get,
|
method: HTTPVerb.get,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
changedValue = 'Tapped';
|
changedValue = 'Tapped';
|
||||||
@ -68,6 +70,7 @@ void main() {
|
|||||||
children: [
|
children: [
|
||||||
SidebarHistoryCard(
|
SidebarHistoryCard(
|
||||||
id: '1',
|
id: '1',
|
||||||
|
apiType: APIType.rest,
|
||||||
models: sampleModels,
|
models: sampleModels,
|
||||||
method: HTTPVerb.get,
|
method: HTTPVerb.get,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
@ -16,6 +16,7 @@ void main() {
|
|||||||
children: [
|
children: [
|
||||||
SidebarRequestCard(
|
SidebarRequestCard(
|
||||||
id: '23',
|
id: '23',
|
||||||
|
apiType: APIType.rest,
|
||||||
selectedId: '2',
|
selectedId: '2',
|
||||||
url: 'https://api.apidash.dev',
|
url: 'https://api.apidash.dev',
|
||||||
method: HTTPVerb.get,
|
method: HTTPVerb.get,
|
||||||
@ -61,6 +62,7 @@ void main() {
|
|||||||
children: [
|
children: [
|
||||||
SidebarRequestCard(
|
SidebarRequestCard(
|
||||||
id: '2',
|
id: '2',
|
||||||
|
apiType: APIType.rest,
|
||||||
selectedId: '2',
|
selectedId: '2',
|
||||||
editRequestId: '2',
|
editRequestId: '2',
|
||||||
url: 'https://api.apidash.dev',
|
url: 'https://api.apidash.dev',
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import 'package:apidash/consts.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
@ -28,7 +29,7 @@ void main() {
|
|||||||
|
|
||||||
expect(find.byType(TextFormField), findsOneWidget);
|
expect(find.byType(TextFormField), findsOneWidget);
|
||||||
expect(find.byKey(const Key("2")), findsOneWidget);
|
expect(find.byKey(const Key("2")), findsOneWidget);
|
||||||
expect(find.text('Enter content (body)'), findsOneWidget);
|
expect(find.text(kHintContent), findsOneWidget);
|
||||||
var txtForm = find.byKey(const Key("2"));
|
var txtForm = find.byKey(const Key("2"));
|
||||||
await tester.enterText(txtForm, 'entering 123 for testing content body');
|
await tester.enterText(txtForm, 'entering 123 for testing content body');
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
@ -40,7 +41,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(changedValue, 'entering 123 for testing content body ');
|
expect(changedValue, 'entering 123 for testing content body ');
|
||||||
});
|
});
|
||||||
testWidgets('Testing Editor Dark theme', (tester) async {
|
testWidgets('Testing Editor Dark theme', (tester) async {
|
||||||
dynamic changedValue;
|
dynamic changedValue;
|
||||||
@ -66,7 +67,7 @@ void main() {
|
|||||||
expect(find.text('initial'), findsOneWidget);
|
expect(find.text('initial'), findsOneWidget);
|
||||||
expect(find.byType(TextFormField), findsOneWidget);
|
expect(find.byType(TextFormField), findsOneWidget);
|
||||||
expect(find.byKey(const Key("2")), findsOneWidget);
|
expect(find.byKey(const Key("2")), findsOneWidget);
|
||||||
expect(find.text('Enter content (body)'), findsOneWidget);
|
expect(find.text(kHintContent), findsOneWidget);
|
||||||
var txtForm = find.byKey(const Key("2"));
|
var txtForm = find.byKey(const Key("2"));
|
||||||
await tester.enterText(txtForm, 'entering 123 for testing content body');
|
await tester.enterText(txtForm, 'entering 123 for testing content body');
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
@ -78,6 +79,6 @@ void main() {
|
|||||||
|
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(changedValue, 'entering 123 for testing content body ');
|
expect(changedValue, 'entering 123 for testing content body ');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user