mirror of
https://github.com/anyproto/anytype-heart.git
synced 2025-06-11 18:20:33 +09:00
GO-4969: Mock ExportMarkdown in tests for GetObject, CreateObject, and GetTemplate
This commit is contained in:
parent
9ae5cc1243
commit
62cd6b7eda
3 changed files with 19 additions and 3 deletions
|
@ -500,6 +500,11 @@ func TestObjectService_GetObject(t *testing.T) {
|
|||
Records: []*types.Struct{},
|
||||
}, nil).Once()
|
||||
|
||||
// Mock ExportMarkdown
|
||||
fx.exportService.
|
||||
On("ExportSingleInMemory", mock.Anything, mockedSpaceId, mockedObjectId, model.Export_Markdown).
|
||||
Return("dummy markdown", nil).Once()
|
||||
|
||||
// when
|
||||
object, err := fx.service.GetObject(ctx, mockedSpaceId, mockedObjectId)
|
||||
|
||||
|
@ -645,6 +650,11 @@ func TestObjectService_CreateObject(t *testing.T) {
|
|||
Error: &pb.RpcObjectSearchResponseError{Code: pb.RpcObjectSearchResponseError_NULL},
|
||||
}).Times(3)
|
||||
|
||||
// Mock ExportMarkdown
|
||||
fx.exportService.
|
||||
On("ExportSingleInMemory", mock.Anything, mockedSpaceId, mockedNewObjectId, model.Export_Markdown).
|
||||
Return("dummy markdown", nil).Once()
|
||||
|
||||
// when
|
||||
object, err := fx.service.CreateObject(ctx, mockedSpaceId, apimodel.CreateObjectRequest{
|
||||
Name: mockedObjectName,
|
||||
|
|
|
@ -36,10 +36,11 @@ type fixture struct {
|
|||
func newFixture(t *testing.T) *fixture {
|
||||
mwMock := mock_apicore.NewMockClientCommands(t)
|
||||
exportMock := mock_apicore.NewMockExportService(t)
|
||||
objectService := NewService(mwMock, exportMock, gatewayUrl, techSpaceId)
|
||||
service := NewService(mwMock, exportMock, gatewayUrl, techSpaceId)
|
||||
|
||||
return &fixture{
|
||||
service: objectService,
|
||||
mwMock: mwMock,
|
||||
service: service,
|
||||
mwMock: mwMock,
|
||||
exportService: exportMock,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,6 +127,11 @@ func TestObjectService_GetTemplate(t *testing.T) {
|
|||
Error: &pb.RpcObjectSearchResponseError{Code: pb.RpcObjectSearchResponseError_NULL},
|
||||
}).Times(3)
|
||||
|
||||
// Mock ExportMarkdown
|
||||
fx.exportService.
|
||||
On("ExportSingleInMemory", mock.Anything, mockedSpaceId, mockedTemplateId, model.Export_Markdown).
|
||||
Return("dummy markdown", nil).Once()
|
||||
|
||||
// when
|
||||
template, err := fx.service.GetTemplate(ctx, mockedSpaceId, mockedTypeId, mockedTemplateId)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue