mirror of
https://github.com/tale/headplane.git
synced 2026-08-18 09:03:14 +00:00
feat: add e2e integration tests and canonical versioning
This commit is contained in:
@@ -2,12 +2,6 @@ import { StrictMode, startTransition } from 'react';
|
||||
import { hydrateRoot } from 'react-dom/client';
|
||||
import { HydratedRouter } from 'react-router/dom';
|
||||
|
||||
if (import.meta.env.DEV) {
|
||||
import('react-scan').then(({ scan }) => {
|
||||
scan({ enabled: true });
|
||||
});
|
||||
}
|
||||
|
||||
startTransition(() => {
|
||||
hydrateRoot(
|
||||
document,
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"0.26.1": ["0.26.0", "0.26.1"],
|
||||
"0.27.0": ["0.27.0"]
|
||||
}
|
||||
@@ -12,10 +12,6 @@ export interface ApiKeyEndpoints {
|
||||
|
||||
export default defineApiEndpoints<ApiKeyEndpoints>((client, apiKey) => ({
|
||||
getApiKeys: async () => {
|
||||
if (client.isAtleast('0.27.0')) {
|
||||
console.log('wow we are at least 0.27.0!');
|
||||
}
|
||||
|
||||
const { apiKeys } = await client.apiFetch<{ apiKeys: Key[] }>(
|
||||
'GET',
|
||||
'v1/apikey',
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import canonicals from '~/openapi-canonical-families.json';
|
||||
import hashes from '~/openapi-operation-hashes.json';
|
||||
import log from '~/utils/log';
|
||||
|
||||
@@ -64,7 +65,30 @@ export function detectApiVersion(
|
||||
);
|
||||
}
|
||||
|
||||
return bestVersion;
|
||||
const canonical = Object.entries(canonicals).find(([_, family]) =>
|
||||
family.includes(bestVersion),
|
||||
)?.[0] as Version | undefined;
|
||||
|
||||
if (!canonical) {
|
||||
log.warn(
|
||||
'api',
|
||||
'Could not canonicalize detected version %s, using as-is',
|
||||
bestVersion,
|
||||
);
|
||||
|
||||
return bestVersion;
|
||||
}
|
||||
|
||||
if (canonical !== bestVersion) {
|
||||
log.info(
|
||||
'api',
|
||||
'Canonicalizing detected version %s → %s (same schema)',
|
||||
bestVersion,
|
||||
canonical,
|
||||
);
|
||||
}
|
||||
|
||||
return canonical;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user