mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-12-02 17:13:33 +01:00
Review threads: one container in the code column with comments divided by rules; replies keep the first comment's indent (no nested cards). The Conversation tab uses the same thread. A fully redacted author renders as its slot alone, centred with the avatar and date. Slots outside rendered Markdown use the explorer's .redact-slot at the running-text alignment (.04em). PR and gist tabs drop the 2px transparent border so the shared #949 line spans the label and count and sits on the bar's rule. Gists: each file renders with the explorer's viewers (Markdown, code, notebook, CSV/TSV table, image, SVG, PDF, video, audio, binary and too-large states), with a Preview/Source toggle where they differ and Raw, copy and download. Binary gist files are now stored as base64 and passed through unchanged; images follow the "Display images" option. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
41 lines
1.8 KiB
JavaScript
41 lines
1.8 KiB
JavaScript
const { expect } = require("chai");
|
|
require("ts-node/register/transpile-only");
|
|
const { default: Gist } = require("../src/core/Gist");
|
|
|
|
function makeGist(options) {
|
|
return new Gist({
|
|
gistId: "g-test",
|
|
owner: "000000000000000000000001",
|
|
source: { gistId: "abc" },
|
|
options: { terms: ["Alice"], content: true, title: true, image: true, ...options },
|
|
gist: {
|
|
description: "By Alice",
|
|
files: [
|
|
{ filename: "notes-Alice.md", content: "Written by Alice", language: "Markdown", size: 16 },
|
|
{ filename: "plot-Alice.png", content: "iVBORw0KGgoAlice==", encoding: "base64", size: 12, type: "image/png" },
|
|
{ filename: "paper.pdf", content: "JVBERi0xLjQK", encoding: "base64", size: 9, type: "application/pdf" },
|
|
{ filename: "huge.bin", content: "", encoding: "base64", size: 99999999, tooLarge: true },
|
|
],
|
|
},
|
|
});
|
|
}
|
|
|
|
describe("Gist.content() binary files", function () {
|
|
it("anonymizes text files and names, and passes binary bytes through unchanged", function () {
|
|
const [md, png, pdf, huge] = makeGist().content().files;
|
|
expect(md).to.include({ filename: "notes-XXXX-1.md", content: "Written by XXXX-1" });
|
|
expect(md).to.not.have.property("encoding");
|
|
expect(png).to.include({ filename: "plot-XXXX-1.png", encoding: "base64", content: "iVBORw0KGgoAlice==" });
|
|
expect(pdf).to.include({ encoding: "base64", content: "JVBERi0xLjQK" });
|
|
expect(huge).to.include({ tooLarge: true, encoding: "base64" });
|
|
expect(huge.content).to.be.undefined;
|
|
});
|
|
|
|
it("withholds images when images are not displayed, but keeps other binaries", function () {
|
|
const [, png, pdf] = makeGist({ image: false }).content().files;
|
|
expect(png.content).to.be.undefined;
|
|
expect(png.hidden).to.equal(true);
|
|
expect(pdf.content).to.equal("JVBERi0xLjQK");
|
|
});
|
|
});
|