Skip to content

Commit bd007f1

Browse files
committed
Make the article slug run-unique so test:types can run twice
The article is the only type with a name, so its slug is derived from that name and is constant. store-file-system's createFile() returns without writing when the path already exists, while Indiekit still answers 202 with a Location, so a second run published nothing and aborted on the store guard with a misleading 'that is not the Indiekit this repo configures'. CI never saw it because CI always clones into an empty store. Also say that npm run build must be re-run after publishing; it is one-shot and nothing watches, so a fresh post 404s until it is.
1 parent 21c068b commit bd007f1

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ into `PASSWORD_SECRET`, and restart. Then in a second terminal:
1919
npm run build && npm run serve # your site on :8080
2020
```
2121

22-
Publish a post in Indiekit and open the URL it gives you.
22+
Publish a post in Indiekit, then **re-run `npm run build`** and open the URL it gave you.
23+
Nothing watches for you: `npm run build` is one-shot, so a freshly published post 404s
24+
until you rebuild.
2325

2426
When you deploy, set `INDIEKIT_URL` to where Indiekit actually runs before building. The
2527
`authorization_endpoint`, `token_endpoint` and `micropub` `<link rel>` tags are built from

test/all-types.mjs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ const token = jwt.sign({ me: SITE, scope: "create media" }, SECRET, {
2323

2424
const LIKED = "https://example.com/y";
2525

26+
// Every other type below gets a run-unique slug for free: with no `name`,
27+
// @indiekit/endpoint-micropub slugs from the publish timestamp. The article
28+
// has a `name`, so it slugs from that instead — a constant name means a
29+
// constant path, and store-file-system's createFile() silently no-ops when
30+
// the path already exists (no write, no error, still a 202 + Location). That
31+
// makes a second run against a non-empty store publish nothing and abort on
32+
// the store guard. Keep the name run-unique.
33+
const RUN_ID = Date.now();
34+
2635
// Upload a 1×1 GIF FIRST, so the photo post can reference an image that really
2736
// exists on this site. Testing a photo post against an off-site URL proves only
2837
// that a string was copied into an attribute — it never exercises the flow a
@@ -56,7 +65,7 @@ const PHOTO_PATH = new URL(PHOTO, SITE).pathname;
5665

5766
// [type, properties, strings the page must contain, strings it must not]
5867
const TYPES = [
59-
["article", { name: "An Article", content: "MARKER_article" }, ["MARKER_article"]],
68+
["article", { name: `An Article ${RUN_ID}`, content: "MARKER_article" }, ["MARKER_article"]],
6069
["note", { content: "MARKER_note" }, ["MARKER_note"]],
6170
["bookmark", { "bookmark-of": "https://example.com/x", content: "MARKER_bookmark" }, ["MARKER_bookmark"]],
6271
["like", { "like-of": LIKED }, [LIKED]],

0 commit comments

Comments
 (0)