Skip to content

Commit 31794db

Browse files
authored
feat: project added to headers for every request (#175)
part of Visual-Regression-Tracker/Visual-Regression-Tracker#322
1 parent 0f892e0 commit 31794db

6 files changed

+10530
-4080
lines changed

lib/helpers/config.helper.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
readConfigFromFile,
44
validateConfig,
55
} from "./config.helper";
6-
import { mocked } from "ts-jest/utils";
6+
import { mocked } from "jest-mock";
77
import { Config } from "../types";
88
import * as fs from "fs";
99

lib/helpers/dto.helper.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { multipartDtoToFormData, bufferDtoToFormData } from "./index";
22
import { TestRunBufferDto, TestRunMultipartDto } from "../types";
3-
import { mocked } from "ts-jest/utils";
3+
import { mocked } from "jest-mock";
44
import * as fs from "fs";
55

66
jest.mock("form-data");

lib/visualRegressionTracker.spec.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import axios, { AxiosError, AxiosResponse } from "axios";
2-
import { mocked } from "ts-jest/utils";
2+
import { mocked } from "jest-mock";
33
import FormData from "form-data";
44

55
import { VisualRegressionTracker } from "./visualRegressionTracker";
@@ -345,6 +345,7 @@ describe("VisualRegressionTracker", () => {
345345
{
346346
headers: {
347347
apiKey: config.apiKey,
348+
project: config.project,
348349
},
349350
}
350351
);
@@ -381,6 +382,7 @@ describe("VisualRegressionTracker", () => {
381382
{
382383
headers: {
383384
apiKey: config.apiKey,
385+
project: config.project,
384386
},
385387
}
386388
);
@@ -448,6 +450,7 @@ describe("VisualRegressionTracker", () => {
448450
{
449451
headers: {
450452
apiKey: config.apiKey,
453+
project: config.project,
451454
},
452455
}
453456
);
@@ -484,6 +487,7 @@ describe("VisualRegressionTracker", () => {
484487
{
485488
headers: expect.objectContaining({
486489
apiKey: config.apiKey,
490+
project: config.project,
487491
}),
488492
}
489493
);

lib/visualRegressionTracker.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export class VisualRegressionTracker {
4444
this.axiosConfig = {
4545
headers: {
4646
apiKey: this.config.apiKey,
47+
project: this.config.project,
4748
},
4849
};
4950
}
@@ -109,7 +110,7 @@ export class VisualRegressionTracker {
109110
headers: {
110111
...data.getHeaders(),
111112
"Content-Length": data.getLengthSync(),
112-
apiKey: this.config.apiKey,
113+
...this.axiosConfig.headers,
113114
},
114115
})
115116
.then(this.handleResponse)

0 commit comments

Comments
 (0)