MCPcopy Create free account
hub / github.com/decaporg/decap-cms / retrieveRecordedExpectations

Function retrieveRecordedExpectations

cypress/utils/mock-server.js:17–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15 });
16
17const retrieveRecordedExpectations = async () => {
18 const promise = new Promise((resolve, reject) => {
19 mockServerClient(PROXY_HOST, PROXY_PORT)
20 .retrieveRecordedExpectations({})
21 .then(resolve, reject);
22 });
23
24 let timeout;
25 const timeoutPromise = new Promise(resolve => {
26 timeout = setTimeout(() => {
27 console.warn('retrieveRecordedExpectations timeout');
28 resolve([]);
29 }, 3000);
30 });
31
32 let recorded = await Promise.race([promise, timeoutPromise]);
33 clearTimeout(timeout);
34
35 recorded = recorded.filter(({ httpRequest }) => {
36 const { Host = [] } = httpRequest.headers;
37
38 // Host is an array of strings
39 return (
40 Host.includes('api.github.com') ||
41 (Host.includes('gitlab.com') && httpRequest.path.includes('api/v4')) ||
42 Host.includes('api.bitbucket.org') ||
43 (Host.includes('bitbucket.org') && httpRequest.path.includes('info/lfs')) ||
44 Host.includes('api.media.atlassian.com') ||
45 Host.some(host => host.includes('netlify.com')) ||
46 Host.some(host => host.includes('netlify.app')) ||
47 Host.some(host => host.includes('s3.amazonaws.com'))
48 );
49 });
50
51 return recorded;
52};
53
54const resetMockServerState = async () => {
55 const promise = new Promise((resolve, reject) => {

Callers 3

teardownGitLabTestFunction · 0.85
teardownBitBucketTestFunction · 0.85
teardownGitHubTestFunction · 0.85

Calls 2

filterMethod · 0.80
someMethod · 0.80

Tested by

no test coverage detected