mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-16 19:00:38 +09:00
Restrict company imports to GitHub and zip packages
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
parent
0b829ea20b
commit
4a5aba5bac
6 changed files with 163 additions and 94 deletions
|
|
@ -1,7 +1,7 @@
|
|||
// @vitest-environment node
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { createZipArchive } from "./zip";
|
||||
import { createZipArchive, readZipArchive } from "./zip";
|
||||
|
||||
function readUint16(bytes: Uint8Array, offset: number) {
|
||||
return bytes[offset]! | (bytes[offset + 1]! << 8);
|
||||
|
|
@ -50,4 +50,24 @@ describe("createZipArchive", () => {
|
|||
expect(readUint16(archive, endOffset + 8)).toBe(2);
|
||||
expect(readUint16(archive, endOffset + 10)).toBe(2);
|
||||
});
|
||||
|
||||
it("reads a Paperclip zip archive back into rootPath and file contents", () => {
|
||||
const archive = createZipArchive(
|
||||
{
|
||||
"COMPANY.md": "# Company\n",
|
||||
"agents/ceo/AGENTS.md": "# CEO\n",
|
||||
".paperclip.yaml": "schema: paperclip/v1\n",
|
||||
},
|
||||
"paperclip-demo",
|
||||
);
|
||||
|
||||
expect(readZipArchive(archive)).toEqual({
|
||||
rootPath: "paperclip-demo",
|
||||
files: {
|
||||
"COMPANY.md": "# Company\n",
|
||||
"agents/ceo/AGENTS.md": "# CEO\n",
|
||||
".paperclip.yaml": "schema: paperclip/v1\n",
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue