-
Notifications
You must be signed in to change notification settings - Fork 61
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
14 changed files
with
904 additions
and
94 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
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,30 @@ | ||
import type { TaskContext } from "vitest" | ||
|
||
import fetch from "node-fetch" | ||
|
||
import { createRepositoryName } from "./createRepositoryName" | ||
|
||
import * as prismic from "../../src" | ||
|
||
type CreateTestWriteClientArgs = { | ||
repositoryName?: string | ||
} & { | ||
ctx: TaskContext | ||
clientConfig?: Partial<prismic.WriteClientConfig> | ||
} | ||
|
||
export const createTestWriteClient = ( | ||
args: CreateTestWriteClientArgs, | ||
): prismic.WriteClient => { | ||
const repositoryName = args.repositoryName || createRepositoryName(args.ctx) | ||
|
||
return prismic.createWriteClient(repositoryName, { | ||
fetch, | ||
writeToken: "xxx", | ||
migrationAPIKey: "yyy", | ||
// We create unique endpoints so we can run tests concurrently | ||
assetAPIEndpoint: `https://${repositoryName}.asset-api.prismic.io`, | ||
migrationAPIEndpoint: `https://${repositoryName}.migration.prismic.io`, | ||
...args.clientConfig, | ||
}) | ||
} |
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
Oops, something went wrong.