Prevent nested ternary expressions (#18376)

Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
This commit is contained in:
Brainslug
2023-05-01 21:07:40 +02:00
committed by GitHub
parent 3ff71cc34a
commit 87f2edc735
9 changed files with 82 additions and 39 deletions

View File

@@ -32,11 +32,11 @@ const knexConfig = {
const allowedLogLevels = ['trace', 'debug', 'info', 'warn', 'error', 'fatal'];
const logLevel = process.env.TEST_SAVE_LOGS
? allowedLogLevels.includes(process.env.TEST_SAVE_LOGS)
? process.env.TEST_SAVE_LOGS
: 'info'
: 'error';
let logLevel = 'error';
if (process.env.TEST_SAVE_LOGS) {
logLevel = allowedLogLevels.includes(process.env.TEST_SAVE_LOGS) ? process.env.TEST_SAVE_LOGS : 'info';
}
const directusAuthConfig = {
AUTH_PROVIDERS: 'saml',

View File

@@ -30,13 +30,16 @@ describe('schema', () => {
const currentTzOffset = new Date().getTimezoneOffset();
const isWindows = ['win32', 'win64'].includes(process.platform);
const newTzOffset = currentTzOffset !== 180 ? 180 : 360;
let newTz: string;
// Different timezone format for Windows
const newTz = isWindows
? String(newTzOffset * 60)
: newTzOffset === 180
? 'America/Sao_Paulo'
: 'America/Mexico_City';
if (isWindows) {
newTz = String(newTzOffset * 60);
} else if (newTzOffset === 180) {
newTz = 'America/Sao_Paulo';
} else {
newTz = 'America/Mexico_City';
}
const sampleDates: SchemaTimezoneTypesObject[] = [];

View File

@@ -31,9 +31,16 @@ describe('schema', () => {
const isWindows = ['win32', 'win64'].includes(process.platform);
const newTzOffset = currentTzOffset !== -540 ? -540 : -240;
let newTz: string;
// Different timezone format for Windows
const newTz = isWindows ? String(newTzOffset * 60) : newTzOffset === -540 ? 'Asia/Seoul' : 'Asia/Dubai';
if (isWindows) {
newTz = String(newTzOffset * 60);
} else if (newTzOffset === -540) {
newTz = 'Asia/Seoul';
} else {
newTz = 'Asia/Dubai';
}
const sampleDates: SchemaTimezoneTypesObject[] = [];