-
-
Notifications
You must be signed in to change notification settings - Fork 494
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
625 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"openapi-fetch": patch | ||
--- | ||
|
||
Remove nanoid from dependencies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"openapi-fetch": patch | ||
--- | ||
|
||
Fix "failed to execute fetch on Window" error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"openapi-fetch": patch | ||
--- | ||
|
||
Revert customFetch API back to `fetch(input: Request)` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { defineConfig, devices } from "@playwright/test"; | ||
|
||
const PORT = Number.parseInt(process.env.PORT || 4173 || "", 10); | ||
|
||
export default defineConfig({ | ||
testMatch: "test/**/*.e2e.ts", | ||
webServer: { | ||
command: "pnpm run e2e-vite-build && pnpm run e2e-vite-start", | ||
port: PORT, | ||
}, | ||
use: { | ||
baseURL: `http://localhost:${PORT}`, | ||
}, | ||
projects: [ | ||
{ | ||
name: "chrome", | ||
use: { ...devices["Desktop Chrome"] }, | ||
}, | ||
{ | ||
name: "firefox", | ||
use: { ...devices["Desktop Firefox"] }, | ||
}, | ||
{ | ||
name: "webkit", | ||
use: { ...devices["Desktop Safari"] }, | ||
}, | ||
], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"status": "passed", | ||
"failedTests": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import createClient from "../../../src"; | ||
import type { paths } from "./e2e.d.ts"; | ||
|
||
const client = createClient<paths>({ | ||
baseUrl: "/api/v1", | ||
}); | ||
|
||
/** | ||
* Test 1: GET /api/v1/get | ||
*/ | ||
async function testGet() { | ||
const { data } = await client.GET("/get"); | ||
if (!data) { | ||
throw new Error("/get: No data"); | ||
} | ||
} | ||
|
||
/** | ||
* Test 2: POST /api/v1/post | ||
*/ | ||
async function testPost() { | ||
const { data } = await client.POST("/post", { body: { message: "POST" } }); | ||
if (!data) { | ||
throw new Error("/post: No data"); | ||
} | ||
} | ||
|
||
/** | ||
* Test 3: PUT /api/v1/multi-form | ||
*/ | ||
async function testMultiForm() { | ||
const { data } = await client.POST("/multi-form", { | ||
body: { | ||
message: "Form", | ||
file: new File(["Hello, World!"], "hello.txt") as unknown as string, | ||
}, | ||
}); | ||
if (!data) { | ||
throw new Error("/multi-form: No data"); | ||
} | ||
} | ||
|
||
// run all tests immediately on load | ||
(async () => { | ||
await Promise.all([testGet(), testPost(), testMultiForm()]); | ||
|
||
// add element Playwright is waiting for | ||
const div = document.createElement("div"); | ||
div.setAttribute("data-status", "success"); | ||
div.innerHTML = "Success"; | ||
document.body.appendChild(div); | ||
})(); |
Oops, something went wrong.