fix: negative sentiment → neutral language (#39522)
The existing terminology carries negative sentiment that can be interpreted in a racial or sense. Updating the name to have no potential for such a connection. Co-authored-by: Justin Rogers <justrog@gmail.com>
This commit is contained in:
committed by
GitHub
parent
b93785be5d
commit
c23c4ef8e4
@ -4,7 +4,7 @@ import { mockReq, mockRes } from 'sinon-express-mock';
|
||||
import jwt from 'jsonwebtoken';
|
||||
|
||||
import createRequestAuthorization, {
|
||||
isWhiteListedPath
|
||||
isAllowedPath
|
||||
} from './request-authorization';
|
||||
|
||||
const validJWTSecret = 'this is a super secret string';
|
||||
@ -27,7 +27,7 @@ const mockGetUserById = id =>
|
||||
id in users ? Promise.resolve(users[id]) : Promise.reject('No user found');
|
||||
|
||||
describe('request-authorization', () => {
|
||||
describe('isWhiteListedPath', () => {
|
||||
describe('isAllowedPath', () => {
|
||||
const authRE = /^\/auth\//;
|
||||
const confirmEmailRE = /^\/confirm-email$/;
|
||||
const newsShortLinksRE = /^\/n\/|^\/p\//;
|
||||
@ -42,7 +42,7 @@ describe('request-authorization', () => {
|
||||
const unsubscribeRE = /^\/u\/|^\/unsubscribe\/|^\/ue\//;
|
||||
const updateHooksRE = /^\/hooks\/update-paypal$|^\/hooks\/update-stripe$/;
|
||||
|
||||
const whiteList = [
|
||||
const allowedPathsList = [
|
||||
authRE,
|
||||
confirmEmailRE,
|
||||
newsShortLinksRE,
|
||||
@ -58,18 +58,21 @@ describe('request-authorization', () => {
|
||||
];
|
||||
|
||||
it('returns a boolean', () => {
|
||||
const result = isWhiteListedPath();
|
||||
const result = isAllowedPath();
|
||||
expect(typeof result).toBe('boolean');
|
||||
});
|
||||
|
||||
it('returns true for a white listed path', () => {
|
||||
const resultA = isWhiteListedPath(
|
||||
const resultA = isAllowedPath(
|
||||
'/auth/auth0/callback?code=yF_mGjswLsef-_RLo',
|
||||
whiteList
|
||||
allowedPathsList
|
||||
);
|
||||
const resultB = isWhiteListedPath('/ue/WmjInLerysPrcon6fMb/', whiteList);
|
||||
const resultC = isWhiteListedPath('/hooks/update-paypal', whiteList);
|
||||
const resultD = isWhiteListedPath('/hooks/update-stripe', whiteList);
|
||||
const resultB = isAllowedPath(
|
||||
'/ue/WmjInLerysPrcon6fMb/',
|
||||
allowedPathsList
|
||||
);
|
||||
const resultC = isAllowedPath('/hooks/update-paypal', allowedPathsList);
|
||||
const resultD = isAllowedPath('/hooks/update-stripe', allowedPathsList);
|
||||
expect(resultA).toBe(true);
|
||||
expect(resultB).toBe(true);
|
||||
expect(resultC).toBe(true);
|
||||
@ -77,8 +80,11 @@ describe('request-authorization', () => {
|
||||
});
|
||||
|
||||
it('returns false for a non-white-listed path', () => {
|
||||
const resultA = isWhiteListedPath('/hax0r-42/no-go', whiteList);
|
||||
const resultB = isWhiteListedPath('/update-current-challenge', whiteList);
|
||||
const resultA = isAllowedPath('/hax0r-42/no-go', allowedPathsList);
|
||||
const resultB = isAllowedPath(
|
||||
'/update-current-challenge',
|
||||
allowedPathsList
|
||||
);
|
||||
expect(resultA).toBe(false);
|
||||
expect(resultB).toBe(false);
|
||||
});
|
||||
|
Reference in New Issue
Block a user