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

Function teardownGitLabTest

cypress/plugins/gitlab.js:291–326  ·  view source on GitHub ↗
(taskData, { transformRecordedData } = defaultOptions)

Source from the content-addressed store, hash-verified

289};
290
291async function teardownGitLabTest(taskData, { transformRecordedData } = defaultOptions) {
292 if (process.env.RECORD_FIXTURES) {
293 await resetRepositories(taskData);
294
295 try {
296 const filename = getExpectationsFilename(taskData);
297
298 console.log('Persisting recorded data for test:', path.basename(filename));
299
300 const { owner, token } = getEnvs();
301
302 const expectations = await retrieveRecordedExpectations();
303
304 const toSanitize = {
305 owner,
306 repo: taskData.repo,
307 token,
308 ownerName: taskData.user.name,
309 };
310 // transform the mock proxy recorded requests into Cypress route format
311 const toPersist = expectations.map(expectation =>
312 transformRecordedData(expectation, toSanitize),
313 );
314
315 const toPersistString = sanitizeString(JSON.stringify(toPersist, null, 2), toSanitize);
316
317 await fs.writeFile(filename, toPersistString);
318 } catch (e) {
319 console.log(e);
320 }
321
322 await resetMockServerState();
323 }
324
325 return null;
326}
327
328module.exports = {
329 transformRecordedData,

Callers 1

teardownBackendTestFunction · 0.85

Calls 8

getExpectationsFilenameFunction · 0.85
resetMockServerStateFunction · 0.85
mapMethod · 0.80
resetRepositoriesFunction · 0.70
getEnvsFunction · 0.70
transformRecordedDataFunction · 0.70
sanitizeStringFunction · 0.70

Tested by

no test coverage detected