Skip to content

Commit 8b960fc

Browse files
committed
chore(e2e): add TanStack Query <= v5.79.2 tests
1 parent 0346ac1 commit 8b960fc

4 files changed

Lines changed: 108 additions & 0 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/package-lock.json
2+
node_modules
3+
/src/api
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "typescript-nodenext-nodenext-tanstack-query-5-79-2",
3+
"description": "This test verifies that the current version of OpenAPI Qraft is compatible with TanStack Query 5.79.2 or earlier, due to the removal of TQueryData for UseSuspenseInfiniteQueryOptions in TanStack Query 5.80.0",
4+
"private": true,
5+
"version": "1.0.0",
6+
"main": "dist/index.js",
7+
"type": "module",
8+
"scripts": {
9+
"build": "tsc",
10+
"codegen": "openapi-qraft --plugin tanstack-query-react --plugin openapi-typescript https://raw.githubusercontent.com/swagger-api/swagger-petstore/7767363b841961221a38c0be9c6b1066a5120051/src/main/resources/openapi.yaml --clean -o src/api --openapi-types-import-path '../schema.js' --explicit-import-extensions --openapi-types-file-name schema.ts",
11+
"e2e:pre-build": "npm run codegen",
12+
"e2e:post-build": "node ./dist/index.js"
13+
},
14+
"dependencies": {
15+
"@openapi-qraft/cli": "latest",
16+
"@openapi-qraft/react": "latest",
17+
"@tanstack/react-query": "5.79.2",
18+
"@types/node": "latest",
19+
"typescript": "latest"
20+
},
21+
"repository": {
22+
"type": "git",
23+
"url": "https://github.com/OpenAPI-Qraft/openapi-qraft.git"
24+
}
25+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import type { components, paths } from './api/index.js';
2+
import * as callbacksIndex from '@openapi-qraft/react/callbacks';
3+
import * as callbacks from '@openapi-qraft/react/callbacks/index';
4+
import { useMutation } from '@openapi-qraft/react/callbacks/useMutation';
5+
import { useQuery } from '@openapi-qraft/react/callbacks/useQuery';
6+
import {
7+
createSecureRequestFn,
8+
QraftSecureRequestFn,
9+
} from '@openapi-qraft/react/Unstable_QraftSecureRequestFn';
10+
import { createAPIClient as createAPIClientMjs } from './api/index.js';
11+
12+
console.log({} satisfies Partial<components>);
13+
console.log({} satisfies Partial<paths>);
14+
15+
if (typeof createAPIClientMjs !== 'undefined') {
16+
console.log('Client is imported successfully from esm project.');
17+
} else {
18+
console.error('Client is not imported from esm project.');
19+
process.exit(1);
20+
}
21+
22+
if (typeof callbacks !== 'undefined') {
23+
console.log('Callbacks are imported successfully from esm project.');
24+
} else {
25+
console.error('Callbacks are not imported from esm project.');
26+
process.exit(1);
27+
}
28+
29+
if (typeof callbacksIndex !== 'undefined') {
30+
console.log('Callbacks index is imported successfully from esm project.');
31+
} else {
32+
console.error('Callbacks index is not imported from esm project.');
33+
process.exit(1);
34+
}
35+
36+
if (typeof useMutation !== 'undefined') {
37+
console.log('useMutation is imported successfully from esm project.');
38+
} else {
39+
console.error('useMutation is not imported from esm project.');
40+
process.exit(1);
41+
}
42+
43+
if (typeof useQuery !== 'undefined') {
44+
console.log('useQuery is imported successfully from esm project.');
45+
} else {
46+
console.error('useQuery is not imported from esm project.');
47+
process.exit(1);
48+
}
49+
50+
if (typeof createSecureRequestFn !== 'undefined') {
51+
console.log(
52+
'createSecureRequestFn is imported successfully from esm project.'
53+
);
54+
} else {
55+
console.error('createSecureRequestFn is not imported from esm project.');
56+
process.exit(1);
57+
}
58+
59+
if (typeof QraftSecureRequestFn !== 'undefined') {
60+
console.log(
61+
'QraftSecureRequestFn is imported successfully from esm project.'
62+
);
63+
} else {
64+
console.error('QraftSecureRequestFn is not imported from esm project.');
65+
process.exit(1);
66+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"compilerOptions": {
3+
"outDir": "./dist",
4+
"rootDir": "./src",
5+
"target": "es2016",
6+
"module": "NodeNext",
7+
"moduleResolution": "NodeNext",
8+
"esModuleInterop": true,
9+
"forceConsistentCasingInFileNames": true,
10+
"strict": true,
11+
"skipLibCheck": true,
12+
"verbatimModuleSyntax": true
13+
}
14+
}

0 commit comments

Comments
 (0)