MCPcopy
hub / github.com/xpf0000/FlyEnv / testUpdateSiteMirrorsUiEditableFields

Function testUpdateSiteMirrorsUiEditableFields

scripts/mcp-regression-test.ts:237–343  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

235}
236
237async function testUpdateSiteMirrorsUiEditableFields() {
238 resetManagers()
239 const forkManager = new FakeForkManager()
240 const nginx = makeVersion('nginx', '1.29.0')
241 forkManager.installedByFlag.nginx = [nginx]
242 ServiceVersionManager.updateCache({ nginx: [nginx] })
243 ServiceProcessManager.addPid('nginx', '1001', nginx)
244
245 const payloads: any[] = []
246 ServiceVersionManager.onMcpNotify((payload) => {
247 payloads.push(payload)
248 })
249
250 const oldSite = {
251 id: 11,
252 type: 'php',
253 name: 'old.test',
254 alias: '',
255 useSSL: false,
256 autoSSL: false,
257 ssl: {
258 cert: '',
259 key: ''
260 },
261 port: {
262 nginx: 80,
263 nginx_ssl: 443,
264 apache: 80,
265 apache_ssl: 443,
266 caddy: 80,
267 caddy_ssl: 443,
268 frankenphp: 80,
269 frankenphp_ssl: 443,
270 tomcat: 80,
271 tomcat_ssl: 443
272 },
273 nginx: {
274 rewrite: ''
275 },
276 url: 'http://old.test',
277 root: 'F:/www/old',
278 mark: '',
279 reverseProxy: []
280 }
281
282 const originalSend = forkManager.send.bind(forkManager)
283 forkManager.send = ((module: string, fn: string, ...args: any[]) => {
284 forkManager.calls.push({ module, fn, args })
285 if (module === 'host' && fn === 'hostList') {
286 return createSendResult({ code: 0, data: { host: [oldSite] } })
287 }
288 if (module === 'host' && fn === 'handleHost') {
289 return createSendResult({ code: 0, data: { host: [args[0]] } })
290 }
291 if (module === 'host' && fn === 'writeHosts') {
292 return createSendResult({ code: 0, data: true })
293 }
294 forkManager.calls.pop()

Callers 1

mainFunction · 0.85

Calls 8

updateSiteMethod · 0.95
updateCacheMethod · 0.80
addPidMethod · 0.80
onMcpNotifyMethod · 0.80
pushMethod · 0.80
resetManagersFunction · 0.70
makeVersionFunction · 0.70
createSendResultFunction · 0.70

Tested by

no test coverage detected