MCPcopy
hub / github.com/larksuite/cli / TestForSubscribe

Function TestForSubscribe

internal/lockfile/lockfile_test.go:143–161  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

141}
142
143func TestForSubscribe(t *testing.T) {
144 dir := t.TempDir()
145 t.Setenv("LARKSUITE_CLI_CONFIG_DIR", dir)
146
147 l, err := ForSubscribe("cli_test123")
148 if err != nil {
149 t.Fatalf("ForSubscribe failed: %v", err)
150 }
151
152 expected := filepath.Join(dir, "locks", "subscribe_cli_test123.lock")
153 if l.Path() != expected {
154 t.Errorf("Path() = %q, want %q", l.Path(), expected)
155 }
156
157 lockDir := filepath.Join(dir, "locks")
158 if _, err := os.Stat(lockDir); os.IsNotExist(err) {
159 t.Error("locks directory should be created by ForSubscribe")
160 }
161}
162
163func TestForSubscribe_SanitizesAppID(t *testing.T) {
164 dir := t.TempDir()

Callers

nothing calls this directly

Calls 4

ForSubscribeFunction · 0.85
PathMethod · 0.65
StatMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected