Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
devServer.after(app);
const handler = app.use.mock.calls[0][0];
handler();
await plugin.middlewarePromise;
const io = upward.middleware.mock.calls[0][2];
io.networkFetch('http://example.com', { method: 'POST' });
expect(fetch).toHaveBeenCalledWith(
'http://example.com',
expect.objectContaining({
method: 'POST'
})
);
expect(fetch.mock.calls[0][1]).not.toHaveProperty('agent');
});
.mockReturnValueOnce(new Response(verifiedResp))
.mockReturnValueOnce(new Response(verifiedResp))
.mockImplementation(() => new Response(unverifiedResp));
logger.log
.mockReturnValueOnce(new Response(verifiedResp))
.mockReturnValueOnce(new Response(verifiedResp))
.mockImplementation(() => new Response(unverifiedResp));
const { unverified: unverifiedContracts, alreadyVerified } = await filterOutVerified(
artifactsData,
{ apiUrl, logger }
);
expect(fetch.mock.calls).toMatchSnapshot('Fetch calls');
const fetchReturns = fetch.mock.results.map(({ value: response }) => JSON.parse(response.body));
expect(fetchReturns).toMatchSnapshot('Fetch returns');
expect(replaceCWD(alreadyVerified)).toMatchSnapshot('Already verified');
const all = Object.keys(artifactsData).length;
const unverifiedKeys = Object.keys(unverifiedContracts);
const verified = all - unverifiedKeys.length;
expect(verified).toEqual(2);
expect(verified).toEqual(alreadyVerified.length);
expect(unverifiedKeys).toMatchSnapshot('Unverified contracts');
unverifiedKeys.forEach(key => {
expect(replaceCWD(unverifiedContracts[key])).toMatchSnapshot(
{
bytecode: expect.any(String),
const unverifiedResp = JSON.stringify({ status: '0' });
fetch
.mockReturnValueOnce(new Response(verifiedResp))
.mockReturnValueOnce(new Response(verifiedResp))
.mockImplementation(() => new Response(unverifiedResp));
logger.log
.mockReturnValueOnce(new Response(verifiedResp))
.mockReturnValueOnce(new Response(verifiedResp))
.mockImplementation(() => new Response(unverifiedResp));
const { unverified: unverifiedContracts, alreadyVerified } = await filterOutVerified(
artifactsData,
{ apiUrl, logger }
);
expect(fetch.mock.calls).toMatchSnapshot('Fetch calls');
const fetchReturns = fetch.mock.results.map(({ value: response }) => JSON.parse(response.body));
expect(fetchReturns).toMatchSnapshot('Fetch returns');
expect(replaceCWD(alreadyVerified)).toMatchSnapshot('Already verified');
const all = Object.keys(artifactsData).length;
const unverifiedKeys = Object.keys(unverifiedContracts);
const verified = all - unverifiedKeys.length;
expect(verified).toEqual(2);
expect(verified).toEqual(alreadyVerified.length);
expect(unverifiedKeys).toMatchSnapshot('Unverified contracts');
unverifiedKeys.forEach(key => {
expect(replaceCWD(unverifiedContracts[key])).toMatchSnapshot(