-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9ea92f4
commit bf70092
Showing
5 changed files
with
102 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package service_test | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/IceWhaleTech/CasaOS-MessageBus/repository" | ||
"github.com/IceWhaleTech/CasaOS-MessageBus/service" | ||
"github.com/IceWhaleTech/CasaOS-MessageBus/utils" | ||
"gotest.tools/assert" | ||
) | ||
|
||
func TestInsertAndGetCardList(t *testing.T) { | ||
repository, err := repository.NewDatabaseRepositoryInMemory() | ||
assert.NilError(t, err) | ||
defer repository.Close() | ||
|
||
yskService := service.NewYSKService(&repository) | ||
|
||
cardList, err := yskService.YskCardList(context.Background()) | ||
assert.NilError(t, err) | ||
assert.Equal(t, len(cardList), 0) | ||
|
||
err = yskService.UpsertYSKCard(context.Background(), utils.ApplicationInstallProgress) | ||
assert.NilError(t, err) | ||
|
||
err = yskService.UpsertYSKCard(context.Background(), utils.DiskInsertNotice) | ||
assert.NilError(t, err) | ||
|
||
cardList, err = yskService.YskCardList(context.Background()) | ||
assert.NilError(t, err) | ||
assert.Equal(t, len(cardList), 2) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package utils | ||
|
||
import ( | ||
"github.com/IceWhaleTech/CasaOS-MessageBus/codegen" | ||
) | ||
|
||
var ( | ||
ApplicationInstallProgress = codegen.YSKCard{ | ||
Id: "task:application:install", | ||
CardType: codegen.YSKCardCardTypeTask, | ||
RenderType: codegen.YSKCardRenderTypeTask, | ||
Content: codegen.YSKCardContent{ | ||
TitleIcon: "jellyfin logo", | ||
TitleText: "APP Installing", | ||
BodyProgress: &codegen.YSKCardProgress{}, | ||
BodyIconWithText: nil, | ||
BodyList: nil, | ||
FooterActions: nil, | ||
}, | ||
} | ||
|
||
DiskInsertNotice = codegen.YSKCard{ | ||
Id: "long-notice:disk:insert", | ||
CardType: codegen.YSKCardCardTypeLongNotice, | ||
RenderType: codegen.YSKCardRenderTypeListNotice, | ||
Content: codegen.YSKCardContent{ | ||
TitleIcon: "ZimaOS-Logo", | ||
TitleText: "创建数据工作站", | ||
BodyProgress: nil, | ||
BodyIconWithText: &codegen.YSKCardIconWithText{ | ||
Icon: "disk", | ||
Description: "通过添加硬盘驱动器或固态硬盘来增强你的个人主机,并建立自己的个人数据中心。", | ||
}, | ||
BodyList: nil, | ||
FooterActions: &[]codegen.YSKCardFooterAction{ | ||
{ | ||
Side: "Right", | ||
Style: "primary", | ||
Text: "创建数据工作站", | ||
MessageBus: codegen.YSKCardMessageBusAction{ | ||
Key: "open:disk:insert", | ||
Payload: "{'type':'disk'}", | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
) |