| 375 | } |
| 376 | |
| 377 | function makeRemoteAdd(options: { existing?: string[] } = {}) { |
| 378 | const calls: RemoteCall[] = []; |
| 379 | const existing = new Set(options.existing ?? []); |
| 380 | const remoteAdd = async (opts: { name: string; url: string; force?: boolean }) => { |
| 381 | const force = opts.force === true; |
| 382 | calls.push({ name: opts.name, url: opts.url, force }); |
| 383 | if (existing.has(opts.name) && !force) { |
| 384 | return { ok: false, exists: true, message: `remote ${opts.name} already exists` }; |
| 385 | } |
| 386 | existing.add(opts.name); |
| 387 | return { ok: true }; |
| 388 | }; |
| 389 | return { remoteAdd, calls }; |
| 390 | } |
| 391 | |
| 392 | it("creates the repo, mints a token, and registers a credentialed remote", async () => { |
| 393 | const { remoteAdd, calls } = makeRemoteAdd(); |