@graphql-hive/federation-gateway-audit
Version:
Audit tool for Apollo Federation Gateway
32 lines (27 loc) • 567 B
text/typescript
export function createTest(
query: string,
expected: {
data?: any;
errors?: boolean;
},
) {
return {
query,
expected,
};
}
export async function fetchTests(endpoint: string) {
const response = await fetch(endpoint, {
method: "GET",
headers: {
Accept: "application/json",
},
});
if (response.status !== 200) {
throw new Error(
`Failed to fetch tests ${response.status} ${response.statusText}`,
);
}
const result = await response.json();
return result as Array<ReturnType<typeof createTest>>;
}