test(drive): drop redundant CONFIG_DIR isolation in inspect Execute tests#1121
Conversation
…ests
The six TestDriveInspectExecute_* tests set
t.Setenv("LARKSUITE_CLI_CONFIG_DIR", t.TempDir()) but build the CLI via
cmdutil.TestFactory(t, cfg), which provides an in-memory config closure
(func() (*core.CliConfig, error) { return config, nil }) and never reads the
filesystem. Per the repo learning from PR larksuite#343, this env var should only be
set for tests exercising the real NewDefault() factory path. None of these
tests use NewDefault(), so the calls are dead and removed.
No behavior change; all TestDriveInspect* tests still pass.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughSix test functions in ChangesTest Environment Setup Cleanup
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@e755e20bdbaa2882bee32396afda0a7a7bfc414e🧩 Skill updatenpx skills add kyalpha313/lark-cli#chore/drop-redundant-config-dir-inspect-test -y -g |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1121 +/- ##
=======================================
Coverage 68.10% 68.10%
=======================================
Files 613 613
Lines 56396 56396
=======================================
Hits 38409 38409
Misses 14809 14809
Partials 3178 3178 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
drive_inspect_test.go的六个TestDriveInspectExecute_*测试都调用了t.Setenv("LARKSUITE_CLI_CONFIG_DIR", t.TempDir()),但它们通过cmdutil.TestFactory(t, cfg)构建 CLI。TestFactory提供的是内存 config 闭包(Config: func() (*core.CliConfig, error) { return config, nil }),不读文件系统,所以这个环境变量对这些测试毫无作用。Changes
drive_inspect_test.go中 6 处冗余的t.Setenv("LARKSUITE_CLI_CONFIG_DIR", t.TempDir())依据
仓库已有 learning(来自 #343):
已确认这 6 个测试全部使用
cmdutil.TestFactory、grep -c NewDefault为 0,因此这些调用是 dead code。(这是在 #1114 的 review 讨论中发现的既有不一致,单独拆成一个 PR。)
Test Plan
go test -race -count=1 ./shortcuts/drive/ -run TestDriveInspect通过gofmt -l无输出go vet ./shortcuts/drive/通过🤖 Generated with Claude Code
Summary by CodeRabbit
Note: This release contains internal testing optimizations with no user-visible changes or new functionality.