-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(auto-sync): Add an AutoSyncProvider and trigger a sync changes w…
…hen needed
- Loading branch information
1 parent
6da2e44
commit 16300ac
Showing
53 changed files
with
1,433 additions
and
933 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
packages/init/test/__testutils__/loginAndActionWithStdin.ts
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,38 @@ | ||
import { PrismicAuthLoginResponse } from "./createPrismicAuthLoginResponse"; | ||
|
||
export async function loginAndFetchUserDataWithStdin( | ||
prismicAuthLoginResponse: PrismicAuthLoginResponse, | ||
action: () => Promise<void>, | ||
) { | ||
const stdin = mockStdin(); | ||
|
||
// @ts-expect-error - Accessing protected method | ||
const promise = initProcess.loginAndFetchUserData(); | ||
|
||
await new Promise((res) => setTimeout(res, 50)); | ||
|
||
stdin.send("o").restore(); | ||
|
||
await new Promise((res) => setTimeout(res, 50)); | ||
|
||
const port: number = | ||
spiedManager.user.getLoginSessionInfo.mock.results[0].value.port; | ||
|
||
const body = JSON.stringify(prismicAuthLoginResponse); | ||
|
||
// We use low-level `http` because node-fetch has some issue with 127.0.0.1 on CIs | ||
const request = http.request({ | ||
host: "127.0.0.1", | ||
port: `${port}`, | ||
path: "/", | ||
method: "POST", | ||
headers: { | ||
"Content-Type": "application/json", | ||
"Content-Length": Buffer.byteLength(body), | ||
}, | ||
}); | ||
request.write(body); | ||
request.end(); | ||
|
||
return promise; | ||
} |
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
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
Oops, something went wrong.