()
| 761 | |
| 762 | describe("provisioning sessions", () => { |
| 763 | function mockTokenCommands() { |
| 764 | execFileAsyncSpy?.mockImplementation((file: string, args: string[]) => { |
| 765 | if ( |
| 766 | file === "coder" && |
| 767 | args[0] === "tokens" && |
| 768 | args[1] === "create" && |
| 769 | args[2] === "--lifetime" && |
| 770 | args[3] === "5m" && |
| 771 | args[4] === "--name" |
| 772 | ) { |
| 773 | return createMockExecResult(Promise.resolve({ stdout: "token-123", stderr: "" })); |
| 774 | } |
| 775 | if (file === "coder" && args[0] === "tokens" && args[1] === "delete") { |
| 776 | return createMockExecResult(Promise.resolve({ stdout: "", stderr: "" })); |
| 777 | } |
| 778 | return createMockExecResult( |
| 779 | Promise.reject(new Error(`Unexpected command: ${file} ${args.join(" ")}`)) |
| 780 | ); |
| 781 | }); |
| 782 | } |
| 783 | |
| 784 | it("reuses provisioning sessions for the same workspace", async () => { |
| 785 | mockTokenCommands(); |
no test coverage detected