oficina / mapa Public

Clone
git clone https://amadan.net/oficina/mapa

Plain git — no account needed to clone.

Download

Download this file

1package main
2
3// The columns and icons spec's mutations for the importer's looks
4// (§6.1, §6.4, §9): an emoji icon written unchecked, an external cover
5// fetched without asking the pin, a look left out of "unchanged", the
6// styled revision skipped, an icon's two limits, and a fix-up dropping
7// the look it did not prepare.
8
9const (
10 importLooksGo = "internal/mapa/import_looks.go"
11 importWriteGo = "internal/mapa/import_write.go"
12 importStoreGo = "internal/mapa/import_store.go"
13)
14
15var importLookMutations = []mutation{
16 {gate: "I20", test: "TestI20IconsAreImported", pkg: inside,
17 name: "an emoji icon written without the list's check",
18 edits: []edit{{file: importLooksGo,
19 from: "\t\tmade, err := EmojiIcon(icon.Emoji)",
20 to: "\t\tmade, err := &Icon{Emoji: icon.Emoji}, error(nil)"}}},
21 {gate: "I21", test: "TestI21CoversAreImportedFromThePinOnly", pkg: inside,
22 name: "an external cover fetched without asking the pin",
23 edits: []edit{{file: importLooksGo,
24 from: "(cover.Type == notion.FileExternal && " +
25 "job.files.Gallery(cover.URL))",
26 to: "cover.Type == notion.FileExternal"}}},
27 {gate: "I24", test: "TestI24ALookChangedInNotionIsStyled", pkg: inside,
28 name: "unchanged decided without the look",
29 edits: []edit{{file: importWriteGo,
30 from: "\t\tentry.current.Body == cleanBody(body) &&\n" +
31 "\t\tsameLook(entry.current, entry.lookRecord()) {",
32 to: "\t\tentry.current.Body == cleanBody(body) {"}}},
33 {gate: "I24", test: "TestI24RenamedStyledEditedInOrder", pkg: inside,
34 name: "ImportUpdate writes no styled revision",
35 edits: []edit{{file: importStoreGo,
36 from: "\t\tif err := tx.importStyle(&page, &record, actor, " +
37 "write); err != nil {",
38 to: "\t\tif err := error(nil); err != nil {"}}},
39 {gate: "I20", test: "TestI20IconsAreImported", pkg: inside,
40 name: "an icon over 512 pixels a side kept",
41 edits: []edit{{file: importLooksGo,
42 from: "if pseudo == iconPlace && added.Side() > MaxIconSide {",
43 to: "if pseudo == iconPlace && added.Side() > 1<<20 {"}}},
44 {gate: "I20", test: "TestI20IconsAreImported", pkg: inside,
45 name: "an icon fetched with the 10 MB cap",
46 edits: []edit{{file: importLooksGo,
47 from: "\t\treturn page.Icon.URL, MaxIconBytes",
48 to: "\t\treturn page.Icon.URL, imageCap"}}},
49 {gate: "I24", test: "TestI24AFixUpAfterAResumeKeepsTheIcon", pkg: inside,
50 name: "a fix-up with no prepared look writes none",
51 edits: []edit{{file: importWriteGo,
52 from: "\t\treturn Record{Icon: entry.current.Icon, " +
53 "Banner: entry.current.Banner}",
54 to: "\t\treturn Record{}"}}},
55}
56