Skip to content

Commit

Permalink
mitigate server bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Leptopoda committed Apr 1, 2023
1 parent 8c3442d commit 2fa544a
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 39 deletions.
20 changes: 10 additions & 10 deletions lib/src/model/recipe_stub.dart
Expand Up @@ -85,12 +85,10 @@ class _$RecipeStubSerializer implements PrimitiveSerializer<RecipeStub> {
);
}
yield r'recipe_id';
yield serializers
.serialize(
object.recipeId,
specifiedType: const FullType(int),
)
.toString();
yield serializers.serialize(
object.recipeId,
specifiedType: const FullType(String),
);
}

@override
Expand Down Expand Up @@ -159,10 +157,12 @@ class _$RecipeStubSerializer implements PrimitiveSerializer<RecipeStub> {
result.dateModified = valueDes;
break;
case r'recipe_id':
final valueDes = serializers.deserialize(
value,
specifiedType: const FullType(String),
) as String;
final valueDes = serializers
.deserialize(
value,
specifiedType: const FullType(int),
)
.toString();
result.recipeId = valueDes;
break;
default:
Expand Down
20 changes: 10 additions & 10 deletions lib/src/model/recipe_stub_all_of.dart
Expand Up @@ -37,12 +37,10 @@ class _$RecipeStubAllOfSerializer
FullType specifiedType = FullType.unspecified,
}) sync* {
yield r'recipe_id';
yield serializers
.serialize(
object.recipeId,
specifiedType: const FullType(int),
)
.toString();
yield serializers.serialize(
object.recipeId,
specifiedType: const FullType(String),
);
}

@override
Expand Down Expand Up @@ -117,10 +115,12 @@ class _$$RecipeStubAllOfSerializer
final value = serializedList[i + 1];
switch (key) {
case r'recipe_id':
final valueDes = serializers.deserialize(
value,
specifiedType: const FullType(String),
) as String;
final valueDes = serializers
.deserialize(
value,
specifiedType: const FullType(int),
)
.toString();
result.recipeId = valueDes;
break;
default:
Expand Down
36 changes: 18 additions & 18 deletions test/recipes_api_test.dart
Expand Up @@ -93,28 +93,28 @@ void main() {

expect(response.data, isNotNull);
});
});

// Search for recipes for keywords, tags and categories with the named search string
//
//Future<BuiltList<RecipeStub>> search(String query) async
test('test search', () async {
final response = await instance.search(query: "Vegetarisch");
// Search for recipes for keywords, tags and categories with the named search string
//
//Future<BuiltList<RecipeStub>> search(String query) async
test('test search', () async {
final response = await instance.search(query: "Vegetarisch");

expect(response.data?.length, equals(2));
});
expect(response.data?.length, equals(2));
});

// Update a recipe
//
//Future<int> updateRecipe(int id, Recipe recipe) async
test('test updateRecipe', () async {
final recipe = RecipeBuilder()
..name = "My super cool recipe"
..dateCreated = DateTime.utc(2023);
final response =
await instance.updateRecipe(id: 0, recipe: recipe.build());
// Update a recipe
//
//Future<int> updateRecipe(int id, Recipe recipe) async
test('test updateRecipe', () async {
final recipe = RecipeBuilder()
..name = "My super cool recipe"
..dateCreated = DateTime.utc(2023);
final response =
await instance.updateRecipe(id: 0, recipe: recipe.build());

expect(response.data, isNotNull);
});
expect(response.data, isNotNull);
});
});
}
2 changes: 1 addition & 1 deletion test/utils/api_client.dart
Expand Up @@ -8,7 +8,7 @@ NcCookbookApi setupClient() {
BaseOptions(
baseUrl: 'https://localhost/apps/cookbook',
connectTimeout: Duration(seconds: 5),
receiveTimeout: Duration(seconds: 3),
receiveTimeout: Duration(seconds: 10),
),
);

Expand Down

0 comments on commit 2fa544a

Please sign in to comment.