Skip to content

Commit

Permalink
Merge pull request #13700 from mozilla/train-237-uplift-1
Browse files Browse the repository at this point in the history
Train 237 uplift 1
  • Loading branch information
StaberindeZA authored Jul 21, 2022
2 parents 2630823 + 41bb5c8 commit bcd66d1
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 22 deletions.
8 changes: 0 additions & 8 deletions packages/fxa-admin-server/.eslintrc.json

This file was deleted.

3 changes: 1 addition & 2 deletions packages/fxa-admin-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"prebuild": "rimraf dist",
"build": "yarn prebuild && yarn nest build && cp ./src/config/*.json ./dist/config",
"compile": "tsc --noEmit",
"lint": "eslint .",
"lint": "eslint *",
"audit": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
"start": "yarn build && pm2 start pm2.config.js",
"stop": "pm2 stop pm2.config.js",
Expand Down Expand Up @@ -74,7 +74,6 @@
"esbuild": "^0.14.2",
"esbuild-register": "^3.2.0",
"eslint": "^8.18.0",
"eslint-plugin-fxa": "^2.0.2",
"jest": "27.5.1",
"pm2": "^5.1.2",
"supertest": "^6.2.4",
Expand Down
19 changes: 9 additions & 10 deletions packages/fxa-content-server/tests/server/helpers/routesHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ function checkHeaders(routes, route, res) {
* each URL exists, responds with a 200, and in the case of JS, CSS
* and fonts, that the correct CORS headers are set.
*/
function extractAndCheckUrls(res, testName) {
function extractAndCheckUrls(res, testName, acceptLanguage) {
var href = url.parse(res.url);
var origin = [href.protocol, '//', href.host].join('');
return extractUrls(res.body).then((resources) =>
checkUrls(origin, resources, testName)
checkUrls(origin, resources, testName, acceptLanguage)
);
}

Expand Down Expand Up @@ -149,7 +149,7 @@ function isUrlIgnored(url) {
return IGNORE_URL_REGEXPS.find((domainRegExp) => domainRegExp.test(url));
}

function checkUrls(origin, resources, testName = '') {
function checkUrls(origin, resources, testName = '', acceptLanguage = 'en') {
return findCssSubResources(origin, resources).then((cssSubResources) => {
resources = resources.concat(cssSubResources);

Expand All @@ -158,13 +158,13 @@ function checkUrls(origin, resources, testName = '') {
return checkedUrlPromises[resource.url];
}

var requestOptions = {};
var requestOptions = {
headers: {
'accept-language': acceptLanguage,
},
};
if (doesURLRequireCORS(resource.url)) {
requestOptions = {
headers: {
Origin: origin,
},
};
requestOptions.headers.Origin = origin;
}

var promise = makeRequest(resource.url, requestOptions).then(function (
Expand All @@ -173,7 +173,6 @@ function checkUrls(origin, resources, testName = '') {
if (isUrlIgnored(resource.url)) {
return;
}

assert.equal(res.statusCode, 200, `${testName}: ${resource.url}`);

// If prod-like, Check all CSS and JS (except experiments.bundle.js)
Expand Down
6 changes: 5 additions & 1 deletion packages/fxa-content-server/tests/server/l10n-entrained.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ function routeTest(route, expectedStatusCode, requestOptions) {
assert.equal(res.statusCode, expectedStatusCode);
checkHeaders(routes, route, res);

return extractAndCheckUrls(res, testName);
return extractAndCheckUrls(
res,
testName,
requestOptions.headers['Accept-Language']
);
})
.then(dfd.resolve.bind(dfd), dfd.reject.bind(dfd));

Expand Down
1 change: 0 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -22717,7 +22717,6 @@ fsevents@~2.1.1:
esbuild: ^0.14.2
esbuild-register: ^3.2.0
eslint: ^8.18.0
eslint-plugin-fxa: ^2.0.2
express: ^4.17.2
fxa-shared: "workspace:*"
googleapis: ^102.0.0
Expand Down

0 comments on commit bcd66d1

Please sign in to comment.