GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — t3code/scripts/apply-web-brand-assets.test.ts at main · AndryHTC/t3code

Expand file tree

/

apply-web-brand-assets.test.ts

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
65 lines (57 loc) · 2.22 KB
/

apply-web-brand-assets.test.ts

Copy path

File metadata and controls

65 lines (57 loc) · 2.22 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import * as NodeServices from "@effect/platform-node/NodeServices";
import { assert, it } from "@effect/vitest";
import * as Effect from "effect/Effect";
import * as FileSystem from "effect/FileSystem";
import * as Path from "effect/Path";
import { applyWebBrandAssets } from "./apply-web-brand-assets.ts";
const WEB_ICON_FILENAMES = [
"apple-touch-icon.png",
"favicon-16x16.png",
"favicon-32x32.png",
"favicon.ico",
"icon-192x192.png",
"icon-512x512.png",
];
it.layer(NodeServices.layer)("apply-web-brand-assets", (it) => {
it.effect("copies the icons into an absolute target directory as given", () =>
Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem;
const targetDirectory = yield* fs.makeTempDirectoryScoped({
prefix: "apply-web-brand-assets-",
});
yield* applyWebBrandAssets("production", targetDirectory);
assert.deepStrictEqual(
(yield* fs.readDirectory(targetDirectory)).toSorted(),
WEB_ICON_FILENAMES,
);
}),
);
it.effect("resolves an empty target directory to the repo root", () =>
Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
const repoRoot = yield* path.fromFileUrl(new URL("..", import.meta.url));
const destinations = WEB_ICON_FILENAMES.map((filename) => path.join(repoRoot, filename));
// readDirectory does not follow symlinks, so a dangling link counts as an existing entry.
// Names are lowercased so a case-insensitive filesystem cannot hide a differently cased file.
const existingEntries = new Set(
(yield* fs.readDirectory(repoRoot)).map((entry) => entry.toLowerCase()),
);
for (const destination of destinations) {
assert.isFalse(
existingEntries.has(path.basename(destination)),
`${destination} already exists`,
);
}
yield* Effect.addFinalizer(() =>
Effect.forEach(destinations, (destination) => fs.remove(destination, { force: true })).pipe(
Effect.orDie,
),
);
yield* applyWebBrandAssets("production", "");
for (const destination of destinations) {
assert.isTrue(yield* fs.exists(destination));
}
}),
);
});
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.