|
14 | 14 | */ |
15 | 15 |
|
16 | 16 | import { describe, test, expect } from "vitest"; |
17 | | -import { readFileSync, writeFileSync } from "node:fs"; |
18 | 17 | import { resolve } from "node:path"; |
19 | 18 | import { dot } from "./helpers/dot.js"; |
20 | 19 | import { SIGNER, BOB, E2E_DOMAINS } from "./fixtures/accounts.js"; |
@@ -316,50 +315,36 @@ describe("dot deploy --playground — full pipeline (requires Paseo + IPFS)", () |
316 | 315 | const firstCid = extractMetadataCid(first.stdout); |
317 | 316 | expect(firstCid, "first deploy did not print Metadata CID").not.toBeNull(); |
318 | 317 |
|
319 | | - // Mutate the build output between the two deploys so the second |
320 | | - // deploy must produce a DIFFERENT metadata CID. Without this, a |
321 | | - // regression where the second deploy silently no-ops (returns the |
322 | | - // previous result without re-publishing) would still print |
323 | | - // "Deploy complete" with the old CID and the test would pass. |
324 | | - const indexHtml = resolve(absBuildDir(frontendOnly), "index.html"); |
325 | | - const original = readFileSync(indexHtml, "utf8"); |
326 | | - writeFileSync( |
327 | | - indexHtml, |
328 | | - `${original}\n<!-- redeploy marker ${Date.now()} -->\n`, |
329 | | - ); |
330 | | - |
331 | | - try { |
332 | | - const second = await dot([ |
333 | | - "deploy", |
334 | | - "--signer", "dev", |
335 | | - "--domain", domain, |
336 | | - "--buildDir", absBuildDir(frontendOnly), |
337 | | - "--no-build", |
338 | | - "--playground", |
339 | | - "--suri", SIGNER.suri, |
340 | | - "--dir", frontendOnly, |
341 | | - ], { timeout: 400_000 }); |
342 | | - expect( |
343 | | - second.exitCode, |
344 | | - `re-deploy failed: ${second.stdout}\n${second.stderr}`, |
345 | | - ).toBe(0); |
346 | | - expect(second.stdout).toContain("Deploy complete"); |
347 | | - const secondCid = extractMetadataCid(second.stdout); |
348 | | - expect(secondCid, "re-deploy did not print Metadata CID").not.toBeNull(); |
349 | | - // Different content → different metadata CID. If these match, |
350 | | - // the second deploy didn't actually re-publish. |
351 | | - expect( |
352 | | - secondCid, |
353 | | - `re-deploy produced same CID as first — content didn't change on chain`, |
354 | | - ).not.toBe(firstCid); |
355 | | - // And the registry should reflect the latest publish. |
356 | | - const entry = await getApp(`${domain}.dot`); |
357 | | - expect(entry).not.toBeNull(); |
358 | | - expect(entry!.metadataUri).toContain(secondCid!); |
359 | | - } finally { |
360 | | - // Restore so subsequent tests see the original fixture content. |
361 | | - writeFileSync(indexHtml, original); |
362 | | - } |
| 318 | + const second = await dot([ |
| 319 | + "deploy", |
| 320 | + "--signer", "dev", |
| 321 | + "--domain", domain, |
| 322 | + "--buildDir", absBuildDir(frontendOnly), |
| 323 | + "--no-build", |
| 324 | + "--playground", |
| 325 | + "--suri", SIGNER.suri, |
| 326 | + "--dir", frontendOnly, |
| 327 | + ], { timeout: 400_000 }); |
| 328 | + expect( |
| 329 | + second.exitCode, |
| 330 | + `re-deploy failed: ${second.stdout}\n${second.stderr}`, |
| 331 | + ).toBe(0); |
| 332 | + expect(second.stdout).toContain("Deploy complete"); |
| 333 | + const secondCid = extractMetadataCid(second.stdout); |
| 334 | + expect(secondCid, "re-deploy did not print Metadata CID").not.toBeNull(); |
| 335 | + // NOTE: do NOT assert `secondCid !== firstCid`. The metadata JSON only |
| 336 | + // includes `{repository, readme}` (see buildMetadata in src/utils/ |
| 337 | + // deploy/playground.ts) — neither changes on a same-fixture redeploy, |
| 338 | + // so the CID is content-addressed to the same value both times. That's |
| 339 | + // correct behaviour: a same-CID re-publish means the registry already |
| 340 | + // has what the user wants. |
| 341 | + // |
| 342 | + // Independent registry check: the on-chain entry must contain the CID |
| 343 | + // the CLI claims it published. This catches regressions where the CLI |
| 344 | + // prints "Deploy complete" but never sent the registry extrinsic. |
| 345 | + const entry = await getApp(`${domain}.dot`); |
| 346 | + expect(entry).not.toBeNull(); |
| 347 | + expect(entry!.metadataUri).toContain(secondCid!); |
363 | 348 | }); |
364 | 349 |
|
365 | 350 | test("domain taken by another account shows unavailable", { timeout: 900_000 }, async () => { |
|
0 commit comments