-
-
Notifications
You must be signed in to change notification settings - Fork 799
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix runaway mutability bug in httpMethod (#3963)
Co-authored-by: Brandon Bayer <[email protected]> Closes #3962
- Loading branch information
Showing
3 changed files
with
38 additions
and
5 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 @@ | ||
--- | ||
"@blitzjs/rpc": minor | ||
--- | ||
|
||
Fix mutability bug in RPC configuration |
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,30 @@ | ||
import {describe, expect, it} from "vitest" | ||
import {getResolverConfig} from "./parse-rpc-config" | ||
|
||
describe("getResolverConfig", () => { | ||
it("base case: no configuration", async () => { | ||
const result = getResolverConfig("") | ||
expect(result).toHaveProperty("httpMethod", "POST") | ||
}) | ||
|
||
it("customized to get", async () => { | ||
const result = getResolverConfig(` | ||
export const config = { | ||
httpMethod: 'GET' | ||
} | ||
`) | ||
expect(result).toHaveProperty("httpMethod", "GET") | ||
}) | ||
|
||
it("evaluation is hermetic", async () => { | ||
expect( | ||
getResolverConfig(` | ||
export const config = { | ||
httpMethod: 'GET' | ||
} | ||
`), | ||
).toHaveProperty("httpMethod", "GET") | ||
|
||
expect(getResolverConfig(``)).toHaveProperty("httpMethod", "POST") | ||
}) | ||
}) |
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