Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ninadbstack committed Oct 23, 2024
1 parent dd158bc commit eff6096
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
6 changes: 4 additions & 2 deletions packages/cli-build/test/id.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ describe('percy build:id', () => {

expect(logger.stderr).toEqual([]);
expect(logger.stdout).toEqual(['123']);
expect(percyServer.requests).toEqual([['/percy/healthcheck']]);
expect(percyServer.requests.length).toEqual(1);
expect(percyServer.requests[0][0]).toEqual('/percy/healthcheck');
});

it('can call the /percy/healthcheck endpoint at an alternate port', async () => {
Expand All @@ -40,7 +41,8 @@ describe('percy build:id', () => {

expect(logger.stderr).toEqual([]);
expect(logger.stdout).toEqual(['456']);
expect(percyServer.requests).toEqual([['/percy/healthcheck']]);
expect(percyServer.requests.length).toEqual(1);
expect(percyServer.requests[0][0]).toEqual('/percy/healthcheck');
});

it('logs an error when the endpoint errors', async () => {
Expand Down
6 changes: 4 additions & 2 deletions packages/cli-exec/test/ping.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ describe('percy exec:ping', () => {

expect(logger.stderr).toEqual([]);
expect(logger.stdout).toEqual(['[percy] Percy is running']);
expect(percyServer.requests).toEqual([['/percy/healthcheck']]);
expect(percyServer.requests.length).toEqual(1);
expect(percyServer.requests[0][0]).toEqual('/percy/healthcheck');
});

it('can ping /percy/healthcheck at an alternate port', async () => {
Expand All @@ -46,7 +47,8 @@ describe('percy exec:ping', () => {

expect(logger.stderr).toEqual([]);
expect(logger.stdout).toEqual(['[percy] Percy is running']);
expect(percyServer.requests).toEqual([['/percy/healthcheck']]);
expect(percyServer.requests.length).toEqual(1);
expect(percyServer.requests[0][0]).toEqual('/percy/healthcheck');
});

it('logs an error when the endpoint errors', async () => {
Expand Down
14 changes: 6 additions & 8 deletions packages/cli-exec/test/stop.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ describe('percy exec:stop', () => {

await stop();

expect(percyServer.requests).toEqual([
['/percy/stop'],
['/percy/healthcheck']
]);
expect(percyServer.requests.length).toEqual(2);
expect(percyServer.requests[0][0]).toEqual('/percy/stop');
expect(percyServer.requests[1][0]).toEqual('/percy/healthcheck');

expect(logger.stderr).toEqual([]);
expect(logger.stdout).toEqual(['[percy] Percy has stopped']);
Expand All @@ -54,10 +53,9 @@ describe('percy exec:stop', () => {

await stop(['--port=4567']);

expect(percyServer.requests).toEqual([
['/percy/stop'],
['/percy/healthcheck']
]);
expect(percyServer.requests.length).toEqual(2);
expect(percyServer.requests[0][0]).toEqual('/percy/stop');
expect(percyServer.requests[1][0]).toEqual('/percy/healthcheck');

expect(logger.stderr).toEqual([]);
expect(logger.stdout).toEqual(['[percy] Percy has stopped']);
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ async function sendResponseResource(network, request, session) {

// Make a new request with Node based on a network request
async function makeDirectRequest(network, request, session) {
const { cookies = [] } = await session.send('Network.getCookies', { urls: [request.url] });
const { cookies } = await session.send('Network.getCookies', { urls: [request.url] });

let headers = {
...request.headers,
Expand Down

0 comments on commit eff6096

Please sign in to comment.