forked from farhoodlabs/paperclip
Restrict company imports to GitHub and zip packages
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
+21
-1
@@ -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",
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user