Skip to content

Commit fd66012

Browse files
committed
feat: CI
1 parent d986aea commit fd66012

3 files changed

Lines changed: 382 additions & 3 deletions

File tree

test/fixtures.mjs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* Shared test fixtures.
3+
* Inline content avoids dependency on working-directory-relative files in CI.
4+
*/
5+
6+
export const TEST_TTL = `\
7+
@prefix owl: <http://www.w3.org/2002/07/owl#> .
8+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
9+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
10+
@prefix ex: <http://example.org/onto#> .
11+
12+
ex:Persona a owl:Class ; rdfs:label "Persona"@it .
13+
ex:Organizzazione a owl:Class ; rdfs:label "Organizzazione"@it .
14+
ex:nome a owl:DatatypeProperty ; rdfs:domain ex:Persona ; rdfs:label "nome"@it .
15+
ex:appartienea a owl:ObjectProperty ; rdfs:domain ex:Persona ; rdfs:range ex:Organizzazione .
16+
17+
ex:mario a ex:Persona ; ex:nome "Mario Rossi" .
18+
`;

test/http-api.test.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import test from "node:test";
22
import assert from "node:assert/strict";
33
import { spawn } from "node:child_process";
44
import { randomUUID } from "node:crypto";
5-
import { readFile } from "node:fs/promises";
5+
import { TEST_TTL } from "./fixtures.mjs";
66

77
const HOST = "127.0.0.1";
88
const PORT = 3400 + Math.floor(Math.random() * 1000);
@@ -68,7 +68,7 @@ test("GET /health returns service status", async () => {
6868
});
6969

7070
test("POST /upload + GET /sparql/{id} can query uploaded ontology", async () => {
71-
const ttl = await readFile("test.ttl", "utf8");
71+
const ttl = TEST_TTL;
7272

7373
const uploadRes = await fetch(`${BASE_URL}/upload`, {
7474
method: "POST",
@@ -123,7 +123,7 @@ test("POST /upload rejects payload > 1MB", async () => {
123123
});
124124

125125
test("GET /sparql/{id} without query returns 400", async () => {
126-
const ttl = await readFile("test.ttl", "utf8");
126+
const ttl = TEST_TTL;
127127
const uploadRes = await fetch(`${BASE_URL}/upload`, {
128128
method: "POST",
129129
headers: { "Content-Type": "text/turtle" },

0 commit comments

Comments
 (0)