Skip to content

Commit

Permalink
fix ut
Browse files Browse the repository at this point in the history
  • Loading branch information
ganisback committed Dec 6, 2024
1 parent 164fe00 commit f20705a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
14 changes: 7 additions & 7 deletions common/tests/stores.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ func NewMockStores(t interface {
mock.TestingT
}) *MockStores {
return &MockStores{
User: mockdb.NewMockUserStore(t),
UserLikes: mockdb.NewMockUserLikesStore(t),
Repo: mockdb.NewMockRepoStore(t),
RepoRelation: mockdb.NewMockRepoRelationsStore(t),
Model: mockdb.NewMockModelStore(t),
SpaceResource: mockdb.NewMockSpaceResourceStore(t),
//Tag: mockdb.NewMockTagStore(t),
User: mockdb.NewMockUserStore(t),
UserLikes: mockdb.NewMockUserLikesStore(t),
Repo: mockdb.NewMockRepoStore(t),
RepoRelation: mockdb.NewMockRepoRelationsStore(t),
Model: mockdb.NewMockModelStore(t),
SpaceResource: mockdb.NewMockSpaceResourceStore(t),
Tag: mockdb.NewMockTagStore(t),
Dataset: mockdb.NewMockDatasetStore(t),
PromptConversation: mockdb.NewMockPromptConversationStore(t),
PromptPrefix: mockdb.NewMockPromptPrefixStore(t),
Expand Down
17 changes: 7 additions & 10 deletions component/model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -572,25 +572,22 @@ func TestModelComponent_SetRuntimeFrameworkModes(t *testing.T) {
mc := initializeTestModelComponent(ctx, t)

mc.mocks.stores.RuntimeFrameworkMock().EXPECT().FindByID(ctx, int64(1)).Return(
&database.RuntimeFramework{}, nil,
&database.RuntimeFramework{
ID: 1,
}, nil,
)
mc.mocks.stores.ModelMock().EXPECT().ListByPath(ctx, []string{"a", "b"}).Return(
[]database.Model{
{RepositoryID: 1, Repository: &database.Repository{ID: 1, Path: "m1/foo"}},
{RepositoryID: 2, Repository: &database.Repository{ID: 2, Path: "m2/foo"}},
}, nil,
)
rftags := []*database.Tag{{Name: "t1"}, {Name: "t2"}}
// mc.mocks.stores.TagMock().EXPECT().GetTagsByScopeAndCategories(
// ctx, database.TagScope("model"), []string{"runtime_framework", "resource"},
// ).Return(rftags, nil)

mc.mocks.stores.TagMock().EXPECT().GetTagsByScopeAndCategories(
ctx, database.TagScope("model"), []string{"runtime_framework", "resource"},
).Return(rftags, nil)
mc.mocks.stores.RepoRuntimeFrameworkMock().EXPECT().GetByIDsAndType(
ctx, int64(1), int64(1), 1,
).Return([]database.RepositoriesRuntimeFramework{}, nil)
mc.mocks.stores.RepoRuntimeFrameworkMock().EXPECT().GetByIDsAndType(
ctx, int64(1), int64(2), 1,
).Return([]database.RepositoriesRuntimeFramework{{}}, nil)
).Return(nil, nil)

mc.mocks.stores.RepoRuntimeFrameworkMock().EXPECT().Add(ctx, int64(1), int64(1), 1).Return(nil)
mc.mocks.components.runtimeArchitecture.EXPECT().AddRuntimeFrameworkTag(
Expand Down

0 comments on commit f20705a

Please sign in to comment.