Skip to content

Commit

Permalink
Remove elvis operator ?.
Browse files Browse the repository at this point in the history
  • Loading branch information
darrelfrancis authored Apr 15, 2023
1 parent e33e578 commit fd58aeb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/attachCustomCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ export default function attachCustomCommands(
* @name cy.login
*/
Cypress.Commands.add(
options?.commandNames?.login || 'login',
options && options.commandNames && options.commandNames.login || 'login',
(
uid?: string,
customClaims?: any,
Expand Down Expand Up @@ -379,7 +379,7 @@ export default function attachCustomCommands(
* cy.logout()
*/
Cypress.Commands.add(
options?.commandNames?.logout || 'logout',
options && options.commandNames && options.commandNames.logout || 'logout',
(
tenantId: string | undefined = Cypress.env('TEST_TENANT_ID'),
): Promise<any> =>
Expand Down Expand Up @@ -408,7 +408,7 @@ export default function attachCustomCommands(
* @name cy.callRtdb
*/
Cypress.Commands.add(
options?.commandNames?.callRtdb || 'callRtdb',
options && options.commandNames && options.commandNames.callRtdb || 'callRtdb',
(
action: RTDBAction,
actionPath: string,
Expand All @@ -426,7 +426,7 @@ export default function attachCustomCommands(
const dataToWrite = dataIsObject ? { ...dataOrOptions } : dataOrOptions;

// Add metadata to dataToWrite if specified by options
if (dataIsObject && options?.withMeta) {
if (dataIsObject && options && options.withMeta) {
if (!dataToWrite.createdBy && Cypress.env('TEST_UID')) {
dataToWrite.createdBy = Cypress.env('TEST_UID');
}
Expand Down Expand Up @@ -456,7 +456,7 @@ export default function attachCustomCommands(
* @name cy.callFirestore
*/
Cypress.Commands.add(
options?.commandNames?.callFirestore || 'callFirestore',
options && options.commandName && options.commandNames.callFirestore || 'callFirestore',
(
action: FirestoreAction,
actionPath: string,
Expand All @@ -474,7 +474,7 @@ export default function attachCustomCommands(
const dataToWrite = dataIsObject ? { ...dataOrOptions } : dataOrOptions;

// Add metadata to dataToWrite if specified by options
if (dataIsObject && options?.withMeta) {
if (dataIsObject && options && options.withMeta) {
if (!dataToWrite.createdBy) {
dataToWrite.createdBy = Cypress.env('TEST_UID');
}
Expand Down Expand Up @@ -503,7 +503,7 @@ export default function attachCustomCommands(
* cy.getAuthUser()
*/
Cypress.Commands.add(
options?.commandNames?.getAuthUser || 'getAuthUser',
options && options.commandName && options.commandNames.getAuthUser || 'getAuthUser',
(uid: string): Promise<any> => cy.task('getAuthUser', uid),
);
}

0 comments on commit fd58aeb

Please sign in to comment.