mirror of
https://github.com/larksuite/cli.git
synced 2026-07-03 14:02:43 +08:00
style: gofmt plugin files
This commit is contained in:
@@ -239,7 +239,6 @@ func TestPluginListCapabilities_SkipsMalformed(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// --- helpers ---
|
||||
|
||||
func writeTestCapJSON(t *testing.T, dir, filename string, data map[string]interface{}) {
|
||||
|
||||
@@ -26,10 +26,10 @@ import (
|
||||
// Without --name it batch-installs all plugins declared in actionPlugins that
|
||||
// are not yet present in node_modules.
|
||||
var AppsPluginInstall = common.Shortcut{
|
||||
Service: appsService,
|
||||
Command: "+plugin-install",
|
||||
Description: "Install a plugin package (download, extract, update package.json)",
|
||||
Risk: "write",
|
||||
Service: appsService,
|
||||
Command: "+plugin-install",
|
||||
Description: "Install a plugin package (download, extract, update package.json)",
|
||||
Risk: "write",
|
||||
ConditionalScopes: []string{"spark:app:read"},
|
||||
AuthTypes: []string{"user"},
|
||||
Tips: []string{
|
||||
|
||||
@@ -31,10 +31,10 @@ func TestPluginInstall_SinglePlugin(t *testing.T) {
|
||||
"data": map[string]interface{}{
|
||||
"items": []interface{}{
|
||||
map[string]interface{}{
|
||||
"key": "@test/my-plugin",
|
||||
"version": "1.0.0",
|
||||
"download_approach": "inner",
|
||||
"status": "active",
|
||||
"key": "@test/my-plugin",
|
||||
"version": "1.0.0",
|
||||
"download_approach": "inner",
|
||||
"status": "active",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -92,7 +92,7 @@ func TestPluginInstall_AlreadyInstalled(t *testing.T) {
|
||||
})
|
||||
// Create an existing installed plugin with package.json containing version
|
||||
pkgDir := filepath.Join(dir, "node_modules", "@test/my-plugin")
|
||||
os.MkdirAll(pkgDir, 0o755) //nolint:forbidigo
|
||||
os.MkdirAll(pkgDir, 0o755) //nolint:forbidigo
|
||||
os.WriteFile(filepath.Join(pkgDir, "package.json"), []byte(`{"version":"1.0.0"}`), 0o644) //nolint:forbidigo
|
||||
chdirTest(t, dir)
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ var AppsPluginList = common.Shortcut{
|
||||
Service: appsService,
|
||||
Command: "+plugin-list",
|
||||
Description: "List declared plugin packages and their installation status",
|
||||
Risk: "read",
|
||||
Risk: "read",
|
||||
Tips: []string{
|
||||
"Example: lark-cli apps +plugin-list",
|
||||
"Example: lark-cli apps +plugin-list --format pretty",
|
||||
|
||||
@@ -40,7 +40,7 @@ func TestPluginList_Installed(t *testing.T) {
|
||||
},
|
||||
})
|
||||
manifestDir := filepath.Join(dir, "node_modules", "@test/my-plugin")
|
||||
os.MkdirAll(manifestDir, 0o755) //nolint:forbidigo
|
||||
os.MkdirAll(manifestDir, 0o755) //nolint:forbidigo
|
||||
os.WriteFile(filepath.Join(manifestDir, "package.json"), []byte(`{"version":"1.0.0"}`), 0o644) //nolint:forbidigo
|
||||
chdirTest(t, dir)
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ var AppsPluginUninstall = common.Shortcut{
|
||||
Service: appsService,
|
||||
Command: "+plugin-uninstall",
|
||||
Description: "Uninstall a plugin package (remove from node_modules and package.json)",
|
||||
Risk: "write",
|
||||
Risk: "write",
|
||||
Tips: []string{
|
||||
"Example: lark-cli apps +plugin-uninstall --name @official-plugins/ai-text-generate",
|
||||
},
|
||||
|
||||
@@ -20,7 +20,7 @@ func TestPluginUninstall_Basic(t *testing.T) {
|
||||
},
|
||||
})
|
||||
pluginDir := filepath.Join(dir, "node_modules", "@test/my-plugin")
|
||||
os.MkdirAll(pluginDir, 0o755) //nolint:forbidigo
|
||||
os.MkdirAll(pluginDir, 0o755) //nolint:forbidigo
|
||||
os.WriteFile(filepath.Join(pluginDir, "manifest.json"), []byte("{}"), 0o644) //nolint:forbidigo
|
||||
chdirTest(t, dir)
|
||||
|
||||
@@ -77,7 +77,7 @@ func TestPluginUninstall_BlockedByDependentInstance(t *testing.T) {
|
||||
})
|
||||
// Install plugin
|
||||
pluginDir := filepath.Join(dir, "node_modules", "@test/my-plugin")
|
||||
os.MkdirAll(pluginDir, 0o755) //nolint:forbidigo
|
||||
os.MkdirAll(pluginDir, 0o755) //nolint:forbidigo
|
||||
os.WriteFile(filepath.Join(pluginDir, "manifest.json"), []byte("{}"), 0o644) //nolint:forbidigo
|
||||
|
||||
// Create a capability that references this plugin
|
||||
@@ -125,7 +125,7 @@ func TestPluginUninstall_WithUnrelatedInstances(t *testing.T) {
|
||||
},
|
||||
})
|
||||
pluginDir := filepath.Join(dir, "node_modules", "@test/my-plugin")
|
||||
os.MkdirAll(pluginDir, 0o755) //nolint:forbidigo
|
||||
os.MkdirAll(pluginDir, 0o755) //nolint:forbidigo
|
||||
os.WriteFile(filepath.Join(pluginDir, "manifest.json"), []byte("{}"), 0o644) //nolint:forbidigo
|
||||
|
||||
// Create a capability that references a DIFFERENT plugin — should not block
|
||||
|
||||
Reference in New Issue
Block a user