feat: initial commit

This commit is contained in:
Lucàs
2026-07-01 08:15:20 +02:00
commit 2408473415
20 changed files with 2132 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
import { describe, it, expect } from "vitest";
import { Fico } from "../src/Fico.js";
const fico = new Fico();
describe("Fico roundtrip", () => {
it("encode → PNG → decode should preserve data", () => {
const input = new TextEncoder().encode("Hello FICO 🚀");
const png = fico.toPNG(input);
const output = fico.fromPNG(png);
expect(output).toEqual(input);
});
});
+20
View File
@@ -0,0 +1,20 @@
import { describe, it } from "vitest";
import { writeFileSync } from "fs";
import { Fico } from "../src/Fico.js";
describe("generate png", () => {
it("should generate a PNG file", () => {
const fico = new Fico();
const input = new TextEncoder().encode("Hello FICO 🚀");
const png = fico.toPNG(input);
writeFileSync("out.png", png);
// juste vérifier que quelque chose est généré
if (!png || png.length === 0) {
throw new Error("PNG empty");
}
});
});
+18
View File
@@ -0,0 +1,18 @@
import { describe, it, expect } from "vitest";
import { Fico } from "../src/Fico.js";
describe("read png", () => {
it("should read PNG and recover original data", () => {
const fico = new Fico();
const input = new TextEncoder().encode("Hello FICO 🚀");
// encode → PNG
const png = fico.toPNG(input);
// PNG → decode
const output = fico.fromPNG(png);
expect(output).toEqual(input);
});
});