(t *testing.T)
| 141 | } |
| 142 | |
| 143 | func 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 | |
| 163 | func TestForSubscribe_SanitizesAppID(t *testing.T) { |
| 164 | dir := t.TempDir() |
nothing calls this directly
no test coverage detected