withTestConfig injects a hermetic env provider and an in-memory models.dev store into the models command. It keeps listing side-effect-free: without it the real env provider chain shells out to the OS keychain / pass / 1Password for every missing API key and the store fetches https://models.dev, mak
(env map[string]string)
| 56 | // for every missing API key and the store fetches https://models.dev, making |
| 57 | // the tests slow and non-parallelizable. |
| 58 | func withTestConfig(env map[string]string) modelsCmdOption { |
| 59 | return func(rc *config.RuntimeConfig) { |
| 60 | rc.EnvProviderForTests = environment.NewMapEnvProvider(env) |
| 61 | rc.ModelsDevStoreOverride = modelsdev.NewDatabaseStore(testCatalog()) |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | func TestModelsListCommand_DefaultOutput(t *testing.T) { |
| 66 | t.Parallel() |
no test coverage detected