testcases

package
v0.0.0-...-52f6943 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 16, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CheckReadinessData = []CheckReadiness{
	{
		Description:        "check_readiness_database_ok",
		MockCheckReadiness: nil,
		MockUsecase:        nil,
	}, {
		Description:        "check_readiness_database_not_ok",
		MockCheckReadiness: errors.New("something_went_wrong"),
		MockUsecase:        errors.New("something_went_wrong"),
	},
}
View Source
var CreateCommentOnAPostData = []CreateCommentOnAPost{
	{
		Description:       "success_create_comment",
		UsecaseRequest:    newComment,
		RepositoryRequest: newCommentRepository,
		UpdatePostRequest: updateTotalCommentPost,
		MockUpdatePost:    nil,
		MockRepository: ResponseCreateComment{
			ID:    1,
			Error: nil,
		},
		MockUsecase: nil,
	}, {
		Description:       "failed_create_comment",
		UsecaseRequest:    newComment,
		RepositoryRequest: newCommentRepository,
		UpdatePostRequest: updateTotalCommentPost,
		MockUpdatePost:    nil,
		MockRepository: ResponseCreateComment{
			ID:    0,
			Error: errors.New("something_went_wrong"),
		},
		MockUsecase: errors.New("something_went_wrong"),
	}, {
		Description:       "failed_update_post",
		UsecaseRequest:    newComment,
		RepositoryRequest: newCommentRepository,
		UpdatePostRequest: updateTotalCommentPost,
		MockUpdatePost:    errors.New("something_went_wrong"),
		MockRepository: ResponseCreateComment{
			ID:    1,
			Error: nil,
		},
		MockUsecase: errors.New("something_went_wrong"),
	},
}
View Source
var CreateNewUserPostData = []CreateNewUserPost{
	{
		Description:       "succes_insert_new_post",
		UsecaseRequest:    newPostRequest,
		RepositoryRequest: newRepositoryRequest,
		MockRepository:    nil,
		MockUsecase:       nil,
	}, {
		Description:       "failed_insert_new_post",
		UsecaseRequest:    newPostRequest,
		RepositoryRequest: newRepositoryRequest,
		MockRepository:    errors.New("something_went_wrong"),
		MockUsecase:       errors.New("something_went_wrong"),
	},
}
View Source
var GetCommentsData = []GetComments{
	{
		Description:                      "success_get_list_comments",
		UsecaseParams:                    reqUsecase,
		GetCommentsByIDRequestRepository: reqRepository,
		GetTotalComment:                  1,
		GetActorParams:                   1,
		ResponseGetComments: ResponseGetCommentsRepository{
			Result: commentsRepository,
			Error:  nil,
		},
		ResponseGetTotalComment: ResponseGetTotalComment{
			Result: amountComments,
			Error:  nil,
		},
		ResponseGetActor: ResponseGetActor{
			Result: actorResponse,
			Error:  nil,
		},
		ResponseUsecase: ResponseGetCommentsUsecase{
			Result: responseUsecase,
			Error:  nil,
		},
	}, {
		Description:                      "success_get_list_comments_even_nil_comment",
		UsecaseParams:                    reqUsecase,
		GetCommentsByIDRequestRepository: reqRepository,
		GetActorParams:                   1,
		GetTotalComment:                  1,
		ResponseGetComments: ResponseGetCommentsRepository{
			Result: nil,
			Error:  nil,
		},
		ResponseGetTotalComment: ResponseGetTotalComment{
			Result: amountComments,
			Error:  nil,
		},
		ResponseGetActor: ResponseGetActor{
			Result: nil,
			Error:  nil,
		},
		ResponseUsecase: ResponseGetCommentsUsecase{
			Result: nil,
			Error:  nil,
		},
	}, {
		Description:                      "failed_get_list_comments",
		UsecaseParams:                    reqUsecase,
		GetCommentsByIDRequestRepository: reqRepository,
		GetTotalComment:                  1,
		GetActorParams:                   1,
		ResponseGetComments: ResponseGetCommentsRepository{
			Result: nil,
			Error:  errors.New("failed_get_comments"),
		},
		ResponseGetTotalComment: ResponseGetTotalComment{
			Result: nil,
			Error:  nil,
		},
		ResponseGetActor: ResponseGetActor{
			Result: nil,
			Error:  errors.New("failed_get_comments"),
		},
		ResponseUsecase: ResponseGetCommentsUsecase{
			Result: nil,
			Error:  errors.New("failed_get_comments"),
		},
	}, {
		Description:                      "failed_get_metadata_comments",
		UsecaseParams:                    reqUsecase,
		GetCommentsByIDRequestRepository: reqRepository,
		GetTotalComment:                  1,
		GetActorParams:                   1,
		ResponseGetComments: ResponseGetCommentsRepository{
			Result: commentsRepository,
			Error:  nil,
		},
		ResponseGetTotalComment: ResponseGetTotalComment{
			Result: nil,
			Error:  errors.New("failed_get_metadata"),
		},
		ResponseGetActor: ResponseGetActor{
			Result: nil,
			Error:  errors.New("failed_get_metadata"),
		},
		ResponseUsecase: ResponseGetCommentsUsecase{
			Result: nil,
			Error:  errors.New("failed_get_metadata"),
		},
	},
}
View Source
var GetDetailUserPostData = []GetDetailUserPost{
	{
		Description:            "success_get_detail_user_post",
		UsecaseParams:          1,
		GetUserPostParams:      1,
		GetActorParams:         1,
		GetLastCommentParams:   1,
		GetTotalCommentsParams: 1,
		IsLikedRequest:         requestLikeOnPost,
		CheckIsLikedResponse: CheckIsLikedResponse{
			Result: true,
			Error:  nil,
		},
		ResponseGetDetailUserPost: ResponseGetDetailUserPost{
			Result: postDetail,
			Error:  nil,
		},
		ResponseGetActor: ResponseGetActor{
			Result: actorResponse,
			Error:  nil,
		},
		ResponseGetLastComment: ResponseGetLastComment{
			Result: commentResponse,
			Error:  nil,
		},
		ResponseGetTotalComment: ResponseGetTotalComment{
			Result: totalComment,
			Error:  nil,
		},
		ResponseGetDetailUsecase: ResponseGetDetailUsecase{
			Result: userpostResponse,
			Error:  nil,
		},
	}, {
		Description:            "failed_get_detail",
		UsecaseParams:          1,
		GetUserPostParams:      1,
		GetActorParams:         1,
		GetLastCommentParams:   1,
		GetTotalCommentsParams: 1,
		IsLikedRequest:         requestLikeOnPost,
		CheckIsLikedResponse: CheckIsLikedResponse{
			Result: true,
			Error:  nil,
		},
		ResponseGetDetailUserPost: ResponseGetDetailUserPost{
			Result: nil,
			Error:  errors.New("failed_get_detail"),
		},
		ResponseGetActor: ResponseGetActor{
			Result: actorResponse,
			Error:  nil,
		},
		ResponseGetLastComment: ResponseGetLastComment{
			Result: commentResponse,
			Error:  nil,
		},
		ResponseGetTotalComment: ResponseGetTotalComment{
			Result: totalComment,
			Error:  nil,
		},
		ResponseGetDetailUsecase: ResponseGetDetailUsecase{
			Result: nil,
			Error:  errors.New("failed_get_detail"),
		},
	}, {
		Description:            "failed_get_comment",
		UsecaseParams:          1,
		GetUserPostParams:      1,
		GetActorParams:         1,
		GetLastCommentParams:   1,
		GetTotalCommentsParams: 1,
		IsLikedRequest:         requestLikeOnPost,
		CheckIsLikedResponse: CheckIsLikedResponse{
			Result: true,
			Error:  nil,
		},
		ResponseGetDetailUserPost: ResponseGetDetailUserPost{
			Result: postDetail,
			Error:  nil,
		},
		ResponseGetActor: ResponseGetActor{
			Result: actorResponse,
			Error:  nil,
		},
		ResponseGetLastComment: ResponseGetLastComment{
			Result: nil,
			Error:  errors.New("failed_get_comment"),
		},
		ResponseGetTotalComment: ResponseGetTotalComment{
			Result: totalComment,
			Error:  nil,
		},
		ResponseGetDetailUsecase: ResponseGetDetailUsecase{
			Result: nil,
			Error:  errors.New("failed_get_comment"),
		},
	}, {
		Description:            "failed_get_actor",
		UsecaseParams:          1,
		GetUserPostParams:      1,
		GetActorParams:         1,
		GetLastCommentParams:   1,
		GetTotalCommentsParams: 1,
		IsLikedRequest:         requestLikeOnPost,
		CheckIsLikedResponse: CheckIsLikedResponse{
			Result: true,
			Error:  nil,
		},
		ResponseGetDetailUserPost: ResponseGetDetailUserPost{
			Result: postDetail,
			Error:  nil,
		},
		ResponseGetActor: ResponseGetActor{
			Result: nil,
			Error:  errors.New("failed_get_actor"),
		},
		ResponseGetLastComment: ResponseGetLastComment{
			Result: commentResponse,
			Error:  nil,
		},
		ResponseGetTotalComment: ResponseGetTotalComment{
			Result: totalComment,
			Error:  nil,
		},
		ResponseGetDetailUsecase: ResponseGetDetailUsecase{
			Result: nil,
			Error:  errors.New("failed_get_actor"),
		},
	}, {
		Description:            "failed_get_is_liked_post",
		UsecaseParams:          1,
		GetUserPostParams:      1,
		GetActorParams:         1,
		GetLastCommentParams:   1,
		GetTotalCommentsParams: 1,
		IsLikedRequest:         requestLikeOnPost,
		CheckIsLikedResponse: CheckIsLikedResponse{
			Result: false,
			Error:  errors.New("something_went_wrong"),
		},
		ResponseGetDetailUserPost: ResponseGetDetailUserPost{
			Result: postDetail,
			Error:  nil,
		},
		ResponseGetActor: ResponseGetActor{
			Result: actorResponse,
			Error:  nil,
		},
		ResponseGetLastComment: ResponseGetLastComment{
			Result: commentResponse,
			Error:  nil,
		},
		ResponseGetTotalComment: ResponseGetTotalComment{
			Result: totalComment,
			Error:  nil,
		},
		ResponseGetDetailUsecase: ResponseGetDetailUsecase{
			Result: nil,
			Error:  errors.New("something_went_wrong"),
		},
	},
}
View Source
var GetListUserPostByMeData = []GetListUserPostByMe{
	{
		Description:            "success_get_list_user_post_by_me",
		UsecaseParams:          &requestUsecase,
		GetUserPostParams:      userpostbyme,
		GetMetadataParams:      userpostbyme,
		GetActorParams:         1,
		GetLastCommentParams:   1,
		GetTotalCommentsParams: 1,
		IsLikedRequest:         requestLikeOnPost,
		CheckIsLikedResponse: CheckIsLikedResponse{
			Result: true,
			Error:  nil,
		},
		ResponseGetList: ResponseGetList{
			Result: postResponse,
			Error:  nil,
		},
		ResponseGetActor: ResponseGetActor{
			Result: actorResponse,
			Error:  nil,
		},
		ResponseMetadata: ResponseMetadata{
			Result: metadataResponse,
			Error:  nil,
		},
		ResponseGetLastComment: ResponseGetLastComment{
			Result: commentResponse,
			Error:  nil,
		},
		ResponseGetTotalComment: ResponseGetTotalComment{
			Result: totalComment,
			Error:  nil,
		},
		ResponseUsecase: ResponseUsecase{
			Result: usecaseResponse,
			Error:  nil,
		},
	}, {
		Description:            "failed_get_list_user_post_by_me",
		UsecaseParams:          &requestUsecase,
		GetUserPostParams:      userpostbyme,
		GetMetadataParams:      userpostbyme,
		GetActorParams:         1,
		GetLastCommentParams:   1,
		GetTotalCommentsParams: 1,
		IsLikedRequest:         requestLikeOnPost,
		CheckIsLikedResponse: CheckIsLikedResponse{
			Result: true,
			Error:  nil,
		},
		ResponseGetList: ResponseGetList{
			Result: nil,
			Error:  errors.New("failed_get_user_posts_by_me"),
		},
		ResponseGetActor: ResponseGetActor{
			Result: nil,
			Error:  nil,
		},
		ResponseMetadata: ResponseMetadata{
			Result: nil,
			Error:  nil,
		},
		ResponseGetLastComment: ResponseGetLastComment{
			Result: nil,
			Error:  nil,
		},
		ResponseGetTotalComment: ResponseGetTotalComment{
			Result: nil,
			Error:  nil,
		},
		ResponseUsecase: ResponseUsecase{
			Result: nil,
			Error:  errors.New("failed_get_user_posts_by_me"),
		},
	}, {
		Description:            "failed_get_actor",
		UsecaseParams:          &requestUsecase,
		GetUserPostParams:      userpostbyme,
		GetMetadataParams:      userpostbyme,
		GetActorParams:         1,
		GetLastCommentParams:   1,
		GetTotalCommentsParams: 1,
		IsLikedRequest:         requestLikeOnPost,
		CheckIsLikedResponse: CheckIsLikedResponse{
			Result: true,
			Error:  nil,
		},
		ResponseGetList: ResponseGetList{
			Result: postResponse,
			Error:  nil,
		},
		ResponseGetActor: ResponseGetActor{
			Result: nil,
			Error:  errors.New("failed_get_actor"),
		},
		ResponseMetadata: ResponseMetadata{
			Result: metadataResponse,
			Error:  nil,
		},
		ResponseGetLastComment: ResponseGetLastComment{
			Result: nil,
			Error:  errors.New("failed_get_actor"),
		},
		ResponseGetTotalComment: ResponseGetTotalComment{
			Result: nil,
			Error:  errors.New("failed_get_actor"),
		},
		ResponseUsecase: ResponseUsecase{
			Result: nil,
			Error:  errors.New("failed_get_actor"),
		},
	}, {
		Description:            "failed_get_comment",
		UsecaseParams:          &requestUsecase,
		GetUserPostParams:      userpostbyme,
		GetMetadataParams:      userpostbyme,
		GetActorParams:         1,
		GetLastCommentParams:   1,
		GetTotalCommentsParams: 1,
		IsLikedRequest:         requestLikeOnPost,
		CheckIsLikedResponse: CheckIsLikedResponse{
			Result: true,
			Error:  nil,
		},
		ResponseGetList: ResponseGetList{
			Result: postResponse,
			Error:  nil,
		},
		ResponseGetActor: ResponseGetActor{
			Result: actorResponse,
			Error:  nil,
		},
		ResponseMetadata: ResponseMetadata{
			Result: metadataResponse,
			Error:  nil,
		},
		ResponseGetLastComment: ResponseGetLastComment{
			Result: nil,
			Error:  errors.New("failed_get_comment"),
		},
		ResponseGetTotalComment: ResponseGetTotalComment{
			Result: totalComment,
			Error:  nil,
		},
		ResponseUsecase: ResponseUsecase{
			Result: nil,
			Error:  errors.New("failed_get_comment"),
		},
	}, {
		Description:            "failed_get_total_comment",
		UsecaseParams:          &requestUsecase,
		GetUserPostParams:      userpostbyme,
		GetMetadataParams:      userpostbyme,
		GetActorParams:         1,
		GetLastCommentParams:   1,
		GetTotalCommentsParams: 1,
		IsLikedRequest:         requestLikeOnPost,
		CheckIsLikedResponse: CheckIsLikedResponse{
			Result: true,
			Error:  nil,
		},
		ResponseGetList: ResponseGetList{
			Result: postResponse,
			Error:  nil,
		},
		ResponseGetActor: ResponseGetActor{
			Result: actorResponse,
			Error:  nil,
		},
		ResponseMetadata: ResponseMetadata{
			Result: metadataResponse,
			Error:  nil,
		},
		ResponseGetLastComment: ResponseGetLastComment{
			Result: nil,
			Error:  errors.New("failed_get_total_comment"),
		},
		ResponseGetTotalComment: ResponseGetTotalComment{
			Result: nil,
			Error:  errors.New("failed_get_total_comment"),
		},
		ResponseUsecase: ResponseUsecase{
			Result: nil,
			Error:  errors.New("failed_get_total_comment"),
		},
	}, {
		Description:            "failed_get_metadata",
		UsecaseParams:          &requestUsecase,
		GetUserPostParams:      userpostbyme,
		GetMetadataParams:      userpostbyme,
		GetActorParams:         1,
		GetLastCommentParams:   1,
		GetTotalCommentsParams: 1,
		IsLikedRequest:         requestLikeOnPost,
		CheckIsLikedResponse: CheckIsLikedResponse{
			Result: true,
			Error:  nil,
		},
		ResponseGetList: ResponseGetList{
			Result: postResponse,
			Error:  nil,
		},
		ResponseGetActor: ResponseGetActor{
			Result: actorResponse,
			Error:  nil,
		},
		ResponseMetadata: ResponseMetadata{
			Result: nil,
			Error:  errors.New("failed_get_metadata"),
		},
		ResponseGetLastComment: ResponseGetLastComment{
			Result: commentResponse,
			Error:  nil,
		},
		ResponseGetTotalComment: ResponseGetTotalComment{
			Result: totalComment,
			Error:  nil,
		},
		ResponseUsecase: ResponseUsecase{
			Result: nil,
			Error:  errors.New("failed_get_metadata"),
		},
	}, {
		Description:            "failed_get_metadata",
		UsecaseParams:          &requestUsecase,
		GetUserPostParams:      userpostbyme,
		GetMetadataParams:      userpostbyme,
		GetActorParams:         1,
		GetLastCommentParams:   1,
		GetTotalCommentsParams: 1,
		IsLikedRequest:         requestLikeOnPost,
		CheckIsLikedResponse: CheckIsLikedResponse{
			Result: false,
			Error:  errors.New("something_went_wrong"),
		},
		ResponseGetList: ResponseGetList{
			Result: postResponse,
			Error:  nil,
		},
		ResponseGetActor: ResponseGetActor{
			Result: actorResponse,
			Error:  nil,
		},
		ResponseMetadata: ResponseMetadata{
			Result: nil,
			Error:  errors.New("failed_get_metadata"),
		},
		ResponseGetLastComment: ResponseGetLastComment{
			Result: commentResponse,
			Error:  nil,
		},
		ResponseGetTotalComment: ResponseGetTotalComment{
			Result: totalComment,
			Error:  nil,
		},
		ResponseUsecase: ResponseUsecase{
			Result: nil,
			Error:  errors.New("failed_get_metadata"),
		},
	},
}
View Source
var GetListUserPostData = []GetListUserPost{
	{
		Description:            "success_get_list_user_post",
		UsecaseParams:          requestUsecase,
		GetUserPostParams:      userPostParams,
		GetMetadataParams:      userPostParams,
		GetActorParams:         1,
		GetLastCommentParams:   1,
		GetTotalCommentsParams: 1,
		IsLikedRequest:         requestLikeOnPost,
		CheckIsLikedResponse: CheckIsLikedResponse{
			Result: true,
			Error:  nil,
		},
		ResponseGetList: ResponseGetList{
			Result: postResponse,
			Error:  nil,
		},
		ResponseGetActor: ResponseGetActor{
			Result: actorResponse,
			Error:  nil,
		},
		ResponseMetadata: ResponseMetadata{
			Result: metadataResponse,
			Error:  nil,
		},
		ResponseGetLastComment: ResponseGetLastComment{
			Result: commentResponse,
			Error:  nil,
		},
		ResponseGetTotalComment: ResponseGetTotalComment{
			Result: totalComment,
			Error:  nil,
		},
		ResponseUsecase: ResponseUsecase{
			Result: usecaseResponse,
			Error:  nil,
		},
	}, {
		Description:            "failed_get_user_post",
		UsecaseParams:          requestUsecase,
		GetUserPostParams:      userPostParams,
		GetMetadataParams:      userPostParams,
		GetActorParams:         1,
		GetLastCommentParams:   1,
		GetTotalCommentsParams: 1,
		IsLikedRequest:         requestLikeOnPost,
		CheckIsLikedResponse: CheckIsLikedResponse{
			Result: true,
			Error:  nil,
		},
		ResponseGetList: ResponseGetList{
			Result: nil,
			Error:  errors.New("failed_get_user_posts"),
		},
		ResponseGetActor: ResponseGetActor{
			Result: nil,
			Error:  nil,
		},
		ResponseMetadata: ResponseMetadata{
			Result: nil,
			Error:  nil,
		},
		ResponseGetLastComment: ResponseGetLastComment{
			Result: nil,
			Error:  nil,
		},
		ResponseGetTotalComment: ResponseGetTotalComment{
			Result: nil,
			Error:  nil,
		},
		ResponseUsecase: ResponseUsecase{
			Result: nil,
			Error:  errors.New("failed_get_user_posts"),
		},
	}, {
		Description:            "failed_get_actor_created",
		UsecaseParams:          requestUsecase,
		GetUserPostParams:      userPostParams,
		GetMetadataParams:      userPostParams,
		GetActorParams:         1,
		GetLastCommentParams:   1,
		GetTotalCommentsParams: 1,
		IsLikedRequest:         requestLikeOnPost,
		CheckIsLikedResponse: CheckIsLikedResponse{
			Result: true,
			Error:  nil,
		},
		ResponseGetList: ResponseGetList{
			Result: postResponse,
			Error:  nil,
		},
		ResponseGetActor: ResponseGetActor{
			Result: nil,
			Error:  errors.New("failed_get_actor"),
		},
		ResponseMetadata: ResponseMetadata{
			Result: metadataResponse,
			Error:  nil,
		},
		ResponseGetLastComment: ResponseGetLastComment{
			Result: commentResponse,
			Error:  nil,
		},
		ResponseGetTotalComment: ResponseGetTotalComment{
			Result: totalComment,
			Error:  nil,
		},
		ResponseUsecase: ResponseUsecase{
			Result: nil,
			Error:  errors.New("failed_get_actor"),
		},
	}, {
		Description:            "failed_get_comment",
		UsecaseParams:          requestUsecase,
		GetUserPostParams:      userPostParams,
		GetMetadataParams:      userPostParams,
		GetActorParams:         1,
		GetLastCommentParams:   1,
		GetTotalCommentsParams: 1,
		IsLikedRequest:         requestLikeOnPost,
		CheckIsLikedResponse: CheckIsLikedResponse{
			Result: true,
			Error:  nil,
		},
		ResponseGetList: ResponseGetList{
			Result: postResponse,
			Error:  nil,
		},
		ResponseGetActor: ResponseGetActor{
			Result: actorResponse,
			Error:  nil,
		},
		ResponseMetadata: ResponseMetadata{
			Result: metadataResponse,
			Error:  nil,
		},
		ResponseGetLastComment: ResponseGetLastComment{
			Result: nil,
			Error:  errors.New("failed_get_comment"),
		},
		ResponseGetTotalComment: ResponseGetTotalComment{
			Result: totalComment,
			Error:  nil,
		},
		ResponseUsecase: ResponseUsecase{
			Result: nil,
			Error:  errors.New("failed_get_comment"),
		},
	}, {
		Description:            "failed_get_metadata",
		UsecaseParams:          requestUsecase,
		GetUserPostParams:      userPostParams,
		GetMetadataParams:      userPostParams,
		GetActorParams:         1,
		GetLastCommentParams:   1,
		GetTotalCommentsParams: 1,
		IsLikedRequest:         requestLikeOnPost,
		CheckIsLikedResponse: CheckIsLikedResponse{
			Result: true,
			Error:  nil,
		},
		ResponseGetList: ResponseGetList{
			Result: postResponse,
			Error:  nil,
		},
		ResponseGetActor: ResponseGetActor{
			Result: actorResponse,
			Error:  nil,
		},
		ResponseMetadata: ResponseMetadata{
			Result: nil,
			Error:  errors.New("failed_get_metadata"),
		},
		ResponseGetLastComment: ResponseGetLastComment{
			Result: commentResponse,
			Error:  nil,
		},
		ResponseGetTotalComment: ResponseGetTotalComment{
			Result: totalComment,
			Error:  nil,
		},
		ResponseUsecase: ResponseUsecase{
			Result: nil,
			Error:  errors.New("failed_get_metadata"),
		},
	}, {
		Description:            "failed_check_is_liked",
		UsecaseParams:          requestUsecase,
		GetUserPostParams:      userPostParams,
		GetMetadataParams:      userPostParams,
		GetActorParams:         1,
		GetLastCommentParams:   1,
		GetTotalCommentsParams: 1,
		IsLikedRequest:         requestLikeOnPost,
		CheckIsLikedResponse: CheckIsLikedResponse{
			Result: false,
			Error:  errors.New("something_went_wrong"),
		},
		ResponseGetList: ResponseGetList{
			Result: postResponse,
			Error:  nil,
		},
		ResponseGetActor: ResponseGetActor{
			Result: actorResponse,
			Error:  nil,
		},
		ResponseMetadata: ResponseMetadata{
			Result: metadataResponse,
			Error:  nil,
		},
		ResponseGetLastComment: ResponseGetLastComment{
			Result: commentResponse,
			Error:  nil,
		},
		ResponseGetTotalComment: ResponseGetTotalComment{
			Result: totalComment,
			Error:  nil,
		},
		ResponseUsecase: ResponseUsecase{
			Result: nil,
			Error:  errors.New("something_went_wrong"),
		},
	},
}
View Source
var LikeOrDislikePostData = []LikeOrDislikePost{
	{
		Description:             "success_like_a_post",
		UsecaseRequest:          1,
		CheckIsLikedRequest:     requestLikeOnPost,
		AddLikeOnPostRequest:    requestLikeOnPost,
		RemoveLikeOnPostRequest: requestLikeOnPost,
		MockCheckIsLiked: CheckIsLikedResponse{
			Result: false,
			Error:  nil,
		},
		MockAddLikeOnPost:    nil,
		MockRemoveLikeOnPost: nil,
		MockUsecase:          nil,
	}, {
		Description:             "success_dislike_a_post",
		UsecaseRequest:          1,
		CheckIsLikedRequest:     requestLikeOnPost,
		AddLikeOnPostRequest:    requestLikeOnPost,
		RemoveLikeOnPostRequest: requestLikeOnPost,
		MockCheckIsLiked: CheckIsLikedResponse{
			Result: true,
			Error:  nil,
		},
		MockAddLikeOnPost:    nil,
		MockRemoveLikeOnPost: nil,
		MockUsecase:          nil,
	}, {
		Description:             "failed_check_is_liked",
		UsecaseRequest:          1,
		CheckIsLikedRequest:     requestLikeOnPost,
		AddLikeOnPostRequest:    requestLikeOnPost,
		RemoveLikeOnPostRequest: requestLikeOnPost,
		MockCheckIsLiked: CheckIsLikedResponse{
			Result: false,
			Error:  errors.New("failed_check_is_liked"),
		},
		MockAddLikeOnPost:    errors.New("failed_check_is_liked"),
		MockRemoveLikeOnPost: errors.New("failed_check_is_liked"),
		MockUsecase:          errors.New("failed_check_is_liked"),
	}, {
		Description:             "failed_add_liked",
		UsecaseRequest:          1,
		CheckIsLikedRequest:     requestLikeOnPost,
		AddLikeOnPostRequest:    requestLikeOnPost,
		RemoveLikeOnPostRequest: requestLikeOnPost,
		MockCheckIsLiked: CheckIsLikedResponse{
			Result: true,
			Error:  nil,
		},
		MockAddLikeOnPost:    errors.New("failed_add_liked"),
		MockRemoveLikeOnPost: nil,
		MockUsecase:          errors.New("failed_add_liked"),
	}, {
		Description:             "failed_remove_liked",
		UsecaseRequest:          1,
		CheckIsLikedRequest:     requestLikeOnPost,
		AddLikeOnPostRequest:    requestLikeOnPost,
		RemoveLikeOnPostRequest: requestLikeOnPost,
		MockCheckIsLiked: CheckIsLikedResponse{
			Result: false,
			Error:  nil,
		},
		MockAddLikeOnPost:    nil,
		MockRemoveLikeOnPost: errors.New("failed_remove_liked"),
		MockUsecase:          errors.New("failed_remove_liked"),
	},
}
View Source
var UpdateUserPostDetailData = []UpdateUserPostDetail{
	{
		Description:         "succes_update_detail",
		UsecaseRequest:      updateUserPost,
		GetDetailParam:      1,
		UpdateUserPostParam: updateUserPost,
		ResponseGetDetailRepo: ResponseGetDetailUserPost{
			Error: nil,
		},
		ResponseUpdateUserPostRepo: nil,
		ResponseUsecase:            nil,
	}, {
		Description:         "failed_get_detail",
		UsecaseRequest:      updateUserPost,
		GetDetailParam:      1,
		UpdateUserPostParam: updateUserPost,
		ResponseGetDetailRepo: ResponseGetDetailUserPost{
			Error: errors.New("failed_get_detail"),
		},
		ResponseUpdateUserPostRepo: nil,
		ResponseUsecase:            errors.New("failed_get_detail"),
	}, {
		Description:         "failed_update_detail",
		UsecaseRequest:      updateUserPost,
		GetDetailParam:      1,
		UpdateUserPostParam: updateUserPost,
		ResponseGetDetailRepo: ResponseGetDetailUserPost{
			Error: nil,
		},
		ResponseUpdateUserPostRepo: errors.New("failed_update_detail"),
		ResponseUsecase:            errors.New("failed_update_detail"),
	},
}

Functions

func CheckReadinessDescription

func CheckReadinessDescription() []string

func CreateCommentDescription

func CreateCommentDescription() []string

func CreateNewUserPostDescription

func CreateNewUserPostDescription() []string

func LikeOrDislikePostDescription

func LikeOrDislikePostDescription() []string

func ListGetCommentsDescription

func ListGetCommentsDescription() []string

func ListUserPostByMeDescription

func ListUserPostByMeDescription() []string

func ListUserPostDescription

func ListUserPostDescription() []string

func ListUserPostDetailDescription

func ListUserPostDetailDescription() []string

func UpdateUserPostDetailDescription

func UpdateUserPostDetailDescription() []string

Types

type CheckIsLikedResponse

type CheckIsLikedResponse struct {
	Result bool
	Error  error
}

type CheckReadiness

type CheckReadiness struct {
	Description        string
	MockCheckReadiness error
	MockUsecase        error
}

type CreateCommentOnAPost

type CreateCommentOnAPost struct {
	Description       string
	UsecaseRequest    *model.CreateCommentRequest
	UpdatePostRequest *model.UpdatePostRequest
	RepositoryRequest *model.CreateCommentRequestRepository
	MockRepository    ResponseCreateComment
	MockUpdatePost    error
	MockUsecase       error
}

type CreateNewUserPost

type CreateNewUserPost struct {
	Description       string
	UsecaseRequest    *model.CreateNewPostRequest
	RepositoryRequest *model.CreateNewPostRequestRepository
	MockRepository    error
	MockUsecase       error
}

type GetComments

type GetComments struct {
	Description                      string
	UsecaseParams                    *model.GetCommentRequest
	GetCommentsByIDRequestRepository *model.GetComment
	GetActorParams                   int64
	GetTotalComment                  int64
	ResponseGetTotalComment          ResponseGetTotalComment
	ResponseGetComments              ResponseGetCommentsRepository
	ResponseUsecase                  ResponseGetCommentsUsecase
	ResponseGetActor                 ResponseGetActor
}

type GetDetailUserPost

type GetDetailUserPost struct {
	Description            string
	UsecaseParams          int64
	GetUserPostParams      int64
	GetActorParams         int64
	GetLastCommentParams   int64
	GetTotalCommentsParams int64
	IsLikedRequest         *model.AddOrRemoveLikeOnPostRequest
	CheckIsLikedResponse
	ResponseGetDetailUserPost
	ResponseGetActor
	ResponseGetLastComment
	ResponseGetTotalComment
	ResponseGetDetailUsecase
}

type GetListUserPost

type GetListUserPost struct {
	Description            string
	UsecaseParams          model.GetListRequest
	GetUserPostParams      model.UserPostRequest
	GetMetadataParams      model.UserPostRequest
	GetActorParams         int64
	GetLastCommentParams   int64
	GetTotalCommentsParams int64
	IsLikedRequest         *model.AddOrRemoveLikeOnPostRequest
	CheckIsLikedResponse
	ResponseGetList
	ResponseGetActor
	ResponseMetadata
	ResponseGetLastComment
	ResponseGetTotalComment
	ResponseUsecase
}

type GetListUserPostByMe

type GetListUserPostByMe struct {
	Description            string
	UsecaseParams          *model.GetListRequest
	GetUserPostParams      *model.UserPostByMeRequest
	GetMetadataParams      *model.UserPostByMeRequest
	GetActorParams         int64
	GetLastCommentParams   int64
	GetTotalCommentsParams int64
	IsLikedRequest         *model.AddOrRemoveLikeOnPostRequest
	CheckIsLikedResponse
	ResponseGetList
	ResponseGetActor
	ResponseMetadata
	ResponseGetLastComment
	ResponseGetTotalComment
	ResponseUsecase
}

type LikeOrDislikePost

type LikeOrDislikePost struct {
	Description             string
	UsecaseRequest          int64
	CheckIsLikedRequest     *model.AddOrRemoveLikeOnPostRequest
	AddLikeOnPostRequest    *model.AddOrRemoveLikeOnPostRequest
	RemoveLikeOnPostRequest *model.AddOrRemoveLikeOnPostRequest
	MockCheckIsLiked        CheckIsLikedResponse
	MockAddLikeOnPost       error
	MockRemoveLikeOnPost    error
	MockUsecase             error
}

type ResponseCreateComment

type ResponseCreateComment struct {
	ID    int64
	Error error
}

type ResponseGetActor

type ResponseGetActor struct {
	Result *model.UserResponse
	Error  error
}

type ResponseGetCommentsRepository

type ResponseGetCommentsRepository struct {
	Result []*model.CommentResponse
	Error  error
}

type ResponseGetCommentsUsecase

type ResponseGetCommentsUsecase struct {
	Result *model.CommentWithMetadata
	Error  error
}

type ResponseGetDetailUsecase

type ResponseGetDetailUsecase struct {
	Result *model.UserPostResponse
	Error  error
}

type ResponseGetDetailUserPost

type ResponseGetDetailUserPost struct {
	Result *model.PostResponse
	Error  error
}

type ResponseGetLastComment

type ResponseGetLastComment struct {
	Result *model.CommentResponse
	Error  error
}

type ResponseGetList

type ResponseGetList struct {
	Result []*model.PostResponse
	Error  error
}

type ResponseGetTotalComment

type ResponseGetTotalComment struct {
	Result *int64
	Error  error
}

type ResponseMetadata

type ResponseMetadata struct {
	Result *int64
	Error  error
}

type ResponseUsecase

type ResponseUsecase struct {
	Result *model.UserPostWithMetadata
	Error  error
}

type UpdateUserPostDetail

type UpdateUserPostDetail struct {
	Description                string
	UsecaseRequest             *model.UpdatePostRequest
	GetDetailParam             int64
	UpdateUserPostParam        *model.UpdatePostRequest
	ResponseGetDetailRepo      ResponseGetDetailUserPost
	ResponseUpdateUserPostRepo error
	ResponseUsecase            error
}

type UsecaseResponse

type UsecaseResponse struct {
	Result *model.UserPostWithMetadata
	Error  error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL