Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.timeout(5000);
writeDictItem = sinon.fake.resolves(true);
purgeAll = sinon.fake.resolves(true);
RemotePublishCommand = proxyquire('../src/remotepublish.cmd', {
'@adobe/fastly-native-promises': () => ({
transact: (fn) => fn(3),
writeDictItem,
purgeAll,
}),
});
// ensure to reset nock to avoid conflicts with PollyJS
nock.restore();
nock.cleanAll();
nock.activate();
scope = nock('https://adobeioruntime.net')
.post('/api/v1/web/helix/helix-services/publish@v2')
.reply(400, {});
});
this.timeout(5000);
writeDictItem = sinon.fake.resolves(true);
purgeAll = sinon.fake.resolves(true);
RemotePublishCommand = proxyquire('../src/remotepublish.cmd', {
'@adobe/fastly-native-promises': () => ({
transact: (fn) => fn(3),
writeDictItem,
purgeAll,
}),
});
// ensure to reset nock to avoid conflicts with PollyJS
nock.restore();
nock.cleanAll();
nock.activate();
scope = nock('https://adobeioruntime.net')
.post('/api/v1/web/helix/helix-services/publish@v2')
.reply(200, {})
.post('/api/v1/web/helix/helix-services/logging@v1')
.reply(200, {});
});
purgeAll = sinon.fake.resolves(true);
softPurgeKey = sinon.fake.resolves(true);
RemotePublishCommand = proxyquire('../src/remotepublish.cmd', {
'@adobe/fastly-native-promises': () => ({
transact: (fn) => fn(3),
writeDictItem,
purgeAll,
softPurgeKey,
}),
});
// ensure to reset nock to avoid conflicts with PollyJS
nock.restore();
nock.cleanAll();
nock.activate();
});
softPurgeKey = sinon.fake.resolves(true);
RemotePublishCommand = proxyquire('../src/remotepublish.cmd', {
'@adobe/fastly-native-promises': () => ({
transact: (fn) => fn(3),
writeDictItem,
purgeAll,
softPurgeKey,
}),
});
// ensure to reset nock to avoid conflicts with PollyJS
nock.restore();
nock.cleanAll();
nock.activate();
nock('https://adobeioruntime.net')
.post('/api/v1/web/helix/helix-services/publish@v2', (body) => {
publishedstrains = body.configuration.strains.reduce((o, strain) => {
if (strain.origin) {
// eslint-disable-next-line no-param-reassign
o[strain.name] = strain.origin.hostname === 'www.adobe.io' ? 'branch' : 'master';
}
if (strain.package) {
// eslint-disable-next-line no-param-reassign
o[strain.name] = strain.package;
}
return o;
}, {});
return true;
})
softPurgeKey = sinon.fake.resolves(true);
ProxiedRemotePublishCommand = proxyquire('../src/remotepublish.cmd', {
'@adobe/fastly-native-promises': () => ({
transact: (fn) => fn(3),
writeDictItem,
purgeAll,
softPurgeKey,
}),
});
// ensure to reset nock to avoid conflicts with PollyJS
nock.restore();
nock.cleanAll();
nock.activate();
scope = nock('https://adobeioruntime.net')
.post('/api/v1/web/helix/helix-services/publish@v2', (body) => {
({ vcl } = body);
return true;
})
.reply(200, {})
.post('/api/v1/web/helix/helix-services/logging@v1')
.reply(200, {});
// set up a fake git repo.
testRoot = await createTestRoot();
await fs.copy(path.resolve(__dirname, 'fixtures/filtered-master.yaml'), path.resolve(testRoot, 'helix-config.yaml'));
// throw a Javascript error when any shell.js command encounters an error
shell.config.fatal = true;
body = JSON.stringify(body);
}
}
adapter.handleRequest({
url,
method,
headers,
body,
requestArguments: { req, body, respond, parsedArguments }
});
});
});
// Activate nock so it can start to intercept all outgoing requests
nock.activate();
}
beforeEach(() => {
if (!nock.isActive()) {
nock.activate();
}
});
constructor() {
nock.cleanAll();
if (!nock.isActive()) {
nock.activate();
}
this.scope = nock(BalenaAPIMock.basePathPattern);
nock.emitter.on('no match', this.handleUnexpectedRequest);
}
cleanAll() {
nock.cleanAll()
if (!this.recording) {
nock.restore()
nock.activate()
}
this._noMatches = []
}
const [options] = REQUEST_ARGUMENTS.get(req);
const interceptedRequest: InterceptedRequest = {
body,
headers,
method,
options,
req,
respond: respond as nock.ReplyCallback
};
recorder.handleRequest(interceptedRequest);
});
});
nock.activate();
}
}