diff --git a/git-config/main.test.ts b/git-config/main.test.ts index a5284b3..1241956 100644 --- a/git-config/main.test.ts +++ b/git-config/main.test.ts @@ -44,4 +44,26 @@ describe("git-config", async () => { { type: "coder_env", name: "git_commmiter_name" }, ]); }); + + it("can run apply allow_email_change enabled", async () => { + const state = await runTerraformApply( + import.meta.dir, + { + agent_id: "foo", + allow_username_change: "false", + allow_email_change: "false", + }, + { CODER_WORKSPACE_OWNER_EMAIL: "foo@emai.com" }, + ); + + const resources = state.resources; + expect(resources).toHaveLength(5); + expect(resources).toMatchObject([ + { type: "coder_workspace", name: "me" }, + { type: "coder_env", name: "git_author_email" }, + { type: "coder_env", name: "git_author_name" }, + { type: "coder_env", name: "git_commmiter_email" }, + { type: "coder_env", name: "git_commmiter_name" }, + ]); + }); }); diff --git a/test.ts b/test.ts index 37e0805..97416cf 100644 --- a/test.ts +++ b/test.ts @@ -171,9 +171,9 @@ export const testRequiredVariables = ( export const runTerraformApply = async ( dir: string, vars: Record, + env: Record = {}, ): Promise => { const stateFile = `${dir}/${crypto.randomUUID()}.tfstate`; - const env = {}; Object.keys(vars).forEach((key) => (env[`TF_VAR_${key}`] = vars[key])); const proc = spawn( [