diff --git a/autoadmin-ws-server/src/constants/constants.js b/autoadmin-ws-server/src/constants/constants.js index e6796e37..864402a8 100644 --- a/autoadmin-ws-server/src/constants/constants.js +++ b/autoadmin-ws-server/src/constants/constants.js @@ -19,7 +19,7 @@ export const CONSTANTS = Object.freeze({ RES_CACHE_OPTIONS: { max: 5000, - dispose: function(key, n) { + dispose: (_key, n) => { n?.send('Connection was closed by timeout'); }, maxAge: 600000, diff --git a/autoadmin-ws-server/src/index.js b/autoadmin-ws-server/src/index.js index 6c296eba..aa5c75b8 100644 --- a/autoadmin-ws-server/src/index.js +++ b/autoadmin-ws-server/src/index.js @@ -3,12 +3,12 @@ import axios from 'axios'; const app = express(); import { createServer } from 'http'; const httpServer = createServer(app); -const wsServer = createServer((req, res) => { +const wsServer = createServer((_req, res) => { res.writeHead(200); res.end(); }); import WebSocket, { WebSocketServer } from 'ws'; -const router = Router(); +const _router = Router(); import commandRoute from './routes/command.js'; import { getCacheWsConnection, @@ -29,7 +29,7 @@ const tokenCacheResult = new LRUCache(CONSTANTS.TOKEN_RESULT_CACHE_OPTIONS); app.use(json()); -app.get('/', (req, res) => { +app.get('/', (_req, res) => { res.json({ status: CONSTANTS.API_IS_RUNNING }); }); @@ -42,7 +42,7 @@ wsServer.listen(wsPort, () => { const ws = new WebSocketServer({ server: wsServer }); ws.on('connection', (connection, req) => { - const ip = req.socket.remoteAddress; + const _ip = req.socket.remoteAddress; // console.log(`Connected ${ip}`); connection.on('message', async (message) => { diff --git a/backend/src/app.module.ts b/backend/src/app.module.ts index 5f8ca63e..91c83bf5 100644 --- a/backend/src/app.module.ts +++ b/backend/src/app.module.ts @@ -1,7 +1,6 @@ import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; import { APP_GUARD, APP_INTERCEPTOR } from '@nestjs/core'; import { ScheduleModule } from '@nestjs/schedule'; -import { DataSource } from 'typeorm'; import { AppController } from './app.controller.js'; import { GlobalDatabaseContext } from './common/application/global-database-context.js'; import { BaseType, UseCaseType } from './common/data-injection.tokens.js'; @@ -107,7 +106,6 @@ import { SignInAuditModule } from './entities/user-sign-in-audit/sign-in-audit.m ], }) export class ApplicationModule implements NestModule { - constructor(private dataSource: DataSource) {} configure(consumer: MiddlewareConsumer): void { consumer.apply(AppLoggerMiddleware).forRoutes('*'); } diff --git a/backend/src/authorization/auth-with-api.middleware.ts b/backend/src/authorization/auth-with-api.middleware.ts index 38307be3..c716db40 100644 --- a/backend/src/authorization/auth-with-api.middleware.ts +++ b/backend/src/authorization/auth-with-api.middleware.ts @@ -19,6 +19,7 @@ import jwt from 'jsonwebtoken'; import Sentry from '@sentry/minimal'; import { Encryptor } from '../helpers/encryption/encryptor.js'; import { EncryptionAlgorithmEnum } from '../enums/encryption-algorithm.enum.js'; +import { IRequestWithCognitoInfo } from './cognito-decoded.interface.js'; @Injectable() export class AuthWithApiMiddleware implements NestMiddleware { @@ -27,7 +28,7 @@ export class AuthWithApiMiddleware implements NestMiddleware { private readonly userRepository: Repository, ) {} - async use(req: Request, res: Response, next: (err?: any, res?: any) => void): Promise { + async use(req: IRequestWithCognitoInfo, _res: Response, next: (err?: any, res?: any) => void): Promise { try { await this.authenticateRequest(req); next(); @@ -37,7 +38,7 @@ export class AuthWithApiMiddleware implements NestMiddleware { } } - private async authenticateRequest(req: Request): Promise { + private async authenticateRequest(req: IRequestWithCognitoInfo): Promise { const tokenFromCookie = this.getTokenFromCookie(req); if (tokenFromCookie) { await this.authenticateWithToken(tokenFromCookie, req); @@ -57,15 +58,15 @@ export class AuthWithApiMiddleware implements NestMiddleware { throw new InternalServerErrorException(Messages.AUTHORIZATION_REJECTED); } - private async authenticateWithToken(tokenFromCookie: string, req: Request): Promise { + private async authenticateWithToken(tokenFromCookie: string, req: IRequestWithCognitoInfo): Promise { try { const jwtSecret = process.env.JWT_SECRET; - const data = jwt.verify(tokenFromCookie, jwtSecret); - const userId = data['id']; + const data = jwt.verify(tokenFromCookie, jwtSecret) as jwt.JwtPayload; + const userId = data.id; if (!userId) { throw new UnauthorizedException('JWT verification failed'); } - const addedScope: Array = data['scope']; + const addedScope: Array = data.scope; if (addedScope && addedScope.length > 0) { if (addedScope.includes(JwtScopesEnum.TWO_FA_ENABLE)) { throw new BadRequestException(Messages.TWO_FA_REQUIRED); @@ -74,21 +75,21 @@ export class AuthWithApiMiddleware implements NestMiddleware { const payload = { sub: userId, - email: data['email'], - exp: data['exp'], - iat: data['iat'], + email: data.email, + exp: data.exp, + iat: data.iat, }; if (!payload || isObjectEmpty(payload)) { throw new UnauthorizedException('JWT verification failed'); } - req['decoded'] = payload; + req.decoded = payload; } catch (error) { Sentry.captureException(error); throw error; } } - private async authenticateWithApiKey(req: Request): Promise { + private async authenticateWithApiKey(req: IRequestWithCognitoInfo): Promise { let apiKey = req.headers?.['x-api-key']; if (Array.isArray(apiKey)) { apiKey = apiKey[0]; @@ -106,7 +107,7 @@ export class AuthWithApiMiddleware implements NestMiddleware { if (!foundUserByApiKey) { throw new NotFoundException(Messages.NO_AUTH_KEYS_FOUND); } - req['decoded'] = { + req.decoded = { sub: foundUserByApiKey.id, email: foundUserByApiKey.email, }; diff --git a/backend/src/authorization/auth.middleware.ts b/backend/src/authorization/auth.middleware.ts index 6ef58f50..b671a924 100644 --- a/backend/src/authorization/auth.middleware.ts +++ b/backend/src/authorization/auth.middleware.ts @@ -7,7 +7,7 @@ import { UnauthorizedException, } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; -import { Request, Response } from 'express'; +import { Response } from 'express'; import jwt from 'jsonwebtoken'; import { Repository } from 'typeorm'; import { LogOutEntity } from '../entities/log-out/log-out.entity.js'; @@ -17,16 +17,16 @@ import { isObjectEmpty } from '../helpers/index.js'; import { Constants } from '../helpers/constants/constants.js'; import Sentry from '@sentry/minimal'; import { JwtScopesEnum } from '../entities/user/enums/jwt-scopes.enum.js'; +import { IRequestWithCognitoInfo } from './cognito-decoded.interface.js'; @Injectable() export class AuthMiddleware implements NestMiddleware { public constructor( - @InjectRepository(UserEntity) - private readonly userRepository: Repository, + @InjectRepository(UserEntity)readonly _userRepository: Repository, @InjectRepository(LogOutEntity) private readonly logOutRepository: Repository, ) {} - async use(req: Request, res: Response, next: (err?: any, res?: any) => void): Promise { + async use(req: IRequestWithCognitoInfo, _res: Response, next: (err?: any, res?: any) => void): Promise { let token: string; try { token = req.cookies[Constants.JWT_COOKIE_KEY_NAME]; @@ -47,12 +47,12 @@ export class AuthMiddleware implements NestMiddleware { try { const jwtSecret = process.env.JWT_SECRET; - const data = jwt.verify(token, jwtSecret); - const userId = data['id']; + const data = jwt.verify(token, jwtSecret) as jwt.JwtPayload; + const userId = data.id; if (!userId) { throw new UnauthorizedException('JWT verification failed'); } - const addedScope: Array = data['scope']; + const addedScope: Array = data.scope; if (addedScope && addedScope.length > 0) { if (addedScope.includes(JwtScopesEnum.TWO_FA_ENABLE)) { throw new BadRequestException(Messages.TWO_FA_REQUIRED); @@ -61,14 +61,14 @@ export class AuthMiddleware implements NestMiddleware { const payload = { sub: userId, - email: data['email'], - exp: data['exp'], - iat: data['iat'], + email: data.email, + exp: data.exp, + iat: data.iat, }; if (!payload || isObjectEmpty(payload)) { throw new UnauthorizedException('JWT verification failed'); } - req['decoded'] = payload; + req.decoded = payload; next(); } catch (e) { Sentry.captureException(e); diff --git a/backend/src/authorization/basic-auth.middleware.ts b/backend/src/authorization/basic-auth.middleware.ts index a2f904b7..fe5804ae 100644 --- a/backend/src/authorization/basic-auth.middleware.ts +++ b/backend/src/authorization/basic-auth.middleware.ts @@ -5,7 +5,7 @@ import { Messages } from '../exceptions/text/messages.js'; @Injectable() export class BasicAuthMiddleware implements NestMiddleware { - use(req: Request, res: Response, next: (err?: any, res?: any) => void): void { + use(req: Request, _res: Response, next: (err?: any, res?: any) => void): void { const basicAuthLogin = process.env.BASIC_AUTH_LOGIN; const basicAuthPassword = process.env.BASIC_AUTH_PWD; const userCredentials = auth(req); diff --git a/backend/src/authorization/cognito-decoded.interface.ts b/backend/src/authorization/cognito-decoded.interface.ts index 55cbd6d0..926870a8 100644 --- a/backend/src/authorization/cognito-decoded.interface.ts +++ b/backend/src/authorization/cognito-decoded.interface.ts @@ -1,7 +1,8 @@ +import type { Request } from 'express'; export interface ICognitoDecodedData { at_hash: string; sub: string; - aud: string; + aud: string | string[]; email_verified: boolean; event_id: string; token_use: string; @@ -15,6 +16,6 @@ export interface ICognitoDecodedData { export interface IRequestWithCognitoInfo extends Request { query: any; - decoded: ICognitoDecodedData; + decoded: Partial; params: any; } diff --git a/backend/src/authorization/non-scoped-auth.middleware.ts b/backend/src/authorization/non-scoped-auth.middleware.ts index 4fbe34c6..0b5c9a4c 100644 --- a/backend/src/authorization/non-scoped-auth.middleware.ts +++ b/backend/src/authorization/non-scoped-auth.middleware.ts @@ -6,7 +6,7 @@ import { UnauthorizedException, } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; -import { Request, Response } from 'express'; +import { Response } from 'express'; import jwt from 'jsonwebtoken'; import { Repository } from 'typeorm'; import { LogOutEntity } from '../entities/log-out/log-out.entity.js'; @@ -14,6 +14,7 @@ import { Messages } from '../exceptions/text/messages.js'; import { isObjectEmpty } from '../helpers/index.js'; import { Constants } from '../helpers/constants/constants.js'; import Sentry from '@sentry/minimal'; +import { IRequestWithCognitoInfo } from './cognito-decoded.interface.js'; @Injectable() export class NonScopedAuthMiddleware implements NestMiddleware { @@ -21,7 +22,7 @@ export class NonScopedAuthMiddleware implements NestMiddleware { @InjectRepository(LogOutEntity) private readonly logOutRepository: Repository, ) {} - async use(req: Request, res: Response, next: (err?: any, res?: any) => void): Promise { + async use(req: IRequestWithCognitoInfo, _res: Response, next: (err?: any, res?: any) => void): Promise { console.log(`auth middleware triggered ->: ${new Date().toISOString()}`); let token: string; try { @@ -43,22 +44,22 @@ export class NonScopedAuthMiddleware implements NestMiddleware { try { const jwtSecret = process.env.JWT_SECRET; - const data = jwt.verify(token, jwtSecret); - const userId = data['id']; + const data = jwt.verify(token, jwtSecret) as jwt.JwtPayload; + const userId = data.id; if (!userId) { throw new UnauthorizedException('JWT verification failed'); } const payload = { sub: userId, - email: data['email'], - exp: data['exp'], - iat: data['iat'], + email: data.email, + exp: data.exp, + iat: data.iat, }; if (!payload || isObjectEmpty(payload)) { throw new UnauthorizedException('JWT verification failed'); } - req['decoded'] = payload; + req.decoded = payload; next(); } catch (e) { Sentry.captureException(e); diff --git a/backend/src/authorization/saas-auth.middleware.ts b/backend/src/authorization/saas-auth.middleware.ts index 7418721d..6cd2a1fb 100644 --- a/backend/src/authorization/saas-auth.middleware.ts +++ b/backend/src/authorization/saas-auth.middleware.ts @@ -1,12 +1,13 @@ import { Injectable, NestMiddleware, UnauthorizedException } from '@nestjs/common'; -import { Request, Response } from 'express'; +import { Response } from 'express'; import jwt from 'jsonwebtoken'; import { Messages } from '../exceptions/text/messages.js'; import { extractTokenFromHeader } from './utils/extract-token-from-header.js'; +import { IRequestWithCognitoInfo } from './cognito-decoded.interface.js'; @Injectable() export class SaaSAuthMiddleware implements NestMiddleware { - use(req: Request, res: Response, next: (err?: any, res?: any) => void): void { + use(req: IRequestWithCognitoInfo, _res: Response, next: (err?: any, res?: any) => void): void { console.log(`saas auth middleware triggered ->: ${new Date().toISOString()}`); const token = extractTokenFromHeader(req); if (!token) { @@ -14,14 +15,14 @@ export class SaaSAuthMiddleware implements NestMiddleware { } try { const jwtSecret = process.env.MICROSERVICE_JWT_SECRET; - const data = jwt.verify(token, jwtSecret); - const requestId = data['request_id']; + const data = jwt.verify(token, jwtSecret) as jwt.JwtPayload; + const requestId = data.request_id; if (!requestId) { throw new UnauthorizedException(Messages.AUTHORIZATION_REJECTED); } - req['decoded'] = data; + req.decoded = data; next(); } catch (_e) { throw new UnauthorizedException(Messages.AUTHORIZATION_REJECTED); diff --git a/backend/src/authorization/temporary-auth.middleware.ts b/backend/src/authorization/temporary-auth.middleware.ts index 7e78e73e..8b60cbb1 100644 --- a/backend/src/authorization/temporary-auth.middleware.ts +++ b/backend/src/authorization/temporary-auth.middleware.ts @@ -6,7 +6,7 @@ import { UnauthorizedException, } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; -import { Request, Response } from 'express'; +import { Response } from 'express'; import jwt from 'jsonwebtoken'; import { Repository } from 'typeorm'; import { LogOutEntity } from '../entities/log-out/log-out.entity.js'; @@ -15,16 +15,16 @@ import { Messages } from '../exceptions/text/messages.js'; import { isObjectEmpty } from '../helpers/index.js'; import Sentry from '@sentry/minimal'; import { Constants } from '../helpers/constants/constants.js'; +import { IRequestWithCognitoInfo } from './cognito-decoded.interface.js'; @Injectable() export class TemporaryAuthMiddleware implements NestMiddleware { public constructor( - @InjectRepository(UserEntity) - private readonly userRepository: Repository, + @InjectRepository(UserEntity)readonly _userRepository: Repository, @InjectRepository(LogOutEntity) private readonly logOutRepository: Repository, ) {} - async use(req: Request, res: Response, next: (err?: any, res?: any) => void): Promise { + async use(req: IRequestWithCognitoInfo, _res: Response, next: (err?: any, res?: any) => void): Promise { console.log(`temporary auth middleware triggered ->: ${new Date().toISOString()}`); let token: string; try { @@ -46,21 +46,21 @@ export class TemporaryAuthMiddleware implements NestMiddleware { try { const jwtSecret = process.env.TEMPORARY_JWT_SECRET; - const data = jwt.verify(token, jwtSecret); - const userId = data['id']; + const data = jwt.verify(token, jwtSecret) as jwt.JwtPayload; + const userId = data.id; if (!userId) { throw new UnauthorizedException('JWT verification failed'); } const payload = { sub: userId, - email: data['email'], - exp: data['exp'], - iat: data['iat'], + email: data.email, + exp: data.exp, + iat: data.iat, }; if (!payload || isObjectEmpty(payload)) { throw new UnauthorizedException('JWT verification failed'); } - req['decoded'] = payload; + req.decoded = payload; next(); } catch (e) { Sentry.captureException(e); diff --git a/backend/src/common/application/global-database-context.ts b/backend/src/common/application/global-database-context.ts index 5e202076..73d770c6 100644 --- a/backend/src/common/application/global-database-context.ts +++ b/backend/src/common/application/global-database-context.ts @@ -391,11 +391,7 @@ export class GlobalDatabaseContext implements IGlobalDatabaseContext { public async commitTransaction(): Promise { if (!this._queryRunner) return; - try { await this._queryRunner.commitTransaction(); - } catch (e) { - throw e; - } } public async rollbackTransaction(): Promise { diff --git a/backend/src/decorators/body-email.decorator.ts b/backend/src/decorators/body-email.decorator.ts index 773044d4..1575e377 100644 --- a/backend/src/decorators/body-email.decorator.ts +++ b/backend/src/decorators/body-email.decorator.ts @@ -4,11 +4,11 @@ import { Messages } from '../exceptions/text/messages.js'; import { ValidationHelper } from '../helpers/validators/validation-helper.js'; import { isObjectPropertyExists } from '../helpers/validators/is-object-property-exists-validator.js'; -export const BodyEmail = createParamDecorator((data: any, ctx: ExecutionContext): string => { +export const BodyEmail = createParamDecorator((_data: any, ctx: ExecutionContext): string => { const request: IRequestWithCognitoInfo = ctx.switchToHttp().getRequest(); const body = request.body; if (isObjectPropertyExists(body, 'email')) { - const email = body['email']; + const email = body.email; if (ValidationHelper.isValidEmail(email)) { return email; } diff --git a/backend/src/decorators/gclid-decorator.ts b/backend/src/decorators/gclid-decorator.ts index 6a4ad439..abfab180 100644 --- a/backend/src/decorators/gclid-decorator.ts +++ b/backend/src/decorators/gclid-decorator.ts @@ -1,14 +1,10 @@ import { createParamDecorator, ExecutionContext } from '@nestjs/common'; import { IRequestWithCognitoInfo } from '../authorization/index.js'; -export const GCLlId = createParamDecorator((data: any, ctx: ExecutionContext): string => { +export const GCLlId = createParamDecorator((_data: any, ctx: ExecutionContext): string => { const request: IRequestWithCognitoInfo = ctx.switchToHttp().getRequest(); if (request.headers) { - return request.headers['GCLID'] - ? request.headers['GCLID'] - : request.headers['gclid'] - ? request.headers['gclid'] - : null; + return request.headers.gclid as string | undefined ?? null; } return null; }); diff --git a/backend/src/decorators/master-password.decorator.ts b/backend/src/decorators/master-password.decorator.ts index 3831b840..0660bef5 100644 --- a/backend/src/decorators/master-password.decorator.ts +++ b/backend/src/decorators/master-password.decorator.ts @@ -1,8 +1,8 @@ import { createParamDecorator, ExecutionContext } from '@nestjs/common'; import { IRequestWithCognitoInfo } from '../authorization/index.js'; -export const MasterPassword = createParamDecorator((data: any, ctx: ExecutionContext): string => { +export const MasterPassword = createParamDecorator((_data: any, ctx: ExecutionContext): string => { const request: IRequestWithCognitoInfo = ctx.switchToHttp().getRequest(); - const masterPwd = request.headers['masterpwd']; + const masterPwd = request.headers.masterpwd as string | undefined; return masterPwd ? masterPwd : null; }); diff --git a/backend/src/decorators/query-table-name.decorator.ts b/backend/src/decorators/query-table-name.decorator.ts index 12f9806e..69c76f24 100644 --- a/backend/src/decorators/query-table-name.decorator.ts +++ b/backend/src/decorators/query-table-name.decorator.ts @@ -3,11 +3,11 @@ import { IRequestWithCognitoInfo } from '../authorization/index.js'; import { Messages } from '../exceptions/text/messages.js'; import { isObjectPropertyExists } from '../helpers/validators/is-object-property-exists-validator.js'; -export const QueryTableName = createParamDecorator((data: unknown, ctx: ExecutionContext): string => { +export const QueryTableName = createParamDecorator((_data: unknown, ctx: ExecutionContext): string => { const request: IRequestWithCognitoInfo = ctx.switchToHttp().getRequest(); const query = request.query; - if (isObjectPropertyExists(query, 'tableName') && query['tableName'].length > 0) { - return query['tableName']; + if (isObjectPropertyExists(query, 'tableName') && query.tableName.length > 0) { + return query.tableName; } throw new BadRequestException(Messages.TABLE_NAME_MISSING); }); diff --git a/backend/src/decorators/user-id.decorator.ts b/backend/src/decorators/user-id.decorator.ts index 6b2d9adf..11178628 100644 --- a/backend/src/decorators/user-id.decorator.ts +++ b/backend/src/decorators/user-id.decorator.ts @@ -3,7 +3,7 @@ import { IRequestWithCognitoInfo } from '../authorization/index.js'; import { Messages } from '../exceptions/text/messages.js'; import { ValidationHelper } from '../helpers/validators/validation-helper.js'; -export const UserId = createParamDecorator((data: any, ctx: ExecutionContext): string => { +export const UserId = createParamDecorator((_data: any, ctx: ExecutionContext): string => { const request: IRequestWithCognitoInfo = ctx.switchToHttp().getRequest(); const userId = request.decoded?.sub; if (!userId) { diff --git a/backend/src/entities/amplitude/amplitude.service.ts b/backend/src/entities/amplitude/amplitude.service.ts index a4435946..b9c1c358 100644 --- a/backend/src/entities/amplitude/amplitude.service.ts +++ b/backend/src/entities/amplitude/amplitude.service.ts @@ -19,7 +19,7 @@ export class AmplitudeService { if (!user_email && options) { user_email = options?.user_email; } - let event_properties = undefined; + let event_properties ; if (user_email) { event_properties = { user_properties: { diff --git a/backend/src/entities/api-key/api-key.entity.ts b/backend/src/entities/api-key/api-key.entity.ts index 78141b5e..259152ee 100644 --- a/backend/src/entities/api-key/api-key.entity.ts +++ b/backend/src/entities/api-key/api-key.entity.ts @@ -15,7 +15,7 @@ export class UserApiKeyEntity { @Column({ type: 'varchar', unique: true, nullable: false }) hash: string; - @ManyToOne((type) => UserEntity, (user) => user.api_keys, { onDelete: 'CASCADE' }) + @ManyToOne((_type) => UserEntity, (user) => user.api_keys, { onDelete: 'CASCADE' }) @JoinColumn() user: Relation; diff --git a/backend/src/entities/company-info/use-cases/invite-user-in-company.use.case.ts b/backend/src/entities/company-info/use-cases/invite-user-in-company.use.case.ts index 907b6393..221a46ef 100644 --- a/backend/src/entities/company-info/use-cases/invite-user-in-company.use.case.ts +++ b/backend/src/entities/company-info/use-cases/invite-user-in-company.use.case.ts @@ -61,7 +61,7 @@ export class InviteUserInCompanyAndConnectionGroupUseCase companyId, ); - if (foundInvitedUser && foundInvitedUser.isActive) { + if (foundInvitedUser?.isActive) { throw new HttpException( { message: Messages.USER_ALREADY_ADDED_IN_COMPANY, diff --git a/backend/src/entities/company-info/use-cases/verify-invite-user-in-company.use.case.ts b/backend/src/entities/company-info/use-cases/verify-invite-user-in-company.use.case.ts index 2ebfc21e..8c06c4e6 100644 --- a/backend/src/entities/company-info/use-cases/verify-invite-user-in-company.use.case.ts +++ b/backend/src/entities/company-info/use-cases/verify-invite-user-in-company.use.case.ts @@ -43,7 +43,7 @@ export class VerifyInviteUserInCompanyAndConnectionGroupUseCase } = foundInvitation; const invitedUserEmail = foundInvitation.invitedUserEmail.toLowerCase(); const foundUser = users.find((user) => user.email === invitedUserEmail); - if (foundUser && foundUser.isActive) { + if (foundUser?.isActive) { throw new HttpException( { message: Messages.USER_ALREADY_ADDED_IN_COMPANY, diff --git a/backend/src/entities/connection-properties/utils/validate-create-connection-properties-ds.ts b/backend/src/entities/connection-properties/utils/validate-create-connection-properties-ds.ts index 59c3f624..af6e95fa 100644 --- a/backend/src/entities/connection-properties/utils/validate-create-connection-properties-ds.ts +++ b/backend/src/entities/connection-properties/utils/validate-create-connection-properties-ds.ts @@ -34,13 +34,13 @@ export async function validateCreateConnectionPropertiesDs( } if (table_categories && table_categories.length > 0) { - const tablesInCategories = table_categories.map((category) => category.tables).flat(); + const tablesInCategories = table_categories.flatMap((category) => category.tables); const uniqueTablesInCategories = Array.from(new Set(tablesInCategories)); for (const table of uniqueTablesInCategories) { if (!tablesInConnection.includes(table)) { errors.push(Messages.TABLE_WITH_NAME_NOT_EXISTS(table)); } - if (hidden_tables && hidden_tables.includes(table)) { + if (hidden_tables?.includes(table)) { errors.push(Messages.CANT_CATEGORIZE_HIDDEN_TABLE(table)); } } diff --git a/backend/src/entities/connection/connection.controller.ts b/backend/src/entities/connection/connection.controller.ts index b98a0048..6d2415a1 100644 --- a/backend/src/entities/connection/connection.controller.ts +++ b/backend/src/entities/connection/connection.controller.ts @@ -160,8 +160,6 @@ export class ConnectionController { ): Promise> { try { return await this.findAllUsersInConnectionUseCase.execute(connectionId, InTransactionEnum.OFF); - } catch (e) { - throw e; } finally { const isConnectionTest = await this._dbContext.connectionRepository.isTestConnectionById(connectionId); await this.amplitudeService.formAndSendLogRecord( @@ -217,8 +215,6 @@ export class ConnectionController { }; foundConnection = await this.findOneConnectionUseCase.execute(findOneConnectionInput, InTransactionEnum.OFF); return foundConnection; - } catch (e) { - throw e; } finally { if (foundConnection?.connection) { const isTest = await this._dbContext.connectionRepository.isTestConnectionById(connectionId); diff --git a/backend/src/entities/connection/ssl-certificate/read-certificate.ts b/backend/src/entities/connection/ssl-certificate/read-certificate.ts index 919f73e6..1eaf462e 100644 --- a/backend/src/entities/connection/ssl-certificate/read-certificate.ts +++ b/backend/src/entities/connection/ssl-certificate/read-certificate.ts @@ -11,7 +11,7 @@ export async function readSslCertificate(): Promise { fs.readFile( join(__dirname, '..', '..', '..', '..', '..', 'files', 'certificates', fileName), 'utf8', - function (err, data) { + (err, data) => { if (err) { reject(err); } diff --git a/backend/src/entities/connection/use-cases/create-connection.use.case.ts b/backend/src/entities/connection/use-cases/create-connection.use.case.ts index 0f7e7e34..72c9bb19 100644 --- a/backend/src/entities/connection/use-cases/create-connection.use.case.ts +++ b/backend/src/entities/connection/use-cases/create-connection.use.case.ts @@ -111,8 +111,6 @@ export class CreateConnectionUseCase ); const connectionRO = buildCreatedConnectionDs(savedConnection, token, masterPwd); return connectionRO; - } catch (e) { - throw e; } finally { if (isConnectionTestedSuccessfully && !isConnectionTypeAgent(connectionCopy.type)) { await this.sharedJobsService.scanDatabaseAndCreateWidgets(connectionCopy); diff --git a/backend/src/entities/convention/use-cases/get-conversions-use-cases.interface.ts b/backend/src/entities/convention/use-cases/get-conversions-use-cases.interface.ts index 904e0818..b1bd0eb4 100644 --- a/backend/src/entities/convention/use-cases/get-conversions-use-cases.interface.ts +++ b/backend/src/entities/convention/use-cases/get-conversions-use-cases.interface.ts @@ -1,5 +1,5 @@ import { InTransactionEnum } from '../../../enums/index.js'; export interface IGetConversions { - execute(inputData: void, inTransaction: InTransactionEnum): Promise; + execute(inputData: undefined, inTransaction: InTransactionEnum): Promise; } diff --git a/backend/src/entities/convention/use-cases/get-conversions.use.case.ts b/backend/src/entities/convention/use-cases/get-conversions.use.case.ts index a867839a..31141b9d 100644 --- a/backend/src/entities/convention/use-cases/get-conversions.use.case.ts +++ b/backend/src/entities/convention/use-cases/get-conversions.use.case.ts @@ -22,17 +22,17 @@ export class GetConversionsUseCase extends AbstractUseCase impleme for (const user of freshUsers) { conversionsArray.push({ - ['Google Click ID']: user.gclid, - ['Conversion Name']: 'Registration', - ['Conversion Time']: user.createdAt, + "Google Click ID": user.gclid, + "Conversion Name": 'Registration', + "Conversion Time": user.createdAt, }); } for (const connection of workedFreshConnections) { conversionsArray.push({ - ['Google Click ID']: connection.author.gclid, - ['Conversion Name']: 'Connection added', - ['Conversion Time']: connection.createdAt, + "Google Click ID": connection.author.gclid, + "Conversion Name": 'Connection added', + "Conversion Time": connection.createdAt, }); } diff --git a/backend/src/entities/custom-field/utils/validate-create-custom-field-dto.ts b/backend/src/entities/custom-field/utils/validate-create-custom-field-dto.ts index 25364fa3..1f670394 100644 --- a/backend/src/entities/custom-field/utils/validate-create-custom-field-dto.ts +++ b/backend/src/entities/custom-field/utils/validate-create-custom-field-dto.ts @@ -9,7 +9,7 @@ import { getDataAccessObject } from '@rocketadmin/shared-code/dist/src/data-acce export async function validateCreateCustomFieldDto( createFieldDto: CreateFieldDto, connection: ConnectionEntity, - userId: string, + _userId: string, tableName: string, ): Promise { const errors = []; @@ -21,7 +21,7 @@ export async function validateCreateCustomFieldDto( const tableFieldsFromTemplate = getValuesBetweenCurlies(template_string); const dao = getDataAccessObject(connection); const tablesInConnection: Array = (await dao.getTablesFromDB()).map((table) => table.tableName); - const tableIndexInTables = tablesInConnection.findIndex((table_name) => table_name === tableName); + const tableIndexInTables = tablesInConnection.indexOf(tableName); if (tableIndexInTables < 0) { throw new HttpException( { diff --git a/backend/src/entities/email/email-config/email-config.service.ts b/backend/src/entities/email/email-config/email-config.service.ts index 93bd9a99..8b7bc986 100644 --- a/backend/src/entities/email/email-config/email-config.service.ts +++ b/backend/src/entities/email/email-config/email-config.service.ts @@ -9,7 +9,7 @@ export class EmailConfigService implements IEmailConfigService { return pullConfig; } const emailServiceHost = process.env.EMAIL_SERVICE_HOST; - const emailServicePort = parseInt(process.env.EMAIL_SERVICE_PORT) || 25; + const emailServicePort = parseInt(process.env.EMAIL_SERVICE_PORT, 10) || 25; const emailServiceUserName = process.env.EMAIL_SERVICE_USERNAME; const emailServicePassword = process.env.EMAIL_SERVICE_PASSWORD; const nonSecure = !process.env.NON_SSL_EMAIL; diff --git a/backend/src/entities/email/email-messages/email-message.ts b/backend/src/entities/email/email-messages/email-message.ts index d6405025..86996453 100644 --- a/backend/src/entities/email/email-messages/email-message.ts +++ b/backend/src/entities/email/email-messages/email-message.ts @@ -3,9 +3,6 @@ import { IEmailMessage } from './email-message.interface.js'; import { IMessage } from '../email/email.interface.js'; export class EmailLetter extends AbstractEmailLetter { - constructor(params: IEmailMessage) { - super(params); - } getEmail(): IMessage { return { diff --git a/backend/src/entities/email/email/abstract-email-letter.ts b/backend/src/entities/email/email/abstract-email-letter.ts index fbfe6b0e..7d3715cc 100644 --- a/backend/src/entities/email/email/abstract-email-letter.ts +++ b/backend/src/entities/email/email/abstract-email-letter.ts @@ -4,7 +4,7 @@ import { IMessage } from './email.interface.js'; export abstract class AbstractEmailLetter { protected readonly _params: TParams; - protected constructor(params: TParams) { + constructor(params: TParams) { this._params = params; } diff --git a/backend/src/entities/email/email/email.service.ts b/backend/src/entities/email/email/email.service.ts index 02154bc6..a403fe94 100644 --- a/backend/src/entities/email/email/email.service.ts +++ b/backend/src/entities/email/email/email.service.ts @@ -82,7 +82,7 @@ export class EmailService { public async sendRemindersToUsers(userEmails: Array): Promise> { const queue = new PQueue({ concurrency: 3 }); - const mailingResults: Array = []; + const mailingResults: Array = []; for (const email of userEmails) { try { @@ -105,11 +105,11 @@ export class EmailService { public async send2faEnabledInCompany( userEmails: Array, companyName: string, - ): Promise> { + ): Promise> { try { const queue = new PQueue({ concurrency: 3 }); - const mailingResults: Array = await Promise.all( + const mailingResults: Array = await Promise.all( userEmails.map(async (email: string) => { return await queue.add(async () => { return await this.send2faEnabledInCompanyToUser(email, companyName); @@ -285,7 +285,7 @@ export class EmailService { } private buildMailingResults( - results: Array, + results: Array, ): Array { return results.map((result) => { if (!result) { diff --git a/backend/src/entities/group/group.controller.ts b/backend/src/entities/group/group.controller.ts index 0951af28..003b8174 100644 --- a/backend/src/entities/group/group.controller.ts +++ b/backend/src/entities/group/group.controller.ts @@ -70,8 +70,6 @@ export class GroupController { async findAll(@UserId() userId: string): Promise { try { return await this.findAllUserGroupsUseCase.execute(userId, InTransactionEnum.OFF); - } catch (e) { - throw e; } finally { await this.amplitudeService.formAndSendLogRecord(AmplitudeEventTypeEnum.groupListReceived, userId); } @@ -91,8 +89,6 @@ export class GroupController { ): Promise> { try { return this.findAllUsersInGroupUseCase.execute(groupId, InTransactionEnum.OFF); - } catch (e) { - throw e; } finally { await this.amplitudeService.formAndSendLogRecord(AmplitudeEventTypeEnum.groupUserListReceived, userId); } @@ -128,8 +124,6 @@ export class GroupController { }; try { return await this.addUserInGroupUseCase.execute(inputData, InTransactionEnum.ON); - } catch (e) { - throw e; } finally { await this.amplitudeService.formAndSendLogRecord(AmplitudeEventTypeEnum.groupUserAdded, groupId); } @@ -146,8 +140,6 @@ export class GroupController { async delete(@SlugUuid('groupId') groupId: string, @UserId() userId: string): Promise { try { return this.deleteGroupUseCase.execute(groupId, InTransactionEnum.ON); - } catch (e) { - throw e; } finally { await this.amplitudeService.formAndSendLogRecord(AmplitudeEventTypeEnum.groupDeleted, userId); } @@ -173,8 +165,6 @@ export class GroupController { }; try { return await this.removeUserFromGroupUseCase.execute(inputData, InTransactionEnum.ON); - } catch (e) { - throw e; } finally { await this.amplitudeService.formAndSendLogRecord(AmplitudeEventTypeEnum.groupUserRemoved, userId); } diff --git a/backend/src/entities/group/use-cases/remove-user-from-group.use.case.ts b/backend/src/entities/group/use-cases/remove-user-from-group.use.case.ts index d7be2bea..98fa56c7 100644 --- a/backend/src/entities/group/use-cases/remove-user-from-group.use.case.ts +++ b/backend/src/entities/group/use-cases/remove-user-from-group.use.case.ts @@ -43,9 +43,7 @@ export class RemoveUserFromGroupUseCase } const usersArray = groupToUpdate.users; const delIndex = usersArray - .map(function (e) { - return e.id; - }) + .map((e) => e.id) .indexOf(foundUser.id); if (delIndex === -1) { throw new HttpException( diff --git a/backend/src/entities/shared-jobs/shared-jobs.service.ts b/backend/src/entities/shared-jobs/shared-jobs.service.ts index 547d7d5f..217e70ae 100644 --- a/backend/src/entities/shared-jobs/shared-jobs.service.ts +++ b/backend/src/entities/shared-jobs/shared-jobs.service.ts @@ -279,13 +279,6 @@ export class SharedJobsService { return urlRegex.test(value) && ValidationHelper.isValidUrl(value); } - private isValueJSON(value: unknown): boolean { - if (typeof value !== 'string') { - return false; - } - return ValidationHelper.isValidJSON(value); - } - private isValueCountryCode(value: unknown): boolean { if (typeof value !== 'string') { return false; diff --git a/backend/src/entities/table-actions/table-action-events-module/action-event.entity.ts b/backend/src/entities/table-actions/table-action-events-module/action-event.entity.ts index 426e93d9..e0118733 100644 --- a/backend/src/entities/table-actions/table-action-events-module/action-event.entity.ts +++ b/backend/src/entities/table-actions/table-action-events-module/action-event.entity.ts @@ -35,7 +35,7 @@ export class ActionEventsEntity { @Column({ default: false, type: 'boolean' }) require_confirmation: boolean; - @ManyToOne((type) => ActionRulesEntity, (rules) => rules.table_actions, { onDelete: 'CASCADE' }) + @ManyToOne((_type) => ActionRulesEntity, (rules) => rules.table_actions, { onDelete: 'CASCADE' }) @JoinColumn({ name: 'action_rule_id' }) action_rule: Relation; } diff --git a/backend/src/entities/table-actions/table-action-rules-module/action-rules.entity.ts b/backend/src/entities/table-actions/table-action-rules-module/action-rules.entity.ts index c11729c7..0ea5e5df 100644 --- a/backend/src/entities/table-actions/table-action-rules-module/action-rules.entity.ts +++ b/backend/src/entities/table-actions/table-action-rules-module/action-rules.entity.ts @@ -15,13 +15,13 @@ export class ActionRulesEntity { @Column({ default: null }) title: string; - @OneToMany((type) => TableActionEntity, (action) => action.action_rule) + @OneToMany((_type) => TableActionEntity, (action) => action.action_rule) table_actions: Relation[]; - @OneToMany((type) => ActionEventsEntity, (event) => event.action_rule) + @OneToMany((_type) => ActionEventsEntity, (event) => event.action_rule) action_events: Relation[]; - @ManyToOne((type) => ConnectionEntity, (connection) => connection.action_rules, { onDelete: 'CASCADE' }) + @ManyToOne((_type) => ConnectionEntity, (connection) => connection.action_rules, { onDelete: 'CASCADE' }) @JoinColumn({ name: 'connection_id' }) connection: Relation; diff --git a/backend/src/entities/table-actions/table-action-rules-module/application/dto/create-action-rules-with-actions-and-events-body.dto.ts b/backend/src/entities/table-actions/table-action-rules-module/application/dto/create-action-rules-with-actions-and-events-body.dto.ts index 8d03494f..e3ceb504 100644 --- a/backend/src/entities/table-actions/table-action-rules-module/application/dto/create-action-rules-with-actions-and-events-body.dto.ts +++ b/backend/src/entities/table-actions/table-action-rules-module/application/dto/create-action-rules-with-actions-and-events-body.dto.ts @@ -20,7 +20,7 @@ import { applyDecorators } from '@nestjs/common'; import { IsURLOptions } from 'validator'; function IsUrlIfNotTest(validationOptions?: IsURLOptions) { - return function (object: NonNullable, propertyName: string) { + return (object: NonNullable, propertyName: string) => { const decorators = [IsString()]; if (process.env.NODE_ENV !== 'test') { decorators.push(IsUrl(validationOptions)); diff --git a/backend/src/entities/table-actions/table-actions-module/table-action-activation.service.ts b/backend/src/entities/table-actions/table-actions-module/table-action-activation.service.ts index ff2ad6ab..1566f1a3 100644 --- a/backend/src/entities/table-actions/table-actions-module/table-action-activation.service.ts +++ b/backend/src/entities/table-actions/table-actions-module/table-action-activation.service.ts @@ -188,9 +188,7 @@ export class TableActionActivationService { result = await axios.post(tableAction.url, actionRequestBody, { headers: { 'Rocketadmin-Signature': autoadminSignatureHeader, 'Content-Type': 'application/json' }, maxRedirects: 0, - validateStatus: function (status) { - return status <= 599; - }, + validateStatus: (status) => status <= 599, }); if (!isSaaS()) { console.info('HTTP action result data', result.data); diff --git a/backend/src/entities/table-actions/table-actions-module/table-action.entity.ts b/backend/src/entities/table-actions/table-actions-module/table-action.entity.ts index 35d9f2b9..b84eb84c 100644 --- a/backend/src/entities/table-actions/table-actions-module/table-action.entity.ts +++ b/backend/src/entities/table-actions/table-actions-module/table-action.entity.ts @@ -36,10 +36,10 @@ export class TableActionEntity { @Column('varchar', { array: true, default: {} }) emails: string[]; - @ManyToOne((type) => TableSettingsEntity, (settings) => settings.table_actions, { onDelete: 'CASCADE' }) + @ManyToOne((_type) => TableSettingsEntity, (settings) => settings.table_actions, { onDelete: 'CASCADE' }) settings: Relation; - @ManyToOne((type) => ActionRulesEntity, (rules) => rules.table_actions, { onDelete: 'CASCADE' }) + @ManyToOne((_type) => ActionRulesEntity, (rules) => rules.table_actions, { onDelete: 'CASCADE' }) @JoinColumn({ name: 'action_rule_id' }) action_rule: Relation; diff --git a/backend/src/entities/table-categories/utils/validate-table-categories.util.ts b/backend/src/entities/table-categories/utils/validate-table-categories.util.ts index 7201ae2d..506ca4f1 100644 --- a/backend/src/entities/table-categories/utils/validate-table-categories.util.ts +++ b/backend/src/entities/table-categories/utils/validate-table-categories.util.ts @@ -20,7 +20,7 @@ export async function validateTableCategories( }); const dao = getDataAccessObject(connection); const tablesInConnection = (await dao.getTablesFromDB()).map((table) => table.tableName); - const tables = tableCategoriesData.map((category) => category.tables).flat(); + const tables = tableCategoriesData.flatMap((category) => category.tables); const uniqueTables = Array.from(new Set(tables)); const errors = []; for (const table of uniqueTables) { diff --git a/backend/src/entities/table-filters/utils/validate-table-filters-data.util.ts b/backend/src/entities/table-filters/utils/validate-table-filters-data.util.ts index b4a7dcba..5ce2820c 100644 --- a/backend/src/entities/table-filters/utils/validate-table-filters-data.util.ts +++ b/backend/src/entities/table-filters/utils/validate-table-filters-data.util.ts @@ -16,7 +16,6 @@ export async function validateFiltersData( ): Promise> { const { table_name, filters, dynamic_filtered_column } = inputData; const errors: Array = []; - try { const dao = getDataAccessObject(foundConnection); const tablesInConnection = await dao.getTablesFromDB(); const tableNames = tablesInConnection.map((table) => table.tableName); @@ -49,7 +48,4 @@ export async function validateFiltersData( } } return errors; - } catch (error) { - throw error; - } } diff --git a/backend/src/entities/table-logs/application/data-structures/find-logs.ds.ts b/backend/src/entities/table-logs/application/data-structures/find-logs.ds.ts index cb4995f3..2ad1d0c0 100644 --- a/backend/src/entities/table-logs/application/data-structures/find-logs.ds.ts +++ b/backend/src/entities/table-logs/application/data-structures/find-logs.ds.ts @@ -2,7 +2,7 @@ import { LogOperationTypeEnum } from '../../../../enums/index.js'; export class FindLogsDs { connectionId: string; - query: string; + query: Record; userId: string; operationTypes: Array; } diff --git a/backend/src/entities/table-logs/table-logs.service.ts b/backend/src/entities/table-logs/table-logs.service.ts index f341f683..af43efe5 100644 --- a/backend/src/entities/table-logs/table-logs.service.ts +++ b/backend/src/entities/table-logs/table-logs.service.ts @@ -212,7 +212,7 @@ export class TableLogsService { tableLogsEntities.push(newLogRecord); } const queue = new PQueue({ concurrency: 2 }); - const createdLogs: Array = await Promise.all( + const createdLogs: Array = await Promise.all( tableLogsEntities.map(async (newLogRecord) => { return await queue.add(async () => { const savedLogRecord = await this.tableLogsRepository.save(newLogRecord); diff --git a/backend/src/entities/table-logs/use-cases/export-logs-as-csv.use.case.ts b/backend/src/entities/table-logs/use-cases/export-logs-as-csv.use.case.ts index a7aa4e59..ee296972 100644 --- a/backend/src/entities/table-logs/use-cases/export-logs-as-csv.use.case.ts +++ b/backend/src/entities/table-logs/use-cases/export-logs-as-csv.use.case.ts @@ -25,16 +25,16 @@ export class ExportLogsAsCsvUseCase extends AbstractUseCase { const { connectionId, query, userId, operationTypes } = inputData; const userConnectionEdit = await this._dbContext.userAccessRepository.checkUserConnectionEdit(userId, connectionId); - const tableName = query['tableName']; - let order = query['order']; - let limit = query['limit']; - let page = parseInt(query['page']); - let perPage = parseInt(query['perPage']); - const dateFrom = query['dateFrom']; - const dateTo = query['dateTo']; - const searchedEmail = query['email']?.toLowerCase(); - const operationType: LogOperationTypeEnum = query['operationType']; - const searchedAffectedPrimaryKey: string = query['affected_primary_key']; + const tableName = query.tableName; + let order = query.order; + let limit: string | number = query.limit; + let page = parseInt(query.page, 10); + let perPage: string | number = parseInt(query.perPage, 10); + const dateFrom = query.dateFrom; + const dateTo = query.dateTo; + const searchedEmail = query.email?.toLowerCase(); + const operationType = query.operationType as LogOperationTypeEnum; + const searchedAffectedPrimaryKey: string = query.affected_primary_key; if (operationType) { const actionValidationResult = validateStringWithEnum(operationType, LogOperationTypeEnum); @@ -104,9 +104,9 @@ export class ExportLogsAsCsvUseCase extends AbstractUseCase im protected async implementation(inputData: FindLogsDs): Promise { const { connectionId, query, userId, operationTypes } = inputData; const userConnectionEdit = await this._dbContext.userAccessRepository.checkUserConnectionEdit(userId, connectionId); - const tableName = query['tableName']; - let order = query['order']; - let limit = query['limit']; - let page = parseInt(query['page']); - let perPage = parseInt(query['perPage']); - const dateFrom = query['dateFrom']; - const dateTo = query['dateTo']; - const searchedEmail = query['email']?.toLowerCase(); - const searchedAffectedPrimaryKey: string = query['affected_primary_key']; - const operationType: LogOperationTypeEnum = query['operationType']; + const tableName = query.tableName; + let order = query.order; + let limit: string | number = query.limit; + let page = parseInt(query.page, 10); + let perPage: string | number = parseInt(query.perPage, 10); + const dateFrom = query.dateFrom; + const dateTo = query.dateTo; + const searchedEmail = query.email?.toLowerCase(); + const searchedAffectedPrimaryKey: string = query.affected_primary_key; + const operationType = query.operationType as LogOperationTypeEnum; if (operationType) { const actionValidationResult = validateStringWithEnum(operationType, LogOperationTypeEnum); if (!actionValidationResult) { @@ -102,9 +102,9 @@ export class FindLogsUseCase extends AbstractUseCase im currentUserId: userId, dateFrom: searchedDateFrom, dateTo: searchedDateTo, - order: order, + order: order as QueryOrderingEnum, page: page, - perPage: perPage, + perPage: perPage as number, searchedEmail: searchedEmail, tableName: tableName ? tableName : null, userConnectionEdit: userConnectionEdit, diff --git a/backend/src/entities/table/application/data-structures/update-row-in-table.ds.ts b/backend/src/entities/table/application/data-structures/update-row-in-table.ds.ts index eda91803..bb34635f 100644 --- a/backend/src/entities/table/application/data-structures/update-row-in-table.ds.ts +++ b/backend/src/entities/table/application/data-structures/update-row-in-table.ds.ts @@ -1,8 +1,5 @@ import { AddRowInTableDs } from './add-row-in-table.ds.js'; export class UpdateRowInTableDs extends AddRowInTableDs { - constructor() { - super(); - } primaryKey: Record; } diff --git a/backend/src/entities/table/table.controller.ts b/backend/src/entities/table/table.controller.ts index 09c1e1b9..3d16d04e 100644 --- a/backend/src/entities/table/table.controller.ts +++ b/backend/src/entities/table/table.controller.ts @@ -203,8 +203,8 @@ export class TableController { ); } if (page && perPage) { - page = parseInt(page); - perPage = parseInt(perPage); + page = parseInt(page, 10); + perPage = parseInt(perPage, 10); if ((page && page <= 0) || (perPage && perPage <= 0)) { throw new HttpException( { @@ -263,8 +263,8 @@ export class TableController { ); } if (page && perPage) { - page = parseInt(page); - perPage = parseInt(perPage); + page = parseInt(page, 10); + perPage = parseInt(perPage, 10); if ((page && page <= 0) || (perPage && perPage <= 0)) { throw new HttpException( { @@ -577,8 +577,6 @@ export class TableController { userId: userId, }; return await this.getRowByPrimaryKeyUseCase.execute(inputData, InTransactionEnum.OFF); - } catch (e) { - throw e; } finally { const isTest = await this._dbContext.connectionRepository.isTestConnectionById(connectionId); await this.amplitudeService.formAndSendLogRecord( @@ -624,8 +622,8 @@ export class TableController { ); } if (page && perPage) { - page = parseInt(page); - perPage = parseInt(perPage); + page = parseInt(page, 10); + perPage = parseInt(perPage, 10); if ((page && page <= 0) || (perPage && perPage <= 0)) { throw new HttpException( { diff --git a/backend/src/entities/table/use-cases/find-tables-in-connection-v2.use.case.ts b/backend/src/entities/table/use-cases/find-tables-in-connection-v2.use.case.ts index 3184bc34..e261abc8 100644 --- a/backend/src/entities/table/use-cases/find-tables-in-connection-v2.use.case.ts +++ b/backend/src/entities/table/use-cases/find-tables-in-connection-v2.use.case.ts @@ -250,7 +250,7 @@ export class FindTablesInConnectionV2UseCase private async saveTableInfoInDatabase( connectionId: string, - userId: string, + _userId: string, tables: Array, masterPwd: string, ): Promise { diff --git a/backend/src/entities/table/use-cases/find-tables-in-connection.use.case.ts b/backend/src/entities/table/use-cases/find-tables-in-connection.use.case.ts index d603434c..4230d8c6 100644 --- a/backend/src/entities/table/use-cases/find-tables-in-connection.use.case.ts +++ b/backend/src/entities/table/use-cases/find-tables-in-connection.use.case.ts @@ -112,7 +112,7 @@ export class FindTablesInConnectionUseCase const tablesWithPermissions = await this.getUserPermissionsForAvailableTables(userId, connectionId, tables); const excludedTables = await this._dbContext.connectionPropertiesRepository.findConnectionProperties(connectionId); let tablesRO = await this.addDisplayNamesForTables(connectionId, tablesWithPermissions); - if (excludedTables && excludedTables.hidden_tables?.length) { + if (excludedTables?.hidden_tables?.length) { if (!hiddenTablesOption) { tablesRO = tablesRO.filter((tableRO) => { return !excludedTables.hidden_tables.includes(tableRO.table); @@ -246,7 +246,7 @@ export class FindTablesInConnectionUseCase private async saveTableInfoInDatabase( connectionId: string, - userId: string, + _userId: string, tables: Array, masterPwd: string, ): Promise { diff --git a/backend/src/entities/table/utils/find-autocomplete-fields.util.ts b/backend/src/entities/table/utils/find-autocomplete-fields.util.ts index 69bf36a3..f70adb98 100644 --- a/backend/src/entities/table/utils/find-autocomplete-fields.util.ts +++ b/backend/src/entities/table/utils/find-autocomplete-fields.util.ts @@ -41,6 +41,6 @@ export function findAutocompleteFieldsUtil( return { fields: autocompleteFields, - value: query['autocomplete'] === '' ? '*' : (query['autocomplete'] as string), + value: query.autocomplete === '' ? '*' : (query.autocomplete as string), }; } diff --git a/backend/src/entities/table/utils/find-ordering-field.util.ts b/backend/src/entities/table/utils/find-ordering-field.util.ts index bb8c012e..3b3b54b1 100644 --- a/backend/src/entities/table/utils/find-ordering-field.util.ts +++ b/backend/src/entities/table/utils/find-ordering-field.util.ts @@ -15,8 +15,8 @@ export function findOrderingFieldUtil( return undefined; } - const sortByFieldName = query['sort_by'] as string; - const sortByOrder = query['sort_order'] as QueryOrderingEnum; + const sortByFieldName = query.sort_by as string; + const sortByOrder = query.sort_order as QueryOrderingEnum; const rowNames = new Set(tableStructure.map((el) => el.column_name)); diff --git a/backend/src/entities/table/utils/find-table-fields.util.ts b/backend/src/entities/table/utils/find-table-fields.util.ts index ce71de41..5c301f3b 100644 --- a/backend/src/entities/table/utils/find-table-fields.util.ts +++ b/backend/src/entities/table/utils/find-table-fields.util.ts @@ -4,7 +4,7 @@ import { getDataAccessObject } from '@rocketadmin/shared-code/dist/src/data-acce export async function findTableFieldsUtil( connection: ConnectionEntity, tableName: string, - userId: string, + _userId: string, userEmail = 'unknown', ): Promise> { const dao = getDataAccessObject(connection); diff --git a/backend/src/entities/table/utils/find-tables-in-connection.util.ts b/backend/src/entities/table/utils/find-tables-in-connection.util.ts index 354ab4a9..6756e8f8 100644 --- a/backend/src/entities/table/utils/find-tables-in-connection.util.ts +++ b/backend/src/entities/table/utils/find-tables-in-connection.util.ts @@ -3,7 +3,7 @@ import { getDataAccessObject } from '@rocketadmin/shared-code/dist/src/data-acce export async function findTablesInConnectionUtil( connection: ConnectionEntity, - userId: string, + _userId: string, userEmail = 'unknown', ): Promise> { const dao = getDataAccessObject(connection); diff --git a/backend/src/entities/table/utils/validate-table-row.util.ts b/backend/src/entities/table/utils/validate-table-row.util.ts index ff5c9633..41104f5b 100644 --- a/backend/src/entities/table/utils/validate-table-row.util.ts +++ b/backend/src/entities/table/utils/validate-table-row.util.ts @@ -10,14 +10,14 @@ export function validateTableRowUtil(row: Record, structure: Ar for (let i = 0; i < structure.length; i++) { try { - const index = keys.indexOf(structure.at(i)['column_name'] || structure.at(i)['COLUMN_NAME']); + const index = keys.indexOf(structure.at(i).column_name); if ( (index >= 0 && - structure.at(i)['column_default'] != null && - structure.at(i)['column_default'].includes('nextval')) || + structure.at(i).column_default != null && + structure.at(i).column_default.includes('nextval')) || (index >= 0 && - structure.at(i)['column_default'] != null && - structure.at(i)['column_default'].includes('generate')) + structure.at(i).column_default != null && + structure.at(i).column_default.includes('generate')) ) { errors.push(Messages.CANNOT_ADD_AUTOGENERATED_VALUE); } diff --git a/backend/src/entities/user-sign-in-audit/sign-in-audit.controller.ts b/backend/src/entities/user-sign-in-audit/sign-in-audit.controller.ts index 2d707ac4..e701241c 100644 --- a/backend/src/entities/user-sign-in-audit/sign-in-audit.controller.ts +++ b/backend/src/entities/user-sign-in-audit/sign-in-audit.controller.ts @@ -60,8 +60,8 @@ export class SignInAuditController { companyId, query: { order: query.order, - page: parseInt(query.page) || 1, - perPage: parseInt(query.perPage) || 50, + page: parseInt(query.page, 10) || 1, + perPage: parseInt(query.perPage, 10) || 50, dateFrom: query.dateFrom, dateTo: query.dateTo, email: query.email, diff --git a/backend/src/entities/user/use-cases/find-user-use.case.ts b/backend/src/entities/user/use-cases/find-user-use.case.ts index eda7548d..c6a0d903 100644 --- a/backend/src/entities/user/use-cases/find-user-use.case.ts +++ b/backend/src/entities/user/use-cases/find-user-use.case.ts @@ -17,8 +17,7 @@ export class FindUserUseCase { constructor( @Inject(BaseType.GLOBAL_DB_CONTEXT) - protected _dbContext: IGlobalDatabaseContext, - private readonly amplitudeService: AmplitudeService, + protected _dbContext: IGlobalDatabaseContext,readonly _amplitudeService: AmplitudeService, private readonly userHelperService: UserHelperService, ) { super(); diff --git a/backend/src/entities/widget/utils/validate-create-widgets-ds.ts b/backend/src/entities/widget/utils/validate-create-widgets-ds.ts index 359caefc..52206a00 100644 --- a/backend/src/entities/widget/utils/validate-create-widgets-ds.ts +++ b/backend/src/entities/widget/utils/validate-create-widgets-ds.ts @@ -45,18 +45,18 @@ export async function validateCreateWidgetsDs( // } // } if (widget_type && widget_type === WidgetTypeEnum.Password) { - let { widget_params } = widgetDS; + let widget_params = widgetDS.widget_params as string | Record; if (typeof widget_params === 'string') { - widget_params = JSON5.parse(widget_params); + widget_params = JSON5.parse(widget_params); } - + if ( - widget_params['algorithm'] && - !Object.keys(EncryptionAlgorithmEnum).find((key) => key === widget_params['algorithm']) + widget_params.algorithm && + !Object.keys(EncryptionAlgorithmEnum).find((key) => key === widget_params.algorithm) ) { - errors.push(Messages.ENCRYPTION_ALGORITHM_INCORRECT(widget_params['algorithm'])); + errors.push(Messages.ENCRYPTION_ALGORITHM_INCORRECT(widget_params.algorithm)); } - if (widget_params['encrypt'] === undefined) { + if (widget_params.encrypt === undefined) { errors.push(Messages.WIDGET_REQUIRED_PARAMETER_MISSING('encrypt')); } } diff --git a/backend/src/exceptions/utils/processing-messages-replace.ts b/backend/src/exceptions/utils/processing-messages-replace.ts index 96ef7e0c..89a26a0f 100644 --- a/backend/src/exceptions/utils/processing-messages-replace.ts +++ b/backend/src/exceptions/utils/processing-messages-replace.ts @@ -11,13 +11,9 @@ export const PROCESSING_MESSAGES_REPLACE = { VIOLATES_FOREIGN_CONSTRAINT_PG: (originalMessage: string): string => { try { const words = originalMessage.split(' '); - const updateWordIndex = words.findIndex((word) => { - return word === 'update'; - }); + const updateWordIndex = words.indexOf('update'); const firstTableName = words.at(updateWordIndex + 5); - const violatesWordIndex = words.findIndex((word) => { - return word === 'violates'; - }); + const violatesWordIndex = words.indexOf('violates'); const secondTableName = words.at(violatesWordIndex + 7); const message = ` You tried to change a record in a table ${firstTableName}, but this table is referenced by the ${secondTableName} table. @@ -31,9 +27,7 @@ export const PROCESSING_MESSAGES_REPLACE = { VIOLATES_FOREIGN_CONSTRAINT_MYSQL: (originalMessage: string) => { const words = originalMessage.split(' '); const regex = /(?<=\()[^)]+(?=\))/g; - const referencesWordIndex = words.findIndex((word) => { - return word === 'references'; - }); + const referencesWordIndex = words.indexOf('references'); const tableName = words.at(referencesWordIndex + 1); const relatedColumnName = words.at(referencesWordIndex + 2).match(regex); const message = ` @@ -44,13 +38,9 @@ export const PROCESSING_MESSAGES_REPLACE = { }, VIOLATES_FOREIGN_CONSTRAINT_MSSQL: (originalMessage: string) => { const words = originalMessage.split(' '); - const fromWordIndex = words.findIndex((word) => { - return word === 'from'; - }); + const fromWordIndex = words.indexOf('from'); const firstTableName = words.at(fromWordIndex + 1); - const tableWordIndex = words.findIndex((word) => { - return word === 'table'; - }); + const tableWordIndex = words.indexOf('table'); const secondTableName = words.at(tableWordIndex + 1); const message = ` You tried to change a record in a table ${firstTableName}, but this table is referenced by the ${secondTableName} table. @@ -60,9 +50,7 @@ export const PROCESSING_MESSAGES_REPLACE = { }, SELECT_COMMAND_DENIED_MYSQL: (originalMessage: string): string => { const words = originalMessage.split(' '); - const userWordIndex = words.findIndex((word) => { - return word === 'user'; - }); + const userWordIndex = words.indexOf('user'); const dbUser = words.at(userWordIndex + 1); const message = ` User ${dbUser} don't have permission to perform select command for this table. diff --git a/backend/src/guards/company-admin.guard.ts b/backend/src/guards/company-admin.guard.ts index 03c73157..ceeefe66 100644 --- a/backend/src/guards/company-admin.guard.ts +++ b/backend/src/guards/company-admin.guard.ts @@ -21,7 +21,7 @@ export class CompanyAdminGuard implements CanActivate { const userId: string = request.decoded.sub; let companyId: string = request.params?.companyId || request.params?.slug; if (!companyId || !validateUuidByRegex(companyId)) { - companyId = request.body?.['companyId']; + companyId = request.body?.companyId; } if (!companyId || !validateUuidByRegex(companyId)) { const foundCompanyInfo = await this._dbContext.companyInfoRepository.findCompanyInfoByUserId(userId); diff --git a/backend/src/guards/company-user.guard.ts b/backend/src/guards/company-user.guard.ts index 10230cc0..d8e16bbf 100644 --- a/backend/src/guards/company-user.guard.ts +++ b/backend/src/guards/company-user.guard.ts @@ -21,7 +21,7 @@ export class CompanyUserGuard implements CanActivate { const userId: string = request.decoded.sub; let companyId: string = request.params?.companyId || request.params?.slug; if (!companyId || !validateUuidByRegex(companyId)) { - companyId = request.body?.['companyId']; + companyId = request.body?.companyId; } if (!companyId || !validateUuidByRegex(companyId)) { const foundCompanyInfo = await this._dbContext.companyInfoRepository.findCompanyInfoByUserId(userId); diff --git a/backend/src/guards/connection-edit.guard.ts b/backend/src/guards/connection-edit.guard.ts index 5afda5c8..f676fbf1 100644 --- a/backend/src/guards/connection-edit.guard.ts +++ b/backend/src/guards/connection-edit.guard.ts @@ -25,7 +25,7 @@ export class ConnectionEditGuard implements CanActivate { return new Promise(async (resolve, reject) => { const request: IRequestWithCognitoInfo = context.switchToHttp().getRequest(); const cognitoUserName = request.decoded.sub; - let connectionId: string = request.query['connectionId']; + let connectionId: string = request.query.connectionId; if (!connectionId || (!validateUuidByRegex(connectionId) && !ValidationHelper.isValidNanoId(connectionId))) { connectionId = request.params?.slug || request.params?.connectionId; } diff --git a/backend/src/guards/connection-read.guard.ts b/backend/src/guards/connection-read.guard.ts index 4febbeb0..1c189630 100644 --- a/backend/src/guards/connection-read.guard.ts +++ b/backend/src/guards/connection-read.guard.ts @@ -27,7 +27,7 @@ export class ConnectionReadGuard implements CanActivate { const cognitoUserName = request.decoded.sub; let connectionId: string = request.params?.slug || request.params?.connectionId; if (!connectionId || (!validateUuidByRegex(connectionId) && !ValidationHelper.isValidNanoId(connectionId))) { - connectionId = request.query['connectionId']; + connectionId = request.query.connectionId; } if (!connectionId || (!validateUuidByRegex(connectionId) && !ValidationHelper.isValidNanoId(connectionId))) { reject(new BadRequestException(Messages.CONNECTION_ID_MISSING)); diff --git a/backend/src/guards/group-edit.guard.ts b/backend/src/guards/group-edit.guard.ts index 3dc24067..97ad1e94 100644 --- a/backend/src/guards/group-edit.guard.ts +++ b/backend/src/guards/group-edit.guard.ts @@ -26,7 +26,7 @@ export class GroupEditGuard implements CanActivate { const cognitoUserName = request.decoded.sub; let groupId: string = request.params?.groupId || request.params?.slug; if (!groupId || !validateUuidByRegex(groupId)) { - groupId = request.body['groupId']; + groupId = request.body.groupId; } if (!groupId || !validateUuidByRegex(groupId)) { reject(new BadRequestException(Messages.GROUP_ID_MISSING)); diff --git a/backend/src/guards/group-read.guard.ts b/backend/src/guards/group-read.guard.ts index 552b5071..a44755c7 100644 --- a/backend/src/guards/group-read.guard.ts +++ b/backend/src/guards/group-read.guard.ts @@ -26,7 +26,7 @@ export class GroupReadGuard implements CanActivate { const cognitoUserName = request.decoded.sub; let groupId: string = request.params?.groupId || request.params?.slug; if (!groupId || !validateUuidByRegex(groupId)) { - groupId = request.body['groupId']; + groupId = request.body.groupId; } if (!groupId || !validateUuidByRegex(groupId)) { reject(new BadRequestException(Messages.GROUP_ID_MISSING)); diff --git a/backend/src/guards/paid-feature.guard.ts b/backend/src/guards/paid-feature.guard.ts index c6d1c06a..4cf8469d 100644 --- a/backend/src/guards/paid-feature.guard.ts +++ b/backend/src/guards/paid-feature.guard.ts @@ -24,7 +24,7 @@ export class PaidFeatureGuard implements CanActivate { const userId: string = request.decoded.sub; let companyId: string = request.params?.companyId || request.params?.slug; if (!companyId || !validateUuidByRegex(companyId)) { - companyId = request.body?.['companyId']; + companyId = request.body?.companyId; } if (!companyId || !validateUuidByRegex(companyId)) { const foundCompanyInfo = await this._dbContext.companyInfoRepository.findCompanyInfoByUserId(userId); diff --git a/backend/src/helpers/check-field-autoincrement.ts b/backend/src/helpers/check-field-autoincrement.ts index 0cd345b8..8585f9db 100644 --- a/backend/src/helpers/check-field-autoincrement.ts +++ b/backend/src/helpers/check-field-autoincrement.ts @@ -1,12 +1,12 @@ export function checkFieldAutoincrement(defaultValue: string, extra: string = null): boolean { let result = false; if ( - (defaultValue !== null && defaultValue?.toLowerCase().includes('nextval')) || - (defaultValue !== null && defaultValue?.toLowerCase().includes('generate')) || - (defaultValue !== null && defaultValue?.toLowerCase().includes('autoincrement')) || - (defaultValue !== null && defaultValue?.toLowerCase().includes('auto_increment')) || - (extra !== null && extra.toLowerCase().includes('auto_increment')) || - (extra !== null && extra.toLowerCase().includes('autoincrement')) + (defaultValue?.toLowerCase().includes('nextval')) || + (defaultValue?.toLowerCase().includes('generate')) || + (defaultValue?.toLowerCase().includes('autoincrement')) || + (defaultValue?.toLowerCase().includes('auto_increment')) || + (extra?.toLowerCase().includes('auto_increment')) || + (extra?.toLowerCase().includes('autoincrement')) ) { result = true; } diff --git a/backend/src/helpers/compare-array-elements.ts b/backend/src/helpers/compare-array-elements.ts index 6067a1d3..2a1d2aca 100644 --- a/backend/src/helpers/compare-array-elements.ts +++ b/backend/src/helpers/compare-array-elements.ts @@ -1,5 +1,5 @@ export function compareArrayElements(arr1: Array, arr2: Array): boolean { - if (arr1.length != arr2.length) { + if (arr1.length !== arr2.length) { return false; } for (let i = 0; i < arr1.length; i++) { diff --git a/backend/src/helpers/constants/constants.ts b/backend/src/helpers/constants/constants.ts index 569f0c12..64224f09 100644 --- a/backend/src/helpers/constants/constants.ts +++ b/backend/src/helpers/constants/constants.ts @@ -51,7 +51,7 @@ export const Constants = { VERIFICATION_STRING_WHITELIST: () => { const numbers = [...Array(10).keys()].map((num) => num.toString()); - const alpha = Array.from(Array(26)).map((e, i) => i + 65); + const alpha = Array.from(Array(26)).map((_e, i) => i + 65); const letters = alpha.map((x) => String.fromCharCode(x).toLowerCase()); return [...numbers, ...letters]; }, @@ -140,7 +140,7 @@ export const Constants = { username: getProcessVariable('POSTGRES_CONNECTION_USERNAME') || null, password: getProcessVariable('POSTGRES_CONNECTION_PASSWORD') || null, host: getProcessVariable('POSTGRES_CONNECTION_HOST') || null, - port: parseInt(getProcessVariable('POSTGRES_CONNECTION_PORT')) || null, + port: parseInt(getProcessVariable('POSTGRES_CONNECTION_PORT'), 10) || null, database: getProcessVariable('POSTGRES_CONNECTION_DATABASE') || null, isTestConnection: true, }, @@ -150,7 +150,7 @@ export const Constants = { masterEncryption: false, type: ConnectionTypesEnum.mssql, host: getProcessVariable('MSSQL_CONNECTION_HOST') || null, - port: parseInt(getProcessVariable('MSSQL_CONNECTION_PORT')) || null, + port: parseInt(getProcessVariable('MSSQL_CONNECTION_PORT'), 10) || null, password: getProcessVariable('MSSQL_CONNECTION_PASSWORD') || null, username: getProcessVariable('MSSQL_CONNECTION_USERNAME') || null, database: getProcessVariable('MSSQL_CONNECTION_DATABASE') || null, @@ -163,7 +163,7 @@ export const Constants = { title: 'Oracle', type: ConnectionTypesEnum.oracledb, host: getProcessVariable('ORACLE_CONNECTION_HOST') || null, - port: parseInt(getProcessVariable('ORACLE_CONNECTION_PORT')) || null, + port: parseInt(getProcessVariable('ORACLE_CONNECTION_PORT'), 10) || null, username: getProcessVariable('ORACLE_CONNECTION_USERNAME') || null, password: getProcessVariable('ORACLE_CONNECTION_PASSWORD') || null, database: getProcessVariable('ORACLE_CONNECTION_DATABASE') || null, @@ -175,7 +175,7 @@ export const Constants = { title: 'MySQL', type: ConnectionTypesEnum.mysql, host: getProcessVariable('MYSQL_CONNECTION_HOST') || null, - port: parseInt(getProcessVariable('MYSQL_CONNECTION_PORT')) || null, + port: parseInt(getProcessVariable('MYSQL_CONNECTION_PORT'), 10) || null, username: getProcessVariable('MYSQL_CONNECTION_USERNAME') || null, password: getProcessVariable('MYSQL_CONNECTION_PASSWORD') || null, database: getProcessVariable('MYSQL_CONNECTION_DATABASE') || null, @@ -191,7 +191,7 @@ export const Constants = { title: 'MongoDB', type: ConnectionTypesEnum.mongodb, host: getProcessVariable('MONGO_CONNECTION_HOST') || null, - port: parseInt(getProcessVariable('MONGO_CONNECTION_PORT')) || null, + port: parseInt(getProcessVariable('MONGO_CONNECTION_PORT'), 10) || null, username: getProcessVariable('MONGO_CONNECTION_USERNAME') || null, password: getProcessVariable('MONGO_CONNECTION_PASSWORD') || null, database: getProcessVariable('MONGO_CONNECTION_DATABASE') || null, @@ -203,7 +203,7 @@ export const Constants = { title: 'IBM DB2', type: ConnectionTypesEnum.ibmdb2, host: getProcessVariable('IBM_DB2_CONNECTION_HOST') || null, - port: parseInt(getProcessVariable('IBM_DB2_CONNECTION_PORT')) || null, + port: parseInt(getProcessVariable('IBM_DB2_CONNECTION_PORT'), 10) || null, username: getProcessVariable('IBM_DB2_CONNECTION_USERNAME') || null, password: getProcessVariable('IBM_DB2_CONNECTION_PASSWORD') || null, database: getProcessVariable('IBM_DB2_CONNECTION_DATABASE') || null, @@ -215,7 +215,7 @@ export const Constants = { REMOVED_SENSITIVE_FIELD_IF_CHANGED: '* * * sensitive data, no logs stored * * *', REMOVED_SENSITIVE_FIELD_IF_NOT_CHANGED: '', - getTestConnectionsArr: function (): Array { + getTestConnectionsArr: (): Array => { const isSaaS = process.env.IS_SAAS; if (!isSaaS || isSaaS !== 'true') { return []; @@ -234,12 +234,12 @@ export const Constants = { return testConnections.filter((dto) => { const values = Object.values(dto); - const nullElementIndex = values.findIndex((el) => el === null); + const nullElementIndex = values.indexOf(null); return nullElementIndex < 0; }); }, - getTestConnectionsFromDSN: function (): Array { + getTestConnectionsFromDSN: (): Array => { if (!isSaaS()) { return []; } @@ -294,7 +294,7 @@ export const Constants = { }, APP_DOMAIN_ADDRESS: process.env.APP_DOMAIN_ADDRESS || `http://127.0.0.1:3000`, - ALLOWED_REQUEST_DOMAIN: function (): string { + ALLOWED_REQUEST_DOMAIN: (): string => { if (isTest()) { return Constants.APP_DOMAIN_ADDRESS; } diff --git a/backend/src/helpers/encryption/encryptor.ts b/backend/src/helpers/encryption/encryptor.ts index 212b70b9..7bcae1a7 100644 --- a/backend/src/helpers/encryption/encryptor.ts +++ b/backend/src/helpers/encryption/encryptor.ts @@ -13,7 +13,7 @@ export class Encryptor { static encryptData(data: string): string { try { - const privateKey = this.getPrivateKey(); + const privateKey = Encryptor.getPrivateKey(); return CryptoJS.AES.encrypt(data, privateKey).toString(); } catch (e) { console.log('-> Encryption error', e); @@ -23,7 +23,7 @@ export class Encryptor { static decryptData(encryptedData: string): string { try { - const privateKey = this.getPrivateKey(); + const privateKey = Encryptor.getPrivateKey(); const bytes = CryptoJS.AES.decrypt(encryptedData, privateKey); return bytes.toString(CryptoJS.enc.Utf8); } catch (e) { @@ -45,44 +45,44 @@ export class Encryptor { } static encryptConnectionCredentials(connection: ConnectionEntity, masterPwd: string): ConnectionEntity { - if (connection.username) connection.username = this.encryptDataMasterPwd(connection.username, masterPwd); - if (connection.database) connection.database = this.encryptDataMasterPwd(connection.database, masterPwd); - if (connection.password) connection.password = this.encryptDataMasterPwd(connection.password, masterPwd); - if (connection.authSource) connection.authSource = this.encryptDataMasterPwd(connection.authSource, masterPwd); + if (connection.username) connection.username = Encryptor.encryptDataMasterPwd(connection.username, masterPwd); + if (connection.database) connection.database = Encryptor.encryptDataMasterPwd(connection.database, masterPwd); + if (connection.password) connection.password = Encryptor.encryptDataMasterPwd(connection.password, masterPwd); + if (connection.authSource) connection.authSource = Encryptor.encryptDataMasterPwd(connection.authSource, masterPwd); if (connection.ssh) { if (connection.privateSSHKey) - connection.privateSSHKey = this.encryptDataMasterPwd(connection.privateSSHKey, masterPwd); - if (connection.sshHost) connection.sshHost = this.encryptDataMasterPwd(connection.sshHost, masterPwd); - if (connection.sshUsername) connection.sshUsername = this.encryptDataMasterPwd(connection.sshUsername, masterPwd); + connection.privateSSHKey = Encryptor.encryptDataMasterPwd(connection.privateSSHKey, masterPwd); + if (connection.sshHost) connection.sshHost = Encryptor.encryptDataMasterPwd(connection.sshHost, masterPwd); + if (connection.sshUsername) connection.sshUsername = Encryptor.encryptDataMasterPwd(connection.sshUsername, masterPwd); } if (connection.ssl) { - if (connection.cert) connection.cert = this.encryptDataMasterPwd(connection.cert, masterPwd); + if (connection.cert) connection.cert = Encryptor.encryptDataMasterPwd(connection.cert, masterPwd); } return connection; } //todo types static decryptConnectionCredentials(connection: ConnectionEntity, masterPwd: string): ConnectionEntity { - if (connection.username) connection.username = this.decryptDataMasterPwd(connection.username, masterPwd); - if (connection.database) connection.database = this.decryptDataMasterPwd(connection.database, masterPwd); + if (connection.username) connection.username = Encryptor.decryptDataMasterPwd(connection.username, masterPwd); + if (connection.database) connection.database = Encryptor.decryptDataMasterPwd(connection.database, masterPwd); if (connection.password) { - connection.password = this.decryptDataMasterPwd(connection.password, masterPwd); + connection.password = Encryptor.decryptDataMasterPwd(connection.password, masterPwd); } - if (connection.authSource) connection.authSource = this.decryptDataMasterPwd(connection.authSource, masterPwd); + if (connection.authSource) connection.authSource = Encryptor.decryptDataMasterPwd(connection.authSource, masterPwd); if (connection.ssh) { if (connection.privateSSHKey) - connection.privateSSHKey = this.decryptDataMasterPwd(connection.privateSSHKey, masterPwd); - if (connection.sshHost) connection.sshHost = this.decryptDataMasterPwd(connection.sshHost, masterPwd); - if (connection.sshUsername) connection.sshUsername = this.decryptDataMasterPwd(connection.sshUsername, masterPwd); + connection.privateSSHKey = Encryptor.decryptDataMasterPwd(connection.privateSSHKey, masterPwd); + if (connection.sshHost) connection.sshHost = Encryptor.decryptDataMasterPwd(connection.sshHost, masterPwd); + if (connection.sshUsername) connection.sshUsername = Encryptor.decryptDataMasterPwd(connection.sshUsername, masterPwd); } if (connection.ssl) { - if (connection.cert) connection.cert = this.decryptDataMasterPwd(connection.cert, masterPwd); + if (connection.cert) connection.cert = Encryptor.decryptDataMasterPwd(connection.cert, masterPwd); } return connection; } static hashDataHMAC(dataToHash: string): string { - const privateKey = this.getPrivateKey(); + const privateKey = Encryptor.getPrivateKey(); const hmac = createHmac('sha256', privateKey); hmac.update(dataToHash); return hmac.digest('hex'); @@ -209,7 +209,7 @@ export class Encryptor { try { const passwordHashParts: Array = hashedPassword.split('$'); const alg = passwordHashParts[0]; - const iterations = parseInt(passwordHashParts[1]); + const iterations = parseInt(passwordHashParts[1], 10); const passwordHash = passwordHashParts[2]; const salt = passwordHashParts[3]; if (passwordHashParts.length !== 4 || alg !== 'pbkdf2' || iterations !== Constants.PASSWORD_HASH_ITERATIONS) { diff --git a/backend/src/helpers/get-master-password.ts b/backend/src/helpers/get-master-password.ts index 8a50bfac..4bab9479 100644 --- a/backend/src/helpers/get-master-password.ts +++ b/backend/src/helpers/get-master-password.ts @@ -1,6 +1,6 @@ import { IRequestWithCognitoInfo } from '../authorization/index.js'; export function getMasterPwd(request: IRequestWithCognitoInfo): string | null { - const masterPwd = request.headers['masterpwd']; - return masterPwd ? masterPwd : null; + const masterPwd = request.headers.masterpwd; + return masterPwd ? masterPwd as string : null; } diff --git a/backend/src/helpers/slack/action-slack-post-message.ts b/backend/src/helpers/slack/action-slack-post-message.ts index 9352a481..277ac7a9 100644 --- a/backend/src/helpers/slack/action-slack-post-message.ts +++ b/backend/src/helpers/slack/action-slack-post-message.ts @@ -1,12 +1,8 @@ import axios from 'axios'; export async function actionSlackPostMessage(message: string, slack_url: string): Promise { - try { if (!slack_url || !message) { return; } await axios.post(slack_url, { text: message }); - } catch (error) { - throw error; - } } diff --git a/backend/src/helpers/validators/is-object-property-exists-validator.ts b/backend/src/helpers/validators/is-object-property-exists-validator.ts index 064b2eca..f93daa08 100644 --- a/backend/src/helpers/validators/is-object-property-exists-validator.ts +++ b/backend/src/helpers/validators/is-object-property-exists-validator.ts @@ -1,6 +1,6 @@ export function isObjectPropertyExists(obj: unknown, property: string): boolean { - if (!obj) { + if (!obj || typeof obj !== 'object') { return false; } - return Object.prototype.hasOwnProperty.call(obj, property); + return Object.hasOwn(obj, property); } diff --git a/backend/src/interceptors/timeout.interceptor.ts b/backend/src/interceptors/timeout.interceptor.ts index 803ad5cf..678bb19f 100644 --- a/backend/src/interceptors/timeout.interceptor.ts +++ b/backend/src/interceptors/timeout.interceptor.ts @@ -5,7 +5,7 @@ import { Messages } from '../exceptions/text/messages.js'; @Injectable() export class TimeoutInterceptor implements NestInterceptor { - intercept(context: ExecutionContext, next: CallHandler): Observable { + intercept(_context: ExecutionContext, next: CallHandler): Observable { const timeoutMs = process.env.NODE_ENV !== 'test' ? 15000 : 200000; return next.handle().pipe( timeout(timeoutMs), diff --git a/backend/src/main.ts b/backend/src/main.ts index 7fc31858..7f28022b 100644 --- a/backend/src/main.ts +++ b/backend/src/main.ts @@ -93,7 +93,7 @@ async function bootstrap() { const temp = process.exit; -process.exit = function () { +process.exit = () => { console.trace(); process.exit = temp; process.exit(); diff --git a/backend/src/microservices/gateways/saas-gateway.ts/saas-company-gateway.service.ts b/backend/src/microservices/gateways/saas-gateway.ts/saas-company-gateway.service.ts index e23ab40e..baf18077 100644 --- a/backend/src/microservices/gateways/saas-gateway.ts/saas-company-gateway.service.ts +++ b/backend/src/microservices/gateways/saas-gateway.ts/saas-company-gateway.service.ts @@ -8,9 +8,6 @@ import { FoundSassCompanyInfoDS } from './data-structures/found-saas-company-inf @Injectable() export class SaasCompanyGatewayService extends BaseSaasGatewayService { - constructor() { - super(); - } public async getCompanyInfo(companyId: string): Promise { const result = await this.sendRequestToSaaS(`/webhook/company/${companyId}/`, 'GET', null); diff --git a/backend/src/shared/config/config.service.ts b/backend/src/shared/config/config.service.ts index 6c2ce674..773dbfc1 100644 --- a/backend/src/shared/config/config.service.ts +++ b/backend/src/shared/config/config.service.ts @@ -121,7 +121,7 @@ class ConfigService { return { host, - port: parseInt(port), + port: parseInt(port, 10), username: user, password, database, diff --git a/backend/src/shared/database/database.providers.ts b/backend/src/shared/database/database.providers.ts index 2aa61d53..beaaca62 100644 --- a/backend/src/shared/database/database.providers.ts +++ b/backend/src/shared/database/database.providers.ts @@ -7,7 +7,7 @@ export const databaseProviders = [ { provide: BaseType.DATA_SOURCE, useFactory: async () => { - if (appDataSourceCache && appDataSourceCache.isInitialized) { + if (appDataSourceCache?.isInitialized) { return appDataSourceCache; } const AppDataSource = new DataSource(configService.getTypeOrmConfig()); diff --git a/backend/src/use-cases-app/use-cases-app.interface.ts b/backend/src/use-cases-app/use-cases-app.interface.ts index a34018f1..924702b1 100644 --- a/backend/src/use-cases-app/use-cases-app.interface.ts +++ b/backend/src/use-cases-app/use-cases-app.interface.ts @@ -1,5 +1,5 @@ import { InTransactionEnum } from '../enums/index.js'; export interface IGetHello { - execute(inputData: void, inTransaction: InTransactionEnum): Promise; + execute(inputData: undefined, inTransaction: InTransactionEnum): Promise; } diff --git a/backend/test/ava-tests/complex-table-tests/complex-ibmdb2-table-e2e.test.ts b/backend/test/ava-tests/complex-table-tests/complex-ibmdb2-table-e2e.test.ts index cb7bf508..4c3a6c1c 100644 --- a/backend/test/ava-tests/complex-table-tests/complex-ibmdb2-table-e2e.test.ts +++ b/backend/test/ava-tests/complex-table-tests/complex-ibmdb2-table-e2e.test.ts @@ -27,8 +27,8 @@ const __dirname = path.dirname(__filename); const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; -const testSearchedUserName = 'Vasia'; +let _testUtils: TestUtils; +const _testSearchedUserName = 'Vasia'; const connectionToTestDB = getTestData(mockFactory).connectionToIbmDb2; let testTablesCompositeKeysData: TableCreationResult; @@ -40,7 +40,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication() as any; - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -113,7 +113,7 @@ test.serial( .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const getMainTableRowsRO = JSON.parse(getMainTableRowsResponse.text); + const _getMainTableRowsRO = JSON.parse(getMainTableRowsResponse.text); t.is(getMainTableRowsResponse.status, 200); const getFirstReferencedTableRowsResponse = await request(app.getHttpServer()) @@ -129,11 +129,11 @@ test.serial( for (const row of firstReturnedRows) { t.is(typeof row.ORDER_ID, 'object'); - t.truthy(row.ORDER_ID.hasOwnProperty('ORDER_ID')); + t.truthy(Object.hasOwn(row.ORDER_ID, 'ORDER_ID')); t.truthy(row.ORDER_ID.ORDER_ID); t.truthy(typeof row.ORDER_ID.ORDER_ID === 'number'); t.is(typeof row.CUSTOMER_ID, 'object'); - t.truthy(row.CUSTOMER_ID.hasOwnProperty('CUSTOMER_ID')); + t.truthy(Object.hasOwn(row.CUSTOMER_ID, 'CUSTOMER_ID')); t.truthy(row.CUSTOMER_ID.CUSTOMER_ID); t.truthy(typeof row.CUSTOMER_ID.CUSTOMER_ID === 'number'); } @@ -149,11 +149,11 @@ test.serial( const secondReturnedRows = getSecondReferencedTableRowsRO.rows; for (const row of secondReturnedRows) { t.is(typeof row.ORDER_ID, 'object'); - t.truthy(row.ORDER_ID.hasOwnProperty('ORDER_ID')); + t.truthy(Object.hasOwn(row.ORDER_ID, 'ORDER_ID')); t.truthy(row.ORDER_ID.ORDER_ID); t.truthy(typeof row.ORDER_ID.ORDER_ID === 'number'); t.is(typeof row.CUSTOMER_ID, 'object'); - t.truthy(row.CUSTOMER_ID.hasOwnProperty('CUSTOMER_ID')); + t.truthy(Object.hasOwn(row.CUSTOMER_ID, 'CUSTOMER_ID')); t.truthy(row.CUSTOMER_ID.CUSTOMER_ID); t.truthy(typeof row.CUSTOMER_ID.CUSTOMER_ID === 'number'); } @@ -187,7 +187,7 @@ test.serial( .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const getMainTableRowsRO = JSON.parse(getMainTableRowsResponse.text); + const _getMainTableRowsRO = JSON.parse(getMainTableRowsResponse.text); t.is(getMainTableRowsResponse.status, 200); const getFirstReferencedTableRowsResponse = await request(app.getHttpServer()) @@ -203,7 +203,7 @@ test.serial( for (const element of firstReturnedRows) { t.is(typeof element.ORDER_ID, 'object'); - t.truthy(element.ORDER_ID.hasOwnProperty('ORDER_ID')); + t.truthy(Object.hasOwn(element.ORDER_ID, 'ORDER_ID')); t.truthy(element.ORDER_ID.ORDER_ID); t.truthy(typeof element.ORDER_ID.ORDER_ID === 'number'); } @@ -220,7 +220,7 @@ test.serial( const secondReturnedRows = getSecondReferencedTableRowsRO.rows; for (const element of secondReturnedRows) { t.is(typeof element.ORDER_ID, 'object'); - t.truthy(element.ORDER_ID.hasOwnProperty('ORDER_ID')); + t.truthy(Object.hasOwn(element.ORDER_ID, 'ORDER_ID')); t.truthy(element.ORDER_ID.ORDER_ID); t.truthy(typeof element.ORDER_ID.ORDER_ID === 'number'); } diff --git a/backend/test/ava-tests/complex-table-tests/complex-mssql-table-e2e.test.ts b/backend/test/ava-tests/complex-table-tests/complex-mssql-table-e2e.test.ts index fe8a0ff5..0c244346 100644 --- a/backend/test/ava-tests/complex-table-tests/complex-mssql-table-e2e.test.ts +++ b/backend/test/ava-tests/complex-table-tests/complex-mssql-table-e2e.test.ts @@ -27,8 +27,8 @@ const __dirname = path.dirname(__filename); const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; -const testSearchedUserName = 'Vasia'; +let _testUtils: TestUtils; +const _testSearchedUserName = 'Vasia'; const connectionToTestDB = getTestData(mockFactory).connectionToTestMSSQL; let testTablesCompositeKeysData: TableCreationResult; @@ -40,7 +40,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication() as any; - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -113,7 +113,7 @@ test.serial( .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const getMainTableRowsRO = JSON.parse(getMainTableRowsResponse.text); + const _getMainTableRowsRO = JSON.parse(getMainTableRowsResponse.text); t.is(getMainTableRowsResponse.status, 200); const getFirstReferencedTableRowsResponse = await request(app.getHttpServer()) @@ -129,11 +129,11 @@ test.serial( for (const row of firstReturnedRows) { t.is(typeof row.order_id, 'object'); - t.truthy(row.order_id.hasOwnProperty('order_id')); + t.truthy(Object.hasOwn(row.order_id, 'order_id')); t.truthy(row.order_id.order_id); t.truthy(typeof row.order_id.order_id === 'number'); t.is(typeof row.customer_id, 'object'); - t.truthy(row.customer_id.hasOwnProperty('customer_id')); + t.truthy(Object.hasOwn(row.customer_id, 'customer_id')); t.truthy(row.customer_id.customer_id); t.truthy(typeof row.customer_id.customer_id === 'number'); } @@ -149,11 +149,11 @@ test.serial( const secondReturnedRows = getSecondReferencedTableRowsRO.rows; for (const row of secondReturnedRows) { t.is(typeof row.order_id, 'object'); - t.truthy(row.order_id.hasOwnProperty('order_id')); + t.truthy(Object.hasOwn(row.order_id, 'order_id')); t.truthy(row.order_id.order_id); t.truthy(typeof row.order_id.order_id === 'number'); t.is(typeof row.customer_id, 'object'); - t.truthy(row.customer_id.hasOwnProperty('customer_id')); + t.truthy(Object.hasOwn(row.customer_id, 'customer_id')); t.truthy(row.customer_id.customer_id); t.truthy(typeof row.customer_id.customer_id === 'number'); } @@ -187,7 +187,7 @@ test.serial( .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const getMainTableRowsRO = JSON.parse(getMainTableRowsResponse.text); + const _getMainTableRowsRO = JSON.parse(getMainTableRowsResponse.text); t.is(getMainTableRowsResponse.status, 200); const getFirstReferencedTableRowsResponse = await request(app.getHttpServer()) @@ -203,7 +203,7 @@ test.serial( for (const element of firstReturnedRows) { t.is(typeof element.customer_id, 'object'); - t.truthy(element.customer_id.hasOwnProperty('customer_id')); + t.truthy(Object.hasOwn(element.customer_id, 'customer_id')); t.truthy(element.customer_id.customer_id); t.truthy(typeof element.customer_id.customer_id === 'number'); } @@ -220,7 +220,7 @@ test.serial( const secondReturnedRows = getSecondReferencedTableRowsRO.rows; for (const element of secondReturnedRows) { t.is(typeof element.order_id, 'object'); - t.truthy(element.order_id.hasOwnProperty('order_id')); + t.truthy(Object.hasOwn(element.order_id, 'order_id')); t.truthy(element.order_id.order_id); t.truthy(typeof element.order_id.order_id === 'number'); } diff --git a/backend/test/ava-tests/complex-table-tests/complex-mysql-table-e2e.test.ts b/backend/test/ava-tests/complex-table-tests/complex-mysql-table-e2e.test.ts index 60fb23ae..221cc9ab 100644 --- a/backend/test/ava-tests/complex-table-tests/complex-mysql-table-e2e.test.ts +++ b/backend/test/ava-tests/complex-table-tests/complex-mysql-table-e2e.test.ts @@ -27,8 +27,8 @@ const __dirname = path.dirname(__filename); const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; -const testSearchedUserName = 'Vasia'; +let _testUtils: TestUtils; +const _testSearchedUserName = 'Vasia'; const connectionToTestDB = getTestData(mockFactory).connectionToMySQL; let testTablesCompositeKeysData: TableCreationResult; @@ -40,7 +40,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication() as any; - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -113,7 +113,7 @@ test.serial( .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const getMainTableRowsRO = JSON.parse(getMainTableRowsResponse.text); + const _getMainTableRowsRO = JSON.parse(getMainTableRowsResponse.text); t.is(getMainTableRowsResponse.status, 200); const getFirstReferencedTableRowsResponse = await request(app.getHttpServer()) @@ -129,11 +129,11 @@ test.serial( for (const row of firstReturnedRows) { t.is(typeof row.order_id, 'object'); - t.truthy(row.order_id.hasOwnProperty('order_id')); + t.truthy(Object.hasOwn(row.order_id, 'order_id')); t.truthy(row.order_id.order_id); t.truthy(typeof row.order_id.order_id === 'number'); t.is(typeof row.customer_id, 'object'); - t.truthy(row.customer_id.hasOwnProperty('customer_id')); + t.truthy(Object.hasOwn(row.customer_id, 'customer_id')); t.truthy(row.customer_id.customer_id); t.truthy(typeof row.customer_id.customer_id === 'number'); } @@ -149,11 +149,11 @@ test.serial( const secondReturnedRows = getSecondReferencedTableRowsRO.rows; for (const row of secondReturnedRows) { t.is(typeof row.order_id, 'object'); - t.truthy(row.order_id.hasOwnProperty('order_id')); + t.truthy(Object.hasOwn(row.order_id, 'order_id')); t.truthy(row.order_id.order_id); t.truthy(typeof row.order_id.order_id === 'number'); t.is(typeof row.customer_id, 'object'); - t.truthy(row.customer_id.hasOwnProperty('customer_id')); + t.truthy(Object.hasOwn(row.customer_id, 'customer_id')); t.truthy(row.customer_id.customer_id); t.truthy(typeof row.customer_id.customer_id === 'number'); } @@ -187,7 +187,7 @@ test.serial( .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const getMainTableRowsRO = JSON.parse(getMainTableRowsResponse.text); + const _getMainTableRowsRO = JSON.parse(getMainTableRowsResponse.text); t.is(getMainTableRowsResponse.status, 200); const getFirstReferencedTableRowsResponse = await request(app.getHttpServer()) @@ -203,7 +203,7 @@ test.serial( for (const element of firstReturnedRows) { t.is(typeof element.customer_id, 'object'); - t.truthy(element.customer_id.hasOwnProperty('customer_id')); + t.truthy(Object.hasOwn(element.customer_id, 'customer_id')); t.truthy(element.customer_id.customer_id); t.truthy(typeof element.customer_id.customer_id === 'number'); } @@ -220,7 +220,7 @@ test.serial( const secondReturnedRows = getSecondReferencedTableRowsRO.rows; for (const element of secondReturnedRows) { t.is(typeof element.order_id, 'object'); - t.truthy(element.order_id.hasOwnProperty('order_id')); + t.truthy(Object.hasOwn(element.order_id, 'order_id')); t.truthy(element.order_id.order_id); t.truthy(typeof element.order_id.order_id === 'number'); } diff --git a/backend/test/ava-tests/complex-table-tests/complex-oracle-table-e2e.test.ts b/backend/test/ava-tests/complex-table-tests/complex-oracle-table-e2e.test.ts index 58f43f8d..59b9f89d 100644 --- a/backend/test/ava-tests/complex-table-tests/complex-oracle-table-e2e.test.ts +++ b/backend/test/ava-tests/complex-table-tests/complex-oracle-table-e2e.test.ts @@ -27,8 +27,8 @@ const __dirname = path.dirname(__filename); const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; -const testSearchedUserName = 'Vasia'; +let _testUtils: TestUtils; +const _testSearchedUserName = 'Vasia'; const connectionToTestDB = getTestData(mockFactory).connectionToOracleDB; let testTablesCompositeKeysData: TableCreationResult; @@ -40,7 +40,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication() as any; - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -113,7 +113,7 @@ test.serial( .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const getMainTableRowsRO = JSON.parse(getMainTableRowsResponse.text); + const _getMainTableRowsRO = JSON.parse(getMainTableRowsResponse.text); t.is(getMainTableRowsResponse.status, 200); const getFirstReferencedTableRowsResponse = await request(app.getHttpServer()) @@ -129,11 +129,11 @@ test.serial( for (const row of firstReturnedRows) { t.is(typeof row.order_id, 'object'); - t.truthy(row.order_id.hasOwnProperty('order_id')); + t.truthy(Object.hasOwn(row.order_id, 'order_id')); t.truthy(row.order_id.order_id); t.truthy(typeof row.order_id.order_id === 'number'); t.is(typeof row.customer_id, 'object'); - t.truthy(row.customer_id.hasOwnProperty('customer_id')); + t.truthy(Object.hasOwn(row.customer_id, 'customer_id')); t.truthy(row.customer_id.customer_id); t.truthy(typeof row.customer_id.customer_id === 'number'); } @@ -149,11 +149,11 @@ test.serial( const secondReturnedRows = getSecondReferencedTableRowsRO.rows; for (const row of secondReturnedRows) { t.is(typeof row.order_id, 'object'); - t.truthy(row.order_id.hasOwnProperty('order_id')); + t.truthy(Object.hasOwn(row.order_id, 'order_id')); t.truthy(row.order_id.order_id); t.truthy(typeof row.order_id.order_id === 'number'); t.is(typeof row.customer_id, 'object'); - t.truthy(row.customer_id.hasOwnProperty('customer_id')); + t.truthy(Object.hasOwn(row.customer_id, 'customer_id')); t.truthy(row.customer_id.customer_id); t.truthy(typeof row.customer_id.customer_id === 'number'); } @@ -187,7 +187,7 @@ test.serial( .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const getMainTableRowsRO = JSON.parse(getMainTableRowsResponse.text); + const _getMainTableRowsRO = JSON.parse(getMainTableRowsResponse.text); t.is(getMainTableRowsResponse.status, 200); const getFirstReferencedTableRowsResponse = await request(app.getHttpServer()) @@ -203,7 +203,7 @@ test.serial( for (const element of firstReturnedRows) { t.is(typeof element.customer_id, 'object'); - t.truthy(element.customer_id.hasOwnProperty('customer_id')); + t.truthy(Object.hasOwn(element.customer_id, 'customer_id')); t.truthy(element.customer_id.customer_id); t.truthy(typeof element.customer_id.customer_id === 'number'); } @@ -220,7 +220,7 @@ test.serial( const secondReturnedRows = getSecondReferencedTableRowsRO.rows; for (const element of secondReturnedRows) { t.is(typeof element.order_id, 'object'); - t.truthy(element.order_id.hasOwnProperty('order_id')); + t.truthy(Object.hasOwn(element.order_id, 'order_id')); t.truthy(element.order_id.order_id); t.truthy(typeof element.order_id.order_id === 'number'); } diff --git a/backend/test/ava-tests/complex-table-tests/complex-postgres-table-e2e.test.ts b/backend/test/ava-tests/complex-table-tests/complex-postgres-table-e2e.test.ts index c9e3d023..3201a35f 100644 --- a/backend/test/ava-tests/complex-table-tests/complex-postgres-table-e2e.test.ts +++ b/backend/test/ava-tests/complex-table-tests/complex-postgres-table-e2e.test.ts @@ -27,8 +27,8 @@ const __dirname = path.dirname(__filename); const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; -const testSearchedUserName = 'Vasia'; +let _testUtils: TestUtils; +const _testSearchedUserName = 'Vasia'; const connectionToTestDB = getTestData(mockFactory).connectionToPostgres; let testTablesCompositeKeysData: TableCreationResult; @@ -40,7 +40,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication() as any; - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -113,7 +113,7 @@ test.serial( .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const getMainTableRowsRO = JSON.parse(getMainTableRowsResponse.text); + const _getMainTableRowsRO = JSON.parse(getMainTableRowsResponse.text); t.is(getMainTableRowsResponse.status, 200); const getFirstReferencedTableRowsResponse = await request(app.getHttpServer()) @@ -129,11 +129,11 @@ test.serial( for (const row of firstReturnedRows) { t.is(typeof row.order_id, 'object'); - t.truthy(row.order_id.hasOwnProperty('order_id')); + t.truthy(Object.hasOwn(row.order_id, 'order_id')); t.truthy(row.order_id.order_id); t.truthy(typeof row.order_id.order_id === 'number'); t.is(typeof row.customer_id, 'object'); - t.truthy(row.customer_id.hasOwnProperty('customer_id')); + t.truthy(Object.hasOwn(row.customer_id, 'customer_id')); t.truthy(row.customer_id.customer_id); t.truthy(typeof row.customer_id.customer_id === 'number'); } @@ -149,11 +149,11 @@ test.serial( const secondReturnedRows = getSecondReferencedTableRowsRO.rows; for (const row of secondReturnedRows) { t.is(typeof row.order_id, 'object'); - t.truthy(row.order_id.hasOwnProperty('order_id')); + t.truthy(Object.hasOwn(row.order_id, 'order_id')); t.truthy(row.order_id.order_id); t.truthy(typeof row.order_id.order_id === 'number'); t.is(typeof row.customer_id, 'object'); - t.truthy(row.customer_id.hasOwnProperty('customer_id')); + t.truthy(Object.hasOwn(row.customer_id, 'customer_id')); t.truthy(row.customer_id.customer_id); t.truthy(typeof row.customer_id.customer_id === 'number'); } @@ -187,7 +187,7 @@ test.serial( .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const getMainTableRowsRO = JSON.parse(getMainTableRowsResponse.text); + const _getMainTableRowsRO = JSON.parse(getMainTableRowsResponse.text); t.is(getMainTableRowsResponse.status, 200); const getFirstReferencedTableRowsResponse = await request(app.getHttpServer()) @@ -203,7 +203,7 @@ test.serial( for (const element of firstReturnedRows) { t.is(typeof element.customer_id, 'object'); - t.truthy(element.customer_id.hasOwnProperty('customer_id')); + t.truthy(Object.hasOwn(element.customer_id, 'customer_id')); t.truthy(element.customer_id.customer_id); t.truthy(typeof element.customer_id.customer_id === 'number'); } @@ -220,7 +220,7 @@ test.serial( const secondReturnedRows = getSecondReferencedTableRowsRO.rows; for (const element of secondReturnedRows) { t.is(typeof element.order_id, 'object'); - t.truthy(element.order_id.hasOwnProperty('order_id')); + t.truthy(Object.hasOwn(element.order_id, 'order_id')); t.truthy(element.order_id.order_id); t.truthy(typeof element.order_id.order_id === 'number'); } diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-company-info-e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-company-info-e2e.test.ts index 2c290a59..2b92b891 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-company-info-e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-company-info-e2e.test.ts @@ -22,9 +22,9 @@ import { Messages } from '../../../src/exceptions/text/messages.js'; import { Cacher } from '../../../src/helpers/cache/cacher.js'; import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; -const mockFactory = new MockFactory(); +const _mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; let currentTest: string; test.before(async () => { @@ -34,7 +34,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication() as any; - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -80,8 +80,8 @@ test.serial(`${currentTest} should return found company info for user`, async (t t.is(foundCompanyInfo.status, 200); const foundCompanyInfoRO = JSON.parse(foundCompanyInfo.text); - t.is(foundCompanyInfoRO.hasOwnProperty('id'), true); - t.is(foundCompanyInfoRO.hasOwnProperty('name'), true); + t.is(Object.hasOwn(foundCompanyInfoRO, 'id'), true); + t.is(Object.hasOwn(foundCompanyInfoRO, 'name'), true); t.is(Object.keys(foundCompanyInfoRO).length, 8); } catch (error) { console.error(error); @@ -120,33 +120,33 @@ test.serial(`${currentTest} should return full found company info for company ad // ); t.is(foundCompanyInfo.status, 200); - t.is(foundCompanyInfoRO.hasOwnProperty('id'), true); - t.is(foundCompanyInfoRO.hasOwnProperty('name'), true); + t.is(Object.hasOwn(foundCompanyInfoRO, 'id'), true); + t.is(Object.hasOwn(foundCompanyInfoRO, 'name'), true); t.is(Object.keys(foundCompanyInfoRO).length, 10); - t.is(foundCompanyInfoRO.hasOwnProperty('connections'), true); + t.is(Object.hasOwn(foundCompanyInfoRO, 'connections'), true); t.is(foundCompanyInfoRO.connections.length > 0, true); - t.is(foundCompanyInfoRO.hasOwnProperty('invitations'), true); + t.is(Object.hasOwn(foundCompanyInfoRO, 'invitations'), true); t.is(foundCompanyInfoRO.invitations.length, 0); t.is(Object.keys(foundCompanyInfoRO.connections[0]).length, 7); - t.is(foundCompanyInfoRO.connections[0].hasOwnProperty('id'), true); - t.is(foundCompanyInfoRO.connections[0].hasOwnProperty('title'), true); - t.is(foundCompanyInfoRO.connections[0].hasOwnProperty('createdAt'), true); - t.is(foundCompanyInfoRO.connections[0].hasOwnProperty('updatedAt'), true); - t.is(foundCompanyInfoRO.connections[0].hasOwnProperty('author'), true); - t.is(foundCompanyInfoRO.connections[0].hasOwnProperty('groups'), true); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0], 'id'), true); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0], 'title'), true); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0], 'createdAt'), true); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0], 'updatedAt'), true); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0], 'author'), true); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0], 'groups'), true); t.is(foundCompanyInfoRO.connections[0].groups.length > 0, true); t.is(Object.keys(foundCompanyInfoRO.connections[0].groups[0]).length, 4); - t.is(foundCompanyInfoRO.connections[0].groups[0].hasOwnProperty('id'), true); - t.is(foundCompanyInfoRO.connections[0].groups[0].hasOwnProperty('title'), true); - t.is(foundCompanyInfoRO.connections[0].groups[0].hasOwnProperty('isMain'), true); - t.is(foundCompanyInfoRO.connections[0].groups[0].hasOwnProperty('users'), true); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0], 'id'), true); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0], 'title'), true); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0], 'isMain'), true); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0], 'users'), true); t.is(foundCompanyInfoRO.connections[0].groups[0].users.length > 0, true); t.is(Object.keys(foundCompanyInfoRO.connections[0].groups[0].users[0]).length, 9); - t.is(foundCompanyInfoRO.connections[0].groups[0].users[0].hasOwnProperty('id'), true); - t.is(foundCompanyInfoRO.connections[0].groups[0].users[0].hasOwnProperty('email'), true); - t.is(foundCompanyInfoRO.connections[0].groups[0].users[0].hasOwnProperty('role'), true); - t.is(foundCompanyInfoRO.connections[0].groups[0].users[0].hasOwnProperty('createdAt'), true); - t.is(foundCompanyInfoRO.connections[0].groups[0].users[0].hasOwnProperty('password'), false); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0].users[0], 'id'), true); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0].users[0], 'email'), true); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0].users[0], 'role'), true); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0].users[0], 'createdAt'), true); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0].users[0], 'password'), false); } catch (error) { console.error(error); throw error; @@ -174,8 +174,8 @@ test.serial(`${currentTest} should return found company info for non-admin user` const foundCompanyInfoRO = JSON.parse(foundCompanyInfo.text); t.is(foundCompanyInfo.status, 200); - t.is(foundCompanyInfoRO.hasOwnProperty('id'), true); - t.is(foundCompanyInfoRO.hasOwnProperty('name'), true); + t.is(Object.hasOwn(foundCompanyInfoRO, 'id'), true); + t.is(Object.hasOwn(foundCompanyInfoRO, 'name'), true); t.is(Object.keys(foundCompanyInfoRO).length, 8); } catch (error) { console.error(error); @@ -207,7 +207,7 @@ test.serial(`${currentTest} should return found company infos for admin user`, a t.is(foundCompanyInfo.status, 200); t.is(Array.isArray(foundCompanyInfoRO), true); t.is(foundCompanyInfoRO.length, 1); - t.is(foundCompanyInfoRO[0].hasOwnProperty('id'), true); + t.is(Object.hasOwn(foundCompanyInfoRO[0], 'id'), true); } catch (error) { console.error(error); throw error; @@ -236,7 +236,7 @@ test.serial(`${currentTest} should return found company infos for non-admin user t.is(foundCompanyInfo.status, 200); t.is(Array.isArray(foundCompanyInfoRO), true); t.is(foundCompanyInfoRO.length, 1); - t.is(foundCompanyInfoRO[0].hasOwnProperty('id'), true); + t.is(Object.hasOwn(foundCompanyInfoRO[0], 'id'), true); } catch (error) { console.error(error); throw error; @@ -267,8 +267,8 @@ test.serial(`${currentTest} should remove user from company`, async (t) => { t.is(foundCompanyInfo.status, 200); - const allGroupsInResult = foundCompanyInfoRO.connections.map((connection) => connection.groups).flat(); - const allUsersInResult = allGroupsInResult.map((group) => group.users).flat(); + const allGroupsInResult = foundCompanyInfoRO.connections.flatMap((connection) => connection.groups); + const allUsersInResult = allGroupsInResult.flatMap((group) => group.users); const foundSimpleUserInResult = allUsersInResult.find((user) => user.email === simpleUserEmail.toLowerCase()); t.is(foundSimpleUserInResult.email, simpleUserEmail.toLowerCase()); @@ -293,9 +293,8 @@ test.serial(`${currentTest} should remove user from company`, async (t) => { const foundCompanyInfoROAfterUserDeletion = JSON.parse(foundCompanyInfoAfterUserDeletion.text); const allGroupsInResultAfterUserDeletion = foundCompanyInfoROAfterUserDeletion.connections - .map((connection) => connection.groups) - .flat(); - const allUsersInResultAfterUserDeletion = allGroupsInResultAfterUserDeletion.map((group) => group.users).flat(); + .flatMap((connection) => connection.groups); + const allUsersInResultAfterUserDeletion = allGroupsInResultAfterUserDeletion.flatMap((group) => group.users); const foundSimpleUserInResultAfterUserDeletion = !!allUsersInResultAfterUserDeletion.find( (user) => user.email === simpleUserEmail, ); @@ -330,11 +329,11 @@ test.serial(`${currentTest} should remove user invitation from company`, async ( const foundCompanyInfoRO = JSON.parse(foundCompanyInfo.text); t.is(foundCompanyInfoRO.invitations.length, 0); - const allGroupsInResult = foundCompanyInfoRO.connections.map((connection) => connection.groups).flat(); - const allUsersInResult = allGroupsInResult.map((group) => group.users).flat(); + const allGroupsInResult = foundCompanyInfoRO.connections.flatMap((connection) => connection.groups); + const allUsersInResult = allGroupsInResult.flatMap((group) => group.users); const foundSimpleUserInResult = allUsersInResult.find((user) => user.email === simpleUserEmail.toLowerCase()); - const removeUserFromCompanyResult = await request(app.getHttpServer()) + const _removeUserFromCompanyResult = await request(app.getHttpServer()) .delete(`/company/${foundCompanyInfoRO.id}/user/${foundSimpleUserInResult.id}`) .set('Content-Type', 'application/json') .set('Cookie', adminUserToken) @@ -412,7 +411,7 @@ test.serial(`${currentTest} should update company name`, async (t) => { t.is(foundCompanyInfo.status, 200); const foundCompanyInfoRO = JSON.parse(foundCompanyInfo.text); - t.is(foundCompanyInfoRO.hasOwnProperty('name'), true); + t.is(Object.hasOwn(foundCompanyInfoRO, 'name'), true); const newName = `${faker.company.name()}_${nanoid(5)}`; @@ -434,7 +433,7 @@ test.serial(`${currentTest} should update company name`, async (t) => { t.is(foundCompanyInfo.status, 200); const foundCompanyInfoROAfterUpdate = JSON.parse(foundCompanyInfoAfterUpdate.text); - t.is(foundCompanyInfoROAfterUpdate.hasOwnProperty('name'), true); + t.is(Object.hasOwn(foundCompanyInfoROAfterUpdate, 'name'), true); t.is(foundCompanyInfoROAfterUpdate.name, newName); }); @@ -468,7 +467,7 @@ test.serial(`${currentTest} should return company name`, async (t) => { t.is(foundCompanyName.status, 200); const foundCompanyNameRO = JSON.parse(foundCompanyName.text); - t.is(foundCompanyNameRO.hasOwnProperty('name'), true); + t.is(Object.hasOwn(foundCompanyNameRO, 'name'), true); t.is(foundCompanyNameRO.name, foundCompanyInfoRO.name); t.pass(); }); @@ -567,7 +566,7 @@ test.skip(`${currentTest} should enable 2fa for company`, async (t) => { t.is(foundCompanyInfo.status, 200); const foundCompanyRo = JSON.parse(foundCompanyInfo.text); - t.is(foundCompanyRo.hasOwnProperty('is2faEnabled'), true); + t.is(Object.hasOwn(foundCompanyRo, 'is2faEnabled'), true); t.is(foundCompanyRo.is2faEnabled, false); const requestBody = { @@ -590,7 +589,7 @@ test.skip(`${currentTest} should enable 2fa for company`, async (t) => { t.is(foundCompanyInfoAfterUpdate.status, 200); const foundCompanyRoAfterUpdate = JSON.parse(foundCompanyInfoAfterUpdate.text); - t.is(foundCompanyRoAfterUpdate.hasOwnProperty('is2faEnabled'), true); + t.is(Object.hasOwn(foundCompanyRoAfterUpdate, 'is2faEnabled'), true); t.is(foundCompanyRoAfterUpdate.is2faEnabled, true); // user should not be able to use endpoints that require 2fa after login diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-connection-e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-connection-e2e.test.ts index 13fdfc49..a95a03a2 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-connection-e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-connection-e2e.test.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ -import { faker, tr } from '@faker-js/faker'; +import { faker, } from '@faker-js/faker'; import { INestApplication, ValidationPipe } from '@nestjs/common'; import { Test } from '@nestjs/testing'; import test from 'ava'; @@ -19,13 +19,11 @@ import { import { setSaasEnvVariable } from '../../utils/set-saas-env-variable.js'; import { ValidationException } from '../../../src/exceptions/custom-exceptions/validation-exception.js'; import { ValidationError } from 'class-validator'; -import { ErrorsMessages } from '../../../src/exceptions/custom-exceptions/messages/custom-errors-messages.js'; import { Cacher } from '../../../src/helpers/cache/cacher.js'; -import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; let currentTest: string; type RegisterUserData = { @@ -39,7 +37,7 @@ test.before(async () => { imports: [ApplicationModule, DatabaseModule], providers: [DatabaseService, TestUtils], }).compile(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app = moduleFixture.createNestApplication() as any; app.use(cookieParser()); @@ -80,7 +78,6 @@ function getTestData() { currentTest = '> GET /connections >'; test.serial(`${currentTest} should return all connections for this user`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); const findAllConnectionsResponse = await request(app.getHttpServer()) @@ -121,30 +118,26 @@ test.serial(`${currentTest} should return all connections for this user`, async const result = findAll.body.connections; t.is(result.length > 0, true); - t.is(result[0].hasOwnProperty('connection'), true); - t.is(result[1].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(result[0], 'connection'), true); + t.is(Object.hasOwn(result[1], 'accessLevel'), true); t.is(result[0].accessLevel, AccessLevelEnum.edit); - t.is(result[1].hasOwnProperty('accessLevel'), true); - t.is(result[0].connection.hasOwnProperty('host'), true); - t.is(result[1].connection.hasOwnProperty('host'), true); + t.is(Object.hasOwn(result[1], 'accessLevel'), true); + t.is(Object.hasOwn(result[0].connection, 'host'), true); + t.is(Object.hasOwn(result[1].connection, 'host'), true); t.is(typeof result[0].connection.port, 'number'); - t.is(result[1].connection.hasOwnProperty('username'), true); - t.is(result[0].connection.hasOwnProperty('database'), true); - t.is(result[1].connection.hasOwnProperty('sid'), true); - t.is(result[0].connection.hasOwnProperty('createdAt'), true); - t.is(result[1].connection.hasOwnProperty('updatedAt'), true); - t.is(result[0].connection.hasOwnProperty('password'), false); - t.is(result[1].connection.hasOwnProperty('groups'), false); + t.is(Object.hasOwn(result[1].connection, 'username'), true); + t.is(Object.hasOwn(result[0].connection, 'database'), true); + t.is(Object.hasOwn(result[1].connection, 'sid'), true); + t.is(Object.hasOwn(result[0].connection, 'createdAt'), true); + t.is(Object.hasOwn(result[1].connection, 'updatedAt'), true); + t.is(Object.hasOwn(result[0].connection, 'password'), false); + t.is(Object.hasOwn(result[1].connection, 'groups'), false); t.pass(); - } catch (e) { - throw e; - } }); currentTest = '> GET connection/users/:slug >'; test.serial(`${currentTest} should return all connection users`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); const createConnectionResponse = await request(app.getHttpServer()) @@ -170,15 +163,11 @@ test.serial(`${currentTest} should return all connection users`, async (t) => { t.is(foundUsersRO.length, 1); t.is(foundUsersRO[0].isActive, true); - t.is(foundUsersRO[0].hasOwnProperty('createdAt'), true); + t.is(Object.hasOwn(foundUsersRO[0], 'createdAt'), true); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should return all connection users from different groups`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); const createConnectionResponse = await request(app.getHttpServer()) @@ -202,7 +191,7 @@ test.serial(`${currentTest} should return all connection users from different gr t.is(createGroupResponse.status, 201); const createGroupRO = JSON.parse(createGroupResponse.text); - const secondUserRegisterInfo = await inviteUserInCompanyAndAcceptInvitation( + const _secondUserRegisterInfo = await inviteUserInCompanyAndAcceptInvitation( token, undefined, app, @@ -234,19 +223,15 @@ test.serial(`${currentTest} should return all connection users from different gr t.is(foundUsersRO[0].isActive, true); t.is(foundUsersRO[1].isActive, true); - t.is(foundUsersRO[1].hasOwnProperty('email'), true); - t.is(foundUsersRO[0].hasOwnProperty('email'), true); - t.is(foundUsersRO[0].hasOwnProperty('createdAt'), true); - t.is(foundUsersRO[1].hasOwnProperty('createdAt'), true); + t.is(Object.hasOwn(foundUsersRO[1], 'email'), true); + t.is(Object.hasOwn(foundUsersRO[0], 'email'), true); + t.is(Object.hasOwn(foundUsersRO[0], 'createdAt'), true); + t.is(Object.hasOwn(foundUsersRO[1], 'createdAt'), true); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw an exception, when connection id is incorrect`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); const createConnectionResponse = await request(app.getHttpServer()) @@ -268,7 +253,7 @@ test.serial(`${currentTest} should throw an exception, when connection id is inc t.is(createGroupResponse.status, 201); const createGroupRO = JSON.parse(createGroupResponse.text); - const secondUserRegisterInfo = await inviteUserInCompanyAndAcceptInvitation( + const _secondUserRegisterInfo = await inviteUserInCompanyAndAcceptInvitation( token, undefined, app, @@ -299,14 +284,10 @@ test.serial(`${currentTest} should throw an exception, when connection id is inc t.is(findAllUsersRO.message, Messages.DONT_HAVE_PERMISSIONS); t.pass(); - } catch (e) { - throw e; - } }); currentTest = 'GET /connection/one/:slug'; test.serial(`${currentTest} should return a found connection`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -336,22 +317,18 @@ test.serial(`${currentTest} should return a found connection`, async (t) => { t.is(result.username, 'postgres'); t.is(result.database, 'nestjs_testing'); t.is(result.sid, null); - t.is(result.hasOwnProperty('createdAt'), true); - t.is(result.hasOwnProperty('updatedAt'), true); - t.is(result.hasOwnProperty('password'), false); - t.is(result.hasOwnProperty('groups'), false); - t.is(result.hasOwnProperty('author'), false); + t.is(Object.hasOwn(result, 'createdAt'), true); + t.is(Object.hasOwn(result, 'updatedAt'), true); + t.is(Object.hasOwn(result, 'password'), false); + t.is(Object.hasOwn(result, 'groups'), false); + t.is(Object.hasOwn(result, 'author'), false); t.pass(); - } catch (e) { - throw e; - } }); test.serial( `${currentTest} should throw an exception "id is missing" when connection id not passed in the request`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -375,15 +352,11 @@ test.serial( t.is(message, Messages.UUID_INVALID); t.pass(); - } catch (e) { - throw e; - } }, ); currentTest = 'POST /connection'; test.serial(`${currentTest} should return created connection`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -405,10 +378,10 @@ test.serial(`${currentTest} should return created connection`, async (t) => { t.is(result.username, 'postgres'); t.is(result.database, 'nestjs_testing'); t.is(result.sid, null); - t.is(result.hasOwnProperty('createdAt'), true); - t.is(result.hasOwnProperty('updatedAt'), true); - t.is(result.hasOwnProperty('password'), false); - t.is(result.hasOwnProperty('groups'), true); + t.is(Object.hasOwn(result, 'createdAt'), true); + t.is(Object.hasOwn(result, 'updatedAt'), true); + t.is(Object.hasOwn(result, 'password'), false); + t.is(Object.hasOwn(result, 'groups'), true); t.is(typeof result.groups, 'object'); t.is(result.groups.length >= 1, true); @@ -421,13 +394,9 @@ test.serial(`${currentTest} should return created connection`, async (t) => { t.is(index >= 0, true); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw error when create connection without type`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -444,13 +413,9 @@ test.serial(`${currentTest} should throw error when create connection without ty // t.is(message, ErrorsMessages.VALIDATION_FAILED); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw error when create connection without host`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); delete newConnection.host; @@ -466,13 +431,9 @@ test.serial(`${currentTest} should throw error when create connection without ho t.is(message, Messages.HOST_MISSING); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw error when create connection without port`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); delete newConnection.port; @@ -488,13 +449,9 @@ test.serial(`${currentTest} should throw error when create connection without po t.is(message, `${Messages.PORT_MISSING}, ${Messages.PORT_FORMAT_INCORRECT}`); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw error when create connection wit port value more than 65535`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); newConnection.port = 65536; @@ -510,13 +467,9 @@ test.serial(`${currentTest} should throw error when create connection wit port v // t.is(message, ErrorsMessages.VALIDATION_FAILED); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw error when create connection wit port value less than 0`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -532,13 +485,9 @@ test.serial(`${currentTest} should throw error when create connection wit port v const { message } = JSON.parse(response.text); // t.is(message, ErrorsMessages.VALIDATION_FAILED); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw error when create connection without username`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); delete newConnection.username; @@ -554,13 +503,9 @@ test.serial(`${currentTest} should throw error when create connection without us t.is(message, Messages.USERNAME_MISSING); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw error when create connection without database`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); delete newConnection.database; @@ -576,13 +521,9 @@ test.serial(`${currentTest} should throw error when create connection without da t.is(message, Messages.DATABASE_MISSING); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw error when create connection without password`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); delete newConnection.password; @@ -597,15 +538,11 @@ test.serial(`${currentTest} should throw error when create connection without pa const { message } = JSON.parse(response.text); t.is(message, Messages.PASSWORD_MISSING); t.pass(); - } catch (e) { - throw e; - } }); test.serial( `${currentTest} should throw error with complex message when create connection without database, type, port`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); delete newConnection.database; @@ -624,15 +561,11 @@ test.serial( // t.is(message, ErrorsMessages.VALIDATION_FAILED); t.pass(); - } catch (e) { - throw e; - } }, ); currentTest = 'PUT /connection'; test.serial(`${currentTest} should return updated connection`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); const createConnectionResponse = await request(app.getHttpServer()) @@ -661,19 +594,15 @@ test.serial(`${currentTest} should return updated connection`, async (t) => { t.is(result.username, 'admin'); t.is(result.database, 'testing_nestjs'); t.is(result.sid, null); - t.is(result.hasOwnProperty('createdAt'), true); - t.is(result.hasOwnProperty('updatedAt'), true); - t.is(result.hasOwnProperty('password'), false); - t.is(result.hasOwnProperty('groups'), false); + t.is(Object.hasOwn(result, 'createdAt'), true); + t.is(Object.hasOwn(result, 'updatedAt'), true); + t.is(Object.hasOwn(result, 'password'), false); + t.is(Object.hasOwn(result, 'groups'), false); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} 'should throw error when update connection without type'`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); const createConnectionResponse = await request(app.getHttpServer()) @@ -698,13 +627,9 @@ test.serial(`${currentTest} 'should throw error when update connection without t // t.is(message, ErrorsMessages.VALIDATION_FAILED); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw error when update connection without host`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); const createConnectionResponse = await request(app.getHttpServer()) @@ -728,13 +653,9 @@ test.serial(`${currentTest} should throw error when update connection without ho const { message } = JSON.parse(response.text); t.is(message, Messages.HOST_MISSING); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw error when update connection without port`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -760,13 +681,9 @@ test.serial(`${currentTest} should throw error when update connection without po t.is(message, `${Messages.PORT_MISSING}, ${Messages.PORT_FORMAT_INCORRECT}`); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw error when update connection wit port value more than 65535`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); const createConnectionResponse = await request(app.getHttpServer()) @@ -791,13 +708,9 @@ test.serial(`${currentTest} should throw error when update connection wit port v // t.is(message, ErrorsMessages.VALIDATION_FAILED); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw error when update connection wit port value less than 0`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -823,13 +736,9 @@ test.serial(`${currentTest} should throw error when update connection wit port v // t.is(message, ErrorsMessages.VALIDATION_FAILED); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw error when update connection without username`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); const createConnectionResponse = await request(app.getHttpServer()) @@ -854,13 +763,9 @@ test.serial(`${currentTest} should throw error when update connection without us t.is(message, Messages.USERNAME_MISSING); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw error when update connection without database`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -887,15 +792,11 @@ test.serial(`${currentTest} should throw error when update connection without da t.is(message, Messages.DATABASE_MISSING); t.pass(); - } catch (e) { - throw e; - } }); test.serial( `${currentTest} should throw error with complex message when update connection without database, type, port`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -923,15 +824,11 @@ test.serial( // t.is(message, ErrorsMessages.VALIDATION_FAILED); t.pass(); - } catch (e) { - throw e; - } }, ); currentTest = 'DELETE /connection/:slug'; test.serial(`${currentTest} should return delete result`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); const createConnectionResult = await request(app.getHttpServer()) @@ -964,7 +861,7 @@ test.serial(`${currentTest} should return delete result`, async (t) => { const { message } = JSON.parse(findOneResponce.text); t.is(message, Messages.CONNECTION_NOT_FOUND); - t.is(result.hasOwnProperty('id'), false); + t.is(Object.hasOwn(result, 'id'), false); t.is(result.title, 'Test Connection'); t.is(result.type, 'postgres'); t.is(result.host, 'nestjs_testing'); @@ -973,19 +870,15 @@ test.serial(`${currentTest} should return delete result`, async (t) => { t.is(result.username, 'postgres'); t.is(result.database, 'nestjs_testing'); t.is(result.sid, null); - t.is(result.hasOwnProperty('createdAt'), true); - t.is(result.hasOwnProperty('updatedAt'), true); - t.is(result.hasOwnProperty('password'), false); - t.is(result.hasOwnProperty('groups'), false); - t.is(result.hasOwnProperty('author'), false); + t.is(Object.hasOwn(result, 'createdAt'), true); + t.is(Object.hasOwn(result, 'updatedAt'), true); + t.is(Object.hasOwn(result, 'password'), false); + t.is(Object.hasOwn(result, 'groups'), false); + t.is(Object.hasOwn(result, 'author'), false); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw an exception when connection not found`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1010,13 +903,9 @@ test.serial(`${currentTest} should throw an exception when connection not found` const { message } = JSON.parse(response.text); t.is(message, Messages.DONT_HAVE_PERMISSIONS); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw an exception when connection id not passed in the request`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1039,14 +928,10 @@ test.serial(`${currentTest} should throw an exception when connection id not pas t.is(response.status, 404); t.pass(); - } catch (e) { - throw e; - } }); currentTest = 'POST /connection/group/:slug'; test.serial(`${currentTest} should return a created group`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token, email } = await registerUserAndReturnUserInfo(app); @@ -1070,20 +955,16 @@ test.serial(`${currentTest} should return a created group`, async (t) => { const result = JSON.parse(createGroupResponse.text); t.is(result.title, newGroup1.title); - t.is(result.hasOwnProperty('users'), true); + t.is(Object.hasOwn(result, 'users'), true); t.is(typeof result.users, 'object'); t.is(result.users.length, 1); t.is(result.users[0].email, email); t.is(result.users[0].isActive, true); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} throw an exception when connectionId not passed in request`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1106,13 +987,9 @@ test.serial(`${currentTest} throw an exception when connectionId not passed in r t.is(createGroupResponse.status, 404); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} throw an exception when group title not passed in request`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1138,13 +1015,9 @@ test.serial(`${currentTest} throw an exception when group title not passed in re // t.is(message, ErrorsMessages.VALIDATION_FAILED); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} throw an exception when connectionId is incorrect`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1170,13 +1043,9 @@ test.serial(`${currentTest} throw an exception when connectionId is incorrect`, t.is(message, Messages.DONT_HAVE_PERMISSIONS); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} throw an exception when group name is not unique`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1202,14 +1071,10 @@ test.serial(`${currentTest} throw an exception when group name is not unique`, a t.is(message, Messages.GROUP_NAME_UNIQUE); t.pass(); - } catch (e) { - throw e; - } }); currentTest = 'PUT /connection/group/delete/:slug'; test.serial(`${currentTest} should return connection without deleted group result`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1234,7 +1099,7 @@ test.serial(`${currentTest} should return connection without deleted group resul t.is(createGroupResponse.status, 201); - t.is(result.hasOwnProperty('id'), true); + t.is(Object.hasOwn(result, 'id'), true); t.is(result.title, newGroup1.title); const createGroupRO = JSON.parse(createGroupResponse.text); @@ -1250,7 +1115,7 @@ test.serial(`${currentTest} should return connection without deleted group resul result = response.body; t.is(response.status, 200); - t.is(result.hasOwnProperty('title'), true); + t.is(Object.hasOwn(result, 'title'), true); t.is(result.title, createGroupRO.title); t.is(result.isMain, false); // check that group was deleted @@ -1264,9 +1129,9 @@ test.serial(`${currentTest} should return connection without deleted group resul t.is(response.status, 200); result = JSON.parse(response.text); t.is(result.length, 1); - const groupId = result[0].group.id; + const _groupId = result[0].group.id; - t.is(result[0].group.hasOwnProperty('title'), true); + t.is(Object.hasOwn(result[0].group, 'title'), true); t.is(result[0].accessLevel, AccessLevelEnum.edit); const index = result @@ -1278,23 +1143,15 @@ test.serial(`${currentTest} should return connection without deleted group resul t.is(index >= 0, true); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest}`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw an exception when connection id is not passed in the request`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); const createConnectionResult = await request(app.getHttpServer()) @@ -1318,7 +1175,7 @@ test.serial(`${currentTest} should throw an exception when connection id is not t.is(createGroupResponse.status, 201); - t.is(result.hasOwnProperty('id'), true); + t.is(Object.hasOwn(result, 'id'), true); t.is(result.title, newGroup1.title); const createGroupRO = JSON.parse(createGroupResponse.text); @@ -1332,13 +1189,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not t.is(response.status, 404); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw an exception when group id is not passed in the request`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1362,7 +1215,7 @@ test.serial(`${currentTest} should throw an exception when group id is not passe t.is(createGroupResponse.status, 201); - t.is(result.hasOwnProperty('id'), true); + t.is(Object.hasOwn(result, 'id'), true); t.is(result.title, newGroup1.title); const createGroupRO = JSON.parse(createGroupResponse.text); @@ -1379,13 +1232,9 @@ test.serial(`${currentTest} should throw an exception when group id is not passe t.is(message, Messages.PARAMETER_NAME_MISSING('groupId')); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw an exception when group id is incorrect`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1410,7 +1259,7 @@ test.serial(`${currentTest} should throw an exception when group id is incorrect t.is(createGroupResponse.status, 201); - t.is(result.hasOwnProperty('id'), true); + t.is(Object.hasOwn(result, 'id'), true); t.is(result.title, newGroup1.title); const createGroupRO = JSON.parse(createGroupResponse.text); @@ -1427,13 +1276,9 @@ test.serial(`${currentTest} should throw an exception when group id is incorrect t.is(message, Messages.GROUP_NOT_FOUND); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw an exception when connection id is incorrect`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1458,7 +1303,7 @@ test.serial(`${currentTest} should throw an exception when connection id is inco t.is(createGroupResponse.status, 201); - t.is(result.hasOwnProperty('id'), true); + t.is(Object.hasOwn(result, 'id'), true); t.is(result.title, newGroup1.title); const createGroupRO = JSON.parse(createGroupResponse.text); @@ -1475,13 +1320,9 @@ test.serial(`${currentTest} should throw an exception when connection id is inco t.is(message, Messages.DONT_HAVE_PERMISSIONS); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw an exception when trying delete admin group`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1506,14 +1347,10 @@ test.serial(`${currentTest} should throw an exception when trying delete admin g t.is(message, Messages.CANT_DELETE_ADMIN_GROUP); t.pass(); - } catch (e) { - throw e; - } }); currentTest = 'PUT /connection/encryption/restore/:slug'; test.serial(`${currentTest} should return restored connection`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1556,14 +1393,10 @@ test.serial(`${currentTest} should return restored connection`, async (t) => { t.is(groupIdInRestoredConnection, groupId); t.pass(); - } catch (e) { - throw e; - } }); currentTest = 'GET /connection/groups/:slug'; test.serial(`${currentTest} should groups in connection`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1593,9 +1426,9 @@ test.serial(`${currentTest} should groups in connection`, async (t) => { t.is(response.status, 200); const result = JSON.parse(response.text); - const groupId = result[0].group.id; + const _groupId = result[0].group.id; - t.is(result[1].group.hasOwnProperty('title'), true); + t.is(Object.hasOwn(result[1].group, 'title'), true); t.is(result[0].accessLevel, AccessLevelEnum.edit); const index = result @@ -1607,13 +1440,9 @@ test.serial(`${currentTest} should groups in connection`, async (t) => { t.is(index >= 0, true); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw an exception when connection id not passed in the request`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1645,13 +1474,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas t.is(response.status, 404); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw an exception when connection id is invalid`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); const createConnectionResponse = await request(app.getHttpServer()) @@ -1685,9 +1510,6 @@ test.serial(`${currentTest} should throw an exception when connection id is inva t.is(getGroupsRO.length, 0); t.pass(); - } catch (e) { - throw e; - } }); //todo realise diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-connection-properties-e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-connection-properties-e2e.test.ts index 7958b963..4c24e0e9 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-connection-properties-e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-connection-properties-e2e.test.ts @@ -16,12 +16,11 @@ import { setSaasEnvVariable } from '../../utils/set-saas-env-variable.js'; import { ValidationException } from '../../../src/exceptions/custom-exceptions/validation-exception.js'; import { ValidationError } from 'class-validator'; import { Cacher } from '../../../src/helpers/cache/cacher.js'; -import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; -let newConnection; +let _testUtils: TestUtils; +let _newConnection; let newConnectionProperties; let testTableName: string; const testTableColumnName = 'name'; @@ -37,7 +36,7 @@ test.before(async () => { imports: [ApplicationModule, DatabaseModule], providers: [DatabaseService, TestUtils], }).compile(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app = moduleFixture.createNestApplication(); app.use(cookieParser()); @@ -63,7 +62,7 @@ test.after(async () => { async function resetPostgresTestDB(testTableName) { const Knex = getTestKnex(mockFactory.generateConnectionToTestPostgresDBInDocker()); - await Knex.schema.createTableIfNotExists(testTableName, function (table) { + await Knex.schema.createTableIfNotExists(testTableName, (table) => { table.increments(); table.string(testTableColumnName); table.string(testTAbleSecondColumnName); @@ -89,7 +88,7 @@ async function resetPostgresTestDB(testTableName) { } } -test.beforeEach(async (t) => { +test.beforeEach(async (_t) => { testTableName = `${faker.lorem.words(1)}_${faker.string.uuid()}`; testTables.push(testTableName); newConnectionProperties = mockFactory.generateConnectionPropertiesUserExcluded(testTableName); @@ -122,7 +121,6 @@ function getTestData() { currentTest = 'POST /connection/properties/:slug'; test.serial(`${currentTest} should return created connection properties`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -151,13 +149,9 @@ test.serial(`${currentTest} should return created connection properties`, async t.is(createConnectionPropertiesRO.hostname, newConnectionProperties.hostname); t.is(createConnectionPropertiesRO.human_readable_table_names, newConnectionProperties.human_readable_table_names); t.is(createConnectionPropertiesRO.tables_audit, newConnectionProperties.tables_audit); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should return connection without excluded tables`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -190,13 +184,9 @@ test.serial(`${currentTest} should return connection without excluded tables`, a t.is(getConnectionTablesRO.length > 0, true); const hiddenTable = getConnectionTablesRO.find((table) => table.name === newConnectionProperties.hidden_tables[0]); t.is(hiddenTable, undefined); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw an exception when excluded table name is incorrect`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -219,16 +209,12 @@ test.serial(`${currentTest} should throw an exception when excluded table name i .set('Cookie', token) .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const createConnectionPropertiesRO = JSON.parse(createConnectionPropertiesResponse.text); + const _createConnectionPropertiesRO = JSON.parse(createConnectionPropertiesResponse.text); t.is(createConnectionPropertiesResponse.status, 400); - } catch (e) { - throw e; - } }); currentTest = 'GET /connection/properties/:slug'; test.serial(`${currentTest} should return connection properties`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -258,13 +244,9 @@ test.serial(`${currentTest} should return connection properties`, async (t) => { const getConnectionPropertiesRO = JSON.parse(getConnectionPropertiesResponse.text); t.is(getConnectionPropertiesRO.hidden_tables[0], newConnectionProperties.hidden_tables[0]); t.is(getConnectionPropertiesRO.connectionId, createConnectionRO.id); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw exception when connection id is incorrect`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -291,14 +273,10 @@ test.serial(`${currentTest} should throw exception when connection id is incorre .set('Content-Type', 'application/json') .set('Accept', 'application/json'); t.is(getConnectionPropertiesResponse.status, 403); - } catch (e) { - throw e; - } }); currentTest = 'DELETE /connection/properties/:slug'; test.serial(`${currentTest} should return deleted connection properties`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -346,16 +324,10 @@ test.serial(`${currentTest} should return deleted connection properties`, async .set('Content-Type', 'application/json') .set('Accept', 'application/json'); t.is(createConnectionPropertiesResponse.status, 201); - const getConnectionPropertiesAfterDeletionRO = getConnectionPropertiesResponseAfterDeletion.text; - //todo check - // t.is(JSON.stringify(getConnectionPropertiesAfterDeletionRO)).toBe(null); - } catch (e) { - throw e; - } + const _getConnectionPropertiesAfterDeletionRO = getConnectionPropertiesResponseAfterDeletion.text; }); test.serial(`${currentTest} should throw exception when connection id is incorrect`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -382,14 +354,10 @@ test.serial(`${currentTest} should throw exception when connection id is incorre .set('Content-Type', 'application/json') .set('Accept', 'application/json'); t.is(getConnectionPropertiesResponse.status, 403); - } catch (e) { - throw e; - } }); currentTest = 'PUT /connection/properties/:slug'; test.serial(`${currentTest} should return updated connection properties`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -412,9 +380,6 @@ test.serial(`${currentTest} should return updated connection properties`, async t.is(createConnectionPropertiesResponse.status, 201); t.is(createConnectionPropertiesRO.hidden_tables[0], newConnectionProperties.hidden_tables[0]); t.is(createConnectionPropertiesRO.connectionId, createConnectionRO.id); - } catch (e) { - throw e; - } }); // test.serial(`${currentTest} `, async (t) => { diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-custom-field-e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-custom-field-e2e.test.ts index 62852596..a991952d 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-custom-field-e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-custom-field-e2e.test.ts @@ -19,22 +19,21 @@ import { AllExceptionsFilter } from '../../../src/exceptions/all-exceptions.filt import { setSaasEnvVariable } from '../../utils/set-saas-env-variable.js'; import { ValidationException } from '../../../src/exceptions/custom-exceptions/validation-exception.js'; import { ValidationError } from 'class-validator'; -import { ErrorsMessages } from '../../../src/exceptions/custom-exceptions/messages/custom-errors-messages.js'; import { Cacher } from '../../../src/helpers/cache/cacher.js'; import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const mockFactory = new MockFactory(); const masterPwd = 'ahalaimahalai'; -const decryptValue = (data) => { +const _decryptValue = (data) => { return Encryptor.decryptData(data); }; -const decryptValueMaterPwd = (data) => { +const _decryptValueMaterPwd = (data) => { return Encryptor.decryptDataMasterPwd(data, masterPwd); }; @@ -45,7 +44,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -122,7 +121,7 @@ test.serial(`${currentTest} should return custom fields array, when custom field .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -151,7 +150,7 @@ test.serial(`${currentTest} should return custom fields array, when custom field const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(getTableRowsRO.rows.length >= 10, true); for (const row of getTableRowsRO.rows) { - t.is(row.hasOwnProperty('#autoadmin:customFields'), true); + t.is(Object.hasOwn(row, '#autoadmin:customFields'), true); t.is(typeof row['#autoadmin:customFields'], 'object'); t.is(row['#autoadmin:customFields'].length, 1); t.is(row['#autoadmin:customFields'][0].type, newCustomField.type); @@ -312,7 +311,7 @@ test.serial(`${currentTest} should return table settings with created custom fie .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -356,7 +355,7 @@ test.serial( .set('Content-Type', 'application/json') .set('masterpwd', 'ahalaimahalai') .set('Accept', 'application/json'); - const createCustomField = JSON.parse(createCustomFieldResponse.text); + const _createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 400); // t.is(createCustomField.message, ErrorsMessages.VALIDATION_FAILED); @@ -388,7 +387,7 @@ test.serial( .set('Cookie', token) .set('masterpwd', 'ahalaimahalai') .set('Accept', 'application/json'); - const createCustomField = JSON.parse(createCustomFieldResponse.text); + const _createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 400); // t.is(createCustomField.message, ErrorsMessages.VALIDATION_FAILED); @@ -422,7 +421,7 @@ test.serial( .set('masterpwd', 'ahalaimahalai') .set('Accept', 'application/json'); - const createCustomField = JSON.parse(createCustomFieldResponse.text); + const _createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 400); // t.is(createCustomField.message, ErrorsMessages.VALIDATION_FAILED); @@ -485,7 +484,7 @@ test.serial( .set('Cookie', token) .set('masterpwd', 'ahalaimahalai') .set('Accept', 'application/json'); - const createCustomField = JSON.parse(createCustomFieldResponse.text); + const _createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 400); // t.is(createCustomField.message, ErrorsMessages.VALIDATION_FAILED); @@ -629,7 +628,7 @@ test.serial(`${currentTest} should return updated custom field`, async (t) => { .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -693,7 +692,7 @@ test.serial(`${currentTest} should throw exception, when connection id not passe .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -752,7 +751,7 @@ test.serial(`${currentTest} should throw exception, when connection id passed in .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -814,7 +813,7 @@ test.serial(`${currentTest} should throw exception, when tableName passed in req .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -876,7 +875,7 @@ test.serial(`${currentTest} should throw exception, when tableName not passed in .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -938,7 +937,7 @@ test.serial(`${currentTest} should throw exception, when field id not passed in .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -971,7 +970,7 @@ test.serial(`${currentTest} should throw exception, when field id not passed in .set('masterpwd', 'ahalaimahalai') .set('Accept', 'application/json'); - const updatedCustomFieldRO = JSON.parse(updateCustomFieldResponse.text); + const _updatedCustomFieldRO = JSON.parse(updateCustomFieldResponse.text); t.is(updateCustomFieldResponse.status, 400); // t.is(updatedCustomFieldRO.message, ErrorsMessages.VALIDATION_FAILED); }); @@ -1000,7 +999,7 @@ test.serial(`${currentTest} should throw exception, when field type not passed i .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -1033,7 +1032,7 @@ test.serial(`${currentTest} should throw exception, when field type not passed i .set('masterpwd', 'ahalaimahalai') .set('Accept', 'application/json'); - const updatedCustomFieldRO = JSON.parse(updateCustomFieldResponse.text); + const _updatedCustomFieldRO = JSON.parse(updateCustomFieldResponse.text); t.is(updateCustomFieldResponse.status, 400); // t.is(updatedCustomFieldRO.message, ErrorsMessages.VALIDATION_FAILED); }); @@ -1061,7 +1060,7 @@ test.serial(`${currentTest} should throw exception, when field type passed in re .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -1122,7 +1121,7 @@ test.serial(`${currentTest} should throw exception, when field text is not passe .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -1155,7 +1154,7 @@ test.serial(`${currentTest} should throw exception, when field text is not passe .set('masterpwd', 'ahalaimahalai') .set('Accept', 'application/json'); - const updatedCustomFieldRO = JSON.parse(updateCustomFieldResponse.text); + const _updatedCustomFieldRO = JSON.parse(updateCustomFieldResponse.text); t.is(updateCustomFieldResponse.status, 400); // t.is(updatedCustomFieldRO.message, ErrorsMessages.VALIDATION_FAILED); }); @@ -1184,7 +1183,7 @@ test.serial(`${currentTest} should throw exception, when field template_string i .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -1217,7 +1216,7 @@ test.serial(`${currentTest} should throw exception, when field template_string i .set('masterpwd', 'ahalaimahalai') .set('Accept', 'application/json'); - const updatedCustomFieldRO = JSON.parse(updateCustomFieldResponse.text); + const _updatedCustomFieldRO = JSON.parse(updateCustomFieldResponse.text); t.is(updateCustomFieldResponse.status, 400); // t.is(updatedCustomFieldRO.message, ErrorsMessages.VALIDATION_FAILED); }); @@ -1245,7 +1244,7 @@ test.serial(`${currentTest} should throw exception, when fields passed in templa .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -1313,7 +1312,7 @@ test.serial( .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -1346,7 +1345,7 @@ test.serial( .set('masterpwd', 'ahalaimahalai') .set('Accept', 'application/json'); - const updatedCustomFieldRO = JSON.parse(updateCustomFieldResponse.text); + const _updatedCustomFieldRO = JSON.parse(updateCustomFieldResponse.text); t.is(updateCustomFieldResponse.status, 400); // t.is(updatedCustomFieldRO.message, ErrorsMessages.VALIDATION_FAILED); }, @@ -1377,7 +1376,7 @@ test.serial(`${currentTest} should return table settings without deleted custom .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); let getCustomFields = await request(app.getHttpServer()) @@ -1448,7 +1447,7 @@ test.serial(`${currentTest} should throw exception, when connection id not passe .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -1500,7 +1499,7 @@ test.serial(`${currentTest} should throw exception, when connection id passed in .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -1554,7 +1553,7 @@ test.serial(`${currentTest} should throw exception, when tableName not passed in .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -1608,7 +1607,7 @@ test.serial(`${currentTest} should throw exception, when tableName passed in req .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -1662,7 +1661,7 @@ test.serial(`${currentTest} should throw exception, when field id is not passed .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -1716,7 +1715,7 @@ test.serial(`${currentTest} should throw exception, when field id passed in requ .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-group-e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-group-e2e.test.ts index a5c1af9a..71dc4db3 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-group-e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-group-e2e.test.ts @@ -21,12 +21,11 @@ import { Messages } from '../../../src/exceptions/text/messages.js'; import { setSaasEnvVariable } from '../../utils/set-saas-env-variable.js'; import { ValidationException } from '../../../src/exceptions/custom-exceptions/validation-exception.js'; import { ValidationError } from 'class-validator'; -import { ErrorsMessages } from '../../../src/exceptions/custom-exceptions/messages/custom-errors-messages.js'; import { Cacher } from '../../../src/helpers/cache/cacher.js'; import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const mockFactory = new MockFactory(); @@ -37,7 +36,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -113,9 +112,9 @@ test.serial(`${currentTest} should return all user groups`, async (t) => { t.is(result.length, 2); - t.is(result[1].group.hasOwnProperty('users'), true); - t.is(result[0].group.hasOwnProperty('title'), true); - t.is(result[0].group.hasOwnProperty('connection'), false); + t.is(Object.hasOwn(result[1].group, 'users'), true); + t.is(Object.hasOwn(result[0].group, 'title'), true); + t.is(Object.hasOwn(result[0].group, 'connection'), false); t.is(result[1].accessLevel, AccessLevelEnum.edit); } catch (e) { console.error(e); @@ -435,7 +434,7 @@ test.serial(`${currentTest} should throw an error when user email not passed in .set('Accept', 'application/json'); t.is(addUserInGroup.status, 400); - const responseObject = JSON.parse(addUserInGroup.text); + const _responseObject = JSON.parse(addUserInGroup.text); // t.is(responseObject.message, ErrorsMessages.VALIDATION_FAILED); } catch (e) { console.error(e); @@ -630,7 +629,7 @@ test.serial(`${currentTest} should return an delete result`, async (t) => { t.is(response.status, 200); const result = JSON.parse(response.text); - const groupId = result[0].group.id; + const _groupId = result[0].group.id; t.is(result.length, 1); t.is(result[0].group.title, 'Admin'); @@ -820,7 +819,7 @@ test.serial(`${currentTest} should return a group without deleted user`, async ( t.is(typeof result, 'object'); t.is(result.title, newGroup1.title); - t.is(result.hasOwnProperty('users'), true); + t.is(Object.hasOwn(result, 'users'), true); t.is(typeof result.users, 'object'); t.is(result.users.length, 1); @@ -1167,7 +1166,7 @@ test.serial(`${currentTest} should throw an error, trying delete last user from .set('Accept', 'application/json'); t.is(createGroupResponse.status, 201); - const createGroupRO = JSON.parse(createGroupResponse.text); + const _createGroupRO = JSON.parse(createGroupResponse.text); const groupId = createConnectionRO.groups[0].id; const requestBody = { email: firstUserRegisterInfo.email, diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-permissions-e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-permissions-e2e.test.ts index fc257d55..c90cc0d4 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-permissions-e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-permissions-e2e.test.ts @@ -24,7 +24,7 @@ import { Cacher } from '../../../src/helpers/cache/cacher.js'; import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const mockFactory = new MockFactory(); test.before(async () => { @@ -34,7 +34,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-postgres-with-binary-e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-postgres-with-binary-e2e.test.ts index 75883a96..4ed1c3f0 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-postgres-with-binary-e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-postgres-with-binary-e2e.test.ts @@ -25,7 +25,7 @@ import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; let currentTest; test.before(async () => { @@ -35,7 +35,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -73,7 +73,7 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( const testTableColumnName = `${faker.lorem.words(1)}_${faker.lorem.words(1)}`; const testTableSecondColumnName = `${faker.lorem.words(1)}_${faker.lorem.words(1)}`; const Knex = getTestKnex(connectionParamsCopy); - await Knex.schema.createTable(testTableName, function (table) { + await Knex.schema.createTable(testTableName, (table) => { table.increments(); table.binary(testTableColumnName); table.string(testTableSecondColumnName); diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-table-cassandra.e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-table-cassandra.e2e.test.ts index 0f6626db..344e66b5 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-table-cassandra.e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-table-cassandra.e2e.test.ts @@ -34,7 +34,7 @@ const __dirname = path.dirname(__filename); const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const testSearchedUserName = 'Vasia'; const testTables: Array = []; let currentTest; @@ -46,7 +46,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication() as any; - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -101,8 +101,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( const testTableIndex = getTablesRO.findIndex((t) => t.table === testTableName); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -207,21 +207,21 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(getTableRowsResponse.status, 200); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); - t.is(getTableRowsRO.hasOwnProperty('large_dataset'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'large_dataset'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -282,19 +282,19 @@ test.serial(`${currentTest} should return rows of selected table with search and const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(getTableRowsResponse.status, 200); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0].id, searchedDescription); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -351,17 +351,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'uuid'); @@ -425,17 +425,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'uuid'); @@ -504,15 +504,15 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'uuid'); @@ -582,15 +582,15 @@ should return all found rows with pagination page=1 perPage=3`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'uuid'); @@ -659,9 +659,9 @@ should return all found rows with sorting ids by DESC`, t.is(getTableRowsResponse.status, 200); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); @@ -681,8 +681,8 @@ should return all found rows with sorting ids by DESC`, ); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -743,9 +743,9 @@ should return all found rows with sorting ids by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); @@ -763,8 +763,8 @@ should return all found rows with sorting ids by ASC`, t.truthy(lowestAgeRow, 'Should find the test user with age 14'); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -825,9 +825,9 @@ should return all found rows with sorting ports by DESC and with pagination page const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(getTableRowsResponse.status, 200); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); @@ -845,8 +845,8 @@ should return all found rows with sorting ports by DESC and with pagination page t.truthy(lowestAgeRow, 'Should find the test user with age 90'); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -907,9 +907,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); @@ -925,8 +925,8 @@ test.serial( t.truthy(lowestAgeRow, 'Should find the test user with age 14'); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -987,9 +987,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); @@ -1002,8 +1002,8 @@ test.serial( } t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1067,9 +1067,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsResponse.status, 200); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); @@ -1088,8 +1088,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.truthy(highestAgeRow, 'Should find the test user with age 95'); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1139,7 +1139,7 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC .set('Cookie', firstUserToken) .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const createTableSettingsRO = JSON.parse(createTableSettingsResponse.text); + const _createTableSettingsRO = JSON.parse(createTableSettingsResponse.text); t.is(createTableSettingsResponse.status, 201); @@ -1155,9 +1155,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0].age, 14); @@ -1165,8 +1165,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1230,9 +1230,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0].age, 14); @@ -1241,8 +1241,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1306,9 +1306,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0].age, 95); @@ -1316,8 +1316,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1388,9 +1388,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); @@ -1403,8 +1403,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1470,9 +1470,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1483,8 +1483,8 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1549,9 +1549,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1562,8 +1562,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1693,8 +1693,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1733,26 +1733,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 6); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -1888,8 +1888,8 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const fakeId = faker.string.uuid(); const row = { - ['id']: fakeId, - ['age']: 99, + "id": fakeId, + "age": 99, [testTableColumnName]: fakeName, [testTableSecondColumnName]: fakeMail, }; @@ -1904,11 +1904,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -1922,9 +1922,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -1940,13 +1940,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'id'), true); t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, fakeId); }); @@ -1972,7 +1972,7 @@ test.serial(`${currentTest} should throw an exception when connection id is not const row = { id: faker.string.uuid(), - ['age']: 99, + "age": 99, [testTableColumnName]: fakeName, [testTableSecondColumnName]: fakeMail, }; @@ -1996,9 +1996,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2054,9 +2054,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2101,9 +2101,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2159,9 +2159,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2205,11 +2205,11 @@ test.serial(`${currentTest} should update row in table and return result`, async t.is(updateRowInTableResponse.status, 200); const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2223,9 +2223,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2608,7 +2608,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2620,9 +2620,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2667,9 +2667,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2717,9 +2717,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2767,9 +2767,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2817,9 +2817,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2866,9 +2866,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2922,9 +2922,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2993,11 +2993,11 @@ test.serial(`${currentTest} found row`, async (t) => { t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3270,7 +3270,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3282,9 +3282,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3354,7 +3354,7 @@ test.serial(`${currentTest} should delete rows in table and return result`, asyn .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); t.is(deleteRowInTableResponse.status, 200); //checking that the line was deleted @@ -3367,9 +3367,9 @@ test.serial(`${currentTest} should delete rows in table and return result`, asyn const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(getTableRowsResponse.status, 200); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3681,7 +3681,7 @@ test.serial(`${currentTest} should import csv file with table data`, async (t) = .set('Cookie', firstUserToken) .set('Accept', 'application/json'); - const importCsvRO = JSON.parse(importCsvResponse.text); + const _importCsvRO = JSON.parse(importCsvResponse.text); t.is(importCsvResponse.status, 201); //checking that the lines was added diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-table-ibmdb2-e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-table-ibmdb2-e2e.test.ts index d084d3f2..715aae67 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-table-ibmdb2-e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-table-ibmdb2-e2e.test.ts @@ -16,7 +16,6 @@ import { DatabaseModule } from '../../../src/shared/database/database.module.js' import { DatabaseService } from '../../../src/shared/database/database.service.js'; import { MockFactory } from '../../mock.factory.js'; import { createTestTable } from '../../utils/create-test-table.js'; -import { dropTestTables } from '../../utils/drop-test-tables.js'; import { getTestData } from '../../utils/get-test-data.js'; import { registerUserAndReturnUserInfo } from '../../utils/register-user-and-return-user-info.js'; import { TestUtils } from '../../utils/test.utils.js'; @@ -35,7 +34,7 @@ const __dirname = path.dirname(__filename); const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const testSearchedUserName = 'Vasia'; const testTables: Array = []; let currentTest; @@ -47,7 +46,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -103,8 +102,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( const testTableIndex = getTablesRO.findIndex((t) => t.table === testTableName); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -209,20 +208,20 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('ID'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('CREATED_AT'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('UPDATED_AT'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'ID'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'CREATED_AT'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'UPDATED_AT'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -283,19 +282,19 @@ test.serial(`${currentTest} should return rows of selected table with search and t.is(getTableRowsResponse.status, 200); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); - t.is(getTableRowsRO.rows[0].ID, parseInt(searchedDescription)); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('CREATED_AT'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('UPDATED_AT'), true); + t.is(getTableRowsRO.rows[0].ID, parseInt(searchedDescription, 10)); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'CREATED_AT'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'UPDATED_AT'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -352,17 +351,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('ID'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'ID'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'ID'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'INTEGER'); @@ -426,17 +425,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('ID'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'ID'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'ID'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'INTEGER'); @@ -505,15 +504,15 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'ID'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'INTEGER'); @@ -584,15 +583,15 @@ should return all found rows with pagination page=1 perPage=3`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'ID'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'INTEGER'); @@ -662,9 +661,9 @@ should return all found rows with sorting ids by DESC`, t.is(getTableRowsResponse.status, 200); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].ID, 42); @@ -672,8 +671,8 @@ should return all found rows with sorting ids by DESC`, t.is(getTableRowsRO.rows[41].ID, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -734,9 +733,9 @@ should return all found rows with sorting ids by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].ID, 1); @@ -744,8 +743,8 @@ should return all found rows with sorting ids by ASC`, t.is(getTableRowsRO.rows[41].ID, 42); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -807,17 +806,17 @@ should return all found rows with sorting ports by DESC and with pagination page const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].ID, 42); t.is(getTableRowsRO.rows[1].ID, 41); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -878,17 +877,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].ID, 1); t.is(getTableRowsRO.rows[1].ID, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -949,17 +948,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].ID, 39); t.is(getTableRowsRO.rows[1].ID, 38); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1023,9 +1022,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].ID, 38); @@ -1034,8 +1033,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1099,9 +1098,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].ID, 1); @@ -1109,8 +1108,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1174,9 +1173,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].ID, 1); @@ -1185,8 +1184,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1250,9 +1249,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].ID, 38); @@ -1260,8 +1259,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1327,9 +1326,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1342,8 +1341,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1408,9 +1407,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1425,8 +1424,8 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1491,9 +1490,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1504,8 +1503,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1573,9 +1572,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1586,8 +1585,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1842,8 +1841,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1882,26 +1881,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 5); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -2050,11 +2049,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t console.log('🚀 ~ test ~ addRowInTableRO:', addRowInTableRO); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2068,9 +2067,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2089,13 +2088,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('ID'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'ID'), true); t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.ID, 43); }); @@ -2143,9 +2142,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2199,9 +2198,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2246,9 +2245,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2302,9 +2301,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2348,11 +2347,11 @@ test.serial(`${currentTest} should update row in table and return result`, async const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); t.is(updateRowInTableResponse.status, 200); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2366,9 +2365,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2675,7 +2674,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2687,9 +2686,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2735,9 +2734,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2785,9 +2784,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2835,9 +2834,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2885,9 +2884,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2934,9 +2933,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2985,9 +2984,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3056,11 +3055,11 @@ test.serial(`${currentTest} found row`, async (t) => { t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3320,7 +3319,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3332,9 +3331,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-table-mongodb-e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-table-mongodb-e2e.test.ts index e733085f..6fc127ff 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-table-mongodb-e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-table-mongodb-e2e.test.ts @@ -24,7 +24,6 @@ import fs from 'fs'; import path from 'path'; import { fileURLToPath } from 'url'; import { join } from 'path'; -import { send } from 'process'; import { setSaasEnvVariable } from '../../utils/set-saas-env-variable.js'; import { Cacher } from '../../../src/helpers/cache/cacher.js'; import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; @@ -35,7 +34,7 @@ const __dirname = path.dirname(__filename); const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const testSearchedUserName = 'Vasia'; const testTables: Array = []; let currentTest; @@ -47,7 +46,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication() as any; - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -102,8 +101,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( const testTableIndex = getTablesRO.findIndex((t) => t.table === testTableName); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -208,21 +207,21 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); - t.is(getTableRowsRO.hasOwnProperty('large_dataset'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'large_dataset'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('_id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], '_id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -283,19 +282,19 @@ test.serial(`${currentTest} should return rows of selected table with search and const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0]._id, searchedDescription); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -352,17 +351,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('_id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], '_id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, '_id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'string'); @@ -426,17 +425,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('_id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], '_id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, '_id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'string'); @@ -505,15 +504,15 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, '_id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'string'); @@ -583,15 +582,15 @@ should return all found rows with pagination page=1 perPage=3`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, '_id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'string'); @@ -659,9 +658,9 @@ should return all found rows with sorting ids by DESC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); // t.is(getTableRowsRO.rows[0]._id, 42); @@ -669,8 +668,8 @@ should return all found rows with sorting ids by DESC`, // t.is(getTableRowsRO.rows[41]._id, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -735,9 +734,9 @@ should return all found rows with sorting ids by ASC`, const searchedSecondId = insertedSearchedIds.find((id) => id.number === 1)._id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0]._id, searchedFirstId); @@ -745,8 +744,8 @@ should return all found rows with sorting ids by ASC`, t.is(getTableRowsRO.rows[41]._id, searchedLastId); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -812,17 +811,17 @@ should return all found rows with sorting ports by DESC and with pagination page const preSearchedLastId = insertedSearchedIds.find((id) => id.number === 0)._id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0]._id, preSearchedLastId); t.is(getTableRowsRO.rows[1]._id, searchedLastId); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -887,17 +886,17 @@ test.serial( const preSearchedSecondId = insertedSearchedIds.find((id) => id.number === 1)._id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0]._id, searchedFirstId); t.is(getTableRowsRO.rows[1]._id, preSearchedSecondId); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -962,17 +961,17 @@ test.serial( const searchedSecondId = insertedSearchedIds.find((id) => id.number === 4)._id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0]._id, searchedFirstId); t.is(getTableRowsRO.rows[1]._id, searchedSecondId); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1040,9 +1039,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const searchedSecondId = insertedSearchedIds.find((id) => id.number === 21)._id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0]._id, searchedFirstId); @@ -1051,8 +1050,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1117,9 +1116,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const searchedFirstId = insertedSearchedIds.find((id) => id.number === 37)._id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0]._id, searchedFirstId); @@ -1127,8 +1126,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1195,9 +1194,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0]._id, searchedFirstId); @@ -1206,8 +1205,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1272,9 +1271,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const searchedFirstId = insertedSearchedIds.find((id) => id.number === 37)._id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0]._id, searchedFirstId); @@ -1282,8 +1281,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1354,9 +1353,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1368,8 +1367,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1440,9 +1439,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1456,8 +1455,8 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1530,9 +1529,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1545,8 +1544,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 3); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1801,8 +1800,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1841,26 +1840,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 6); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -2008,11 +2007,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2026,9 +2025,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2046,13 +2045,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('_id'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, '_id'), true); }); test.serial(`${currentTest} should throw an exception when connection id is not passed in request`, async (t) => { @@ -2100,9 +2099,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2157,9 +2156,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2204,9 +2203,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2261,9 +2260,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2307,11 +2306,11 @@ test.serial(`${currentTest} should update row in table and return result`, async t.is(updateRowInTableResponse.status, 200); const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2325,9 +2324,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2702,7 +2701,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2714,9 +2713,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2762,9 +2761,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2812,9 +2811,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2862,9 +2861,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2912,9 +2911,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2961,9 +2960,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3017,9 +3016,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3088,11 +3087,11 @@ test.serial(`${currentTest} found row`, async (t) => { t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3363,7 +3362,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3375,9 +3374,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3446,7 +3445,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3458,9 +3457,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(getTableRowsResponse.status, 200); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-table-mssql-e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-table-mssql-e2e.test.ts index 7ab5a4e9..5e898d50 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-table-mssql-e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-table-mssql-e2e.test.ts @@ -27,7 +27,7 @@ import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const testSearchedUserName = 'Vasia'; const testTables: Array = []; let currentTest; @@ -39,7 +39,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -97,8 +97,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( const testTableIndex = getTablesRO.findIndex((t) => t.table === testTableName); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -204,20 +204,20 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -278,19 +278,19 @@ test.serial(`${currentTest} should return rows of selected table with search and const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); - t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription)); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription, 10)); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -347,17 +347,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -421,17 +421,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -500,15 +500,15 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -578,15 +578,15 @@ should return all found rows with pagination page=1 perPage=3`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -654,9 +654,9 @@ should return all found rows with sorting ids by DESC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); @@ -664,8 +664,8 @@ should return all found rows with sorting ids by DESC`, t.is(getTableRowsRO.rows[41].id, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -726,9 +726,9 @@ should return all found rows with sorting ids by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -736,8 +736,8 @@ should return all found rows with sorting ids by ASC`, t.is(getTableRowsRO.rows[41].id, 42); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -799,17 +799,17 @@ should return all found rows with sorting ports by DESC and with pagination page const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); t.is(getTableRowsRO.rows[1].id, 41); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -870,17 +870,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); t.is(getTableRowsRO.rows[1].id, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -941,17 +941,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 39); t.is(getTableRowsRO.rows[1].id, 38); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1015,9 +1015,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1026,8 +1026,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1091,9 +1091,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1101,8 +1101,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1166,9 +1166,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1177,8 +1177,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1242,9 +1242,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1252,8 +1252,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1319,9 +1319,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1334,8 +1334,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1400,9 +1400,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1417,8 +1417,8 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1483,9 +1483,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1496,8 +1496,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1565,9 +1565,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1578,8 +1578,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1834,8 +1834,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1874,26 +1874,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 5); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -2041,11 +2041,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2059,9 +2059,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2080,13 +2080,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'id'), true); t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, 43); }); @@ -2135,9 +2135,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2192,9 +2192,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2239,9 +2239,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2296,9 +2296,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2342,11 +2342,11 @@ test.serial(`${currentTest} should update row in table and return result`, async t.is(updateRowInTableResponse.status, 200); const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2360,9 +2360,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2669,7 +2669,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2681,9 +2681,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2729,9 +2729,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2779,9 +2779,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2829,9 +2829,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2879,9 +2879,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2928,9 +2928,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2979,9 +2979,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3050,11 +3050,11 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3314,7 +3314,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3326,9 +3326,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-table-mssql-schema-e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-table-mssql-schema-e2e.test.ts index 7bfcaff8..e4ff510c 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-table-mssql-schema-e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-table-mssql-schema-e2e.test.ts @@ -27,7 +27,7 @@ import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const testSearchedUserName = 'Vasia'; const testTables: Array = []; let currentTest; @@ -39,7 +39,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -98,8 +98,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( const testTableIndex = getTablesRO.findIndex((t) => t.table === testTableName); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -205,20 +205,20 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -279,19 +279,19 @@ test.serial(`${currentTest} should return rows of selected table with search and const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); - t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription)); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription, 10)); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -348,17 +348,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -422,17 +422,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -501,15 +501,15 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -579,15 +579,15 @@ should return all found rows with pagination page=1 perPage=3`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -655,9 +655,9 @@ should return all found rows with sorting ids by DESC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); @@ -665,8 +665,8 @@ should return all found rows with sorting ids by DESC`, t.is(getTableRowsRO.rows[41].id, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -727,9 +727,9 @@ should return all found rows with sorting ids by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -737,8 +737,8 @@ should return all found rows with sorting ids by ASC`, t.is(getTableRowsRO.rows[41].id, 42); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -800,17 +800,17 @@ should return all found rows with sorting ports by DESC and with pagination page const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); t.is(getTableRowsRO.rows[1].id, 41); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -871,17 +871,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); t.is(getTableRowsRO.rows[1].id, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -942,17 +942,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 39); t.is(getTableRowsRO.rows[1].id, 38); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1016,9 +1016,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1027,8 +1027,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1092,9 +1092,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1102,8 +1102,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1167,9 +1167,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1178,8 +1178,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1243,9 +1243,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1253,8 +1253,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1320,9 +1320,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1335,8 +1335,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1401,9 +1401,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1418,8 +1418,8 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1484,9 +1484,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1497,8 +1497,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1566,9 +1566,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1579,8 +1579,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1835,8 +1835,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1875,26 +1875,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 5); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -2042,11 +2042,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2060,9 +2060,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2081,13 +2081,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'id'), true); t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, 43); }); @@ -2136,9 +2136,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2193,9 +2193,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2240,9 +2240,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2297,9 +2297,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2343,11 +2343,11 @@ test.serial(`${currentTest} should update row in table and return result`, async t.is(updateRowInTableResponse.status, 200); const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2361,9 +2361,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2670,7 +2670,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2682,9 +2682,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2730,9 +2730,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2780,9 +2780,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2830,9 +2830,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2880,9 +2880,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2929,9 +2929,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2980,9 +2980,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3051,11 +3051,11 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3315,7 +3315,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3327,9 +3327,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-table-mysql-e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-table-mysql-e2e.test.ts index d7c0f4d7..c978189a 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-table-mysql-e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-table-mysql-e2e.test.ts @@ -27,7 +27,7 @@ import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const testSearchedUserName = 'Vasia'; const testTables: Array = []; let currentTest; @@ -39,7 +39,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -97,8 +97,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( const testTableIndex = getTablesRO.findIndex((t) => t.table === testTableName); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -203,20 +203,20 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -276,19 +276,19 @@ test.serial(`${currentTest} should return rows of selected table with search and const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); - t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription)); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription, 10)); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -345,17 +345,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -419,17 +419,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -498,15 +498,15 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -576,15 +576,15 @@ should return all found rows with pagination page=1 perPage=3`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -652,9 +652,9 @@ should return all found rows with sorting ids by DESC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); @@ -662,8 +662,8 @@ should return all found rows with sorting ids by DESC`, t.is(getTableRowsRO.rows[41].id, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -724,9 +724,9 @@ should return all found rows with sorting ids by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -734,8 +734,8 @@ should return all found rows with sorting ids by ASC`, t.is(getTableRowsRO.rows[41].id, 42); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -797,17 +797,17 @@ should return all found rows with sorting ports by DESC and with pagination page const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); t.is(getTableRowsRO.rows[1].id, 41); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -868,17 +868,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); t.is(getTableRowsRO.rows[1].id, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -939,17 +939,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 39); t.is(getTableRowsRO.rows[1].id, 38); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1013,9 +1013,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1024,8 +1024,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1089,9 +1089,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1099,8 +1099,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1164,9 +1164,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1175,8 +1175,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1240,9 +1240,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1250,8 +1250,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1317,9 +1317,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1332,8 +1332,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1398,9 +1398,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1415,8 +1415,8 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1481,9 +1481,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1494,8 +1494,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1563,9 +1563,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1576,8 +1576,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1832,8 +1832,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1872,26 +1872,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 5); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -2039,11 +2039,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2057,9 +2057,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2078,13 +2078,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'id'), true); t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, 43); }); @@ -2133,9 +2133,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2190,9 +2190,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2237,9 +2237,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2294,9 +2294,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2340,11 +2340,11 @@ test.serial(`${currentTest} should update row in table and return result`, async t.is(updateRowInTableResponse.status, 200); const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2358,9 +2358,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2667,7 +2667,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2679,9 +2679,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2727,9 +2727,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2777,9 +2777,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2827,9 +2827,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2877,9 +2877,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2926,9 +2926,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2977,9 +2977,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3048,11 +3048,11 @@ test.serial(`${currentTest} found row`, async (t) => { t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3312,7 +3312,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3324,9 +3324,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-table-oracledb-e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-table-oracledb-e2e.test.ts index 057a83c8..3980ea9a 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-table-oracledb-e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-table-oracledb-e2e.test.ts @@ -27,7 +27,7 @@ import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const testSearchedUserName = 'Vasia'; const testTables: Array = []; let currentTest; @@ -39,7 +39,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -99,8 +99,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( return t.table === testTableName; }); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -206,19 +206,19 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -280,18 +280,18 @@ test.serial(`${currentTest} should return rows of selected table with search and const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); - t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription)); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription, 10)); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -349,16 +349,16 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -423,16 +423,16 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -502,14 +502,14 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -579,14 +579,14 @@ should return all found rows with pagination page=1 perPage=3`, t.is(getTableRowsResponse.status, 200); const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -655,9 +655,9 @@ should return all found rows with sorting ids by DESC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); @@ -665,7 +665,7 @@ should return all found rows with sorting ids by DESC`, t.is(getTableRowsRO.rows[41].id, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -727,9 +727,9 @@ should return all found rows with sorting ids by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -737,7 +737,7 @@ should return all found rows with sorting ids by ASC`, t.is(getTableRowsRO.rows[41].id, 42); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -800,16 +800,16 @@ should return all found rows with sorting ports by DESC and with pagination page const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); t.is(getTableRowsRO.rows[1].id, 41); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -871,16 +871,16 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); t.is(getTableRowsRO.rows[1].id, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -942,16 +942,16 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 39); t.is(getTableRowsRO.rows[1].id, 38); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1016,9 +1016,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1027,7 +1027,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1092,9 +1092,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1102,7 +1102,7 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1167,9 +1167,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1178,7 +1178,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1243,9 +1243,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1253,7 +1253,7 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1320,9 +1320,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1334,7 +1334,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.currentPage, 1); t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { @@ -1401,9 +1401,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1418,7 +1418,7 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1484,9 +1484,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1497,7 +1497,7 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1566,9 +1566,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1579,7 +1579,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1835,8 +1835,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1875,26 +1875,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 5); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); // t.is(element.hasOwnProperty('data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -2043,11 +2043,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2061,9 +2061,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2082,13 +2082,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'id'), true); t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, String(43)); }); @@ -2137,9 +2137,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2194,9 +2194,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2241,9 +2241,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2298,9 +2298,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2344,11 +2344,11 @@ test.serial(`${currentTest} should update row in table and return result`, async t.is(updateRowInTableResponse.status, 200); const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2362,9 +2362,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2671,7 +2671,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2683,9 +2683,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2731,9 +2731,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2781,9 +2781,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2831,9 +2831,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2881,9 +2881,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2930,9 +2930,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2981,9 +2981,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3052,11 +3052,11 @@ test.serial(`${currentTest} found row`, async (t) => { const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); t.is(foundRowInTableResponse.status, 200); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3316,7 +3316,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3328,9 +3328,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-table-oracledb-schema-e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-table-oracledb-schema-e2e.test.ts index 404930b6..f5b1b0fa 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-table-oracledb-schema-e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-table-oracledb-schema-e2e.test.ts @@ -27,7 +27,7 @@ import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const testSearchedUserName = 'Vasia'; const testTables: Array = []; let currentTest; @@ -39,7 +39,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication() as any; - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -99,8 +99,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( return t.table === testTableName; }); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -206,19 +206,19 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -280,18 +280,18 @@ test.serial(`${currentTest} should return rows of selected table with search and const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); - t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription)); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription, 10)); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -349,16 +349,16 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -423,16 +423,16 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -502,14 +502,14 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -579,14 +579,14 @@ should return all found rows with pagination page=1 perPage=3`, t.is(getTableRowsResponse.status, 200); const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -655,9 +655,9 @@ should return all found rows with sorting ids by DESC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); @@ -665,7 +665,7 @@ should return all found rows with sorting ids by DESC`, t.is(getTableRowsRO.rows[41].id, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -727,9 +727,9 @@ should return all found rows with sorting ids by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -737,7 +737,7 @@ should return all found rows with sorting ids by ASC`, t.is(getTableRowsRO.rows[41].id, 42); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -800,16 +800,16 @@ should return all found rows with sorting ports by DESC and with pagination page const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); t.is(getTableRowsRO.rows[1].id, 41); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -871,16 +871,16 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); t.is(getTableRowsRO.rows[1].id, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -942,16 +942,16 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 39); t.is(getTableRowsRO.rows[1].id, 38); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1016,9 +1016,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1027,7 +1027,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1092,9 +1092,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1102,7 +1102,7 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1167,9 +1167,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1178,7 +1178,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1243,9 +1243,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1253,7 +1253,7 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1320,9 +1320,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1335,7 +1335,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1401,9 +1401,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1418,7 +1418,7 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1484,9 +1484,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1497,7 +1497,7 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1566,9 +1566,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1579,7 +1579,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1835,8 +1835,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1875,26 +1875,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 5); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); // t.is(element.hasOwnProperty('data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -2043,11 +2043,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2061,9 +2061,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2082,13 +2082,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'id'), true); t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, String(43)); }); @@ -2137,9 +2137,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2194,9 +2194,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2241,9 +2241,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2298,9 +2298,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2344,11 +2344,11 @@ test.serial(`${currentTest} should update row in table and return result`, async t.is(updateRowInTableResponse.status, 200); const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2362,9 +2362,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2671,7 +2671,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2683,9 +2683,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2731,9 +2731,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2781,9 +2781,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2831,9 +2831,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2881,9 +2881,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2930,9 +2930,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2981,9 +2981,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3052,11 +3052,11 @@ test.serial(`${currentTest} found row`, async (t) => { t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3316,7 +3316,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3328,9 +3328,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-table-postgres-encrypted-e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-table-postgres-encrypted-e2e.test.ts index 21e6d07f..e6e2f67f 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-table-postgres-encrypted-e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-table-postgres-encrypted-e2e.test.ts @@ -27,7 +27,7 @@ import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const testSearchedUserName = 'Vasia'; const testTables: Array = []; let currentTest; @@ -40,7 +40,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -100,8 +100,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( const testTableIndex = getTablesRO.findIndex((t) => t.table === testTableName); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -247,20 +247,20 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -323,19 +323,19 @@ test.serial(`${currentTest} should return rows of selected table with search and const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); - t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription)); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription, 10)); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -395,17 +395,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'integer'); @@ -472,17 +472,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'integer'); @@ -554,15 +554,15 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'integer'); @@ -635,15 +635,15 @@ should return all found rows with pagination page=1 perPage=3`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'integer'); @@ -714,9 +714,9 @@ should return all found rows with sorting ids by DESC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); @@ -724,8 +724,8 @@ should return all found rows with sorting ids by DESC`, t.is(getTableRowsRO.rows[41].id, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -789,9 +789,9 @@ should return all found rows with sorting ids by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -799,8 +799,8 @@ should return all found rows with sorting ids by ASC`, t.is(getTableRowsRO.rows[41].id, 42); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -865,17 +865,17 @@ should return all found rows with sorting ports by DESC and with pagination page const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); t.is(getTableRowsRO.rows[1].id, 41); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -939,17 +939,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); t.is(getTableRowsRO.rows[1].id, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1013,17 +1013,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 39); t.is(getTableRowsRO.rows[1].id, 38); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1090,9 +1090,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1101,8 +1101,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1169,9 +1169,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1179,8 +1179,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1247,9 +1247,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1258,8 +1258,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1326,9 +1326,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1336,8 +1336,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1406,9 +1406,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1421,8 +1421,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1490,9 +1490,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1507,8 +1507,8 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1576,9 +1576,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1589,8 +1589,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1661,9 +1661,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1674,8 +1674,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1943,8 +1943,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1985,26 +1985,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 5); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -2162,11 +2162,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2181,9 +2181,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2202,13 +2202,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'id'), true); t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, 43); }); @@ -2260,9 +2260,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2320,9 +2320,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2370,9 +2370,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2431,9 +2431,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2479,11 +2479,11 @@ test.serial(`${currentTest} should update row in table and return result`, async t.is(updateRowInTableResponse.status, 200); const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2498,9 +2498,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2823,7 +2823,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2836,9 +2836,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2887,9 +2887,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2940,9 +2940,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2994,9 +2994,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3049,9 +3049,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3101,9 +3101,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3155,9 +3155,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3230,11 +3230,11 @@ test.serial(`${currentTest} found row`, async (t) => { t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-table-postgres-schema-e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-table-postgres-schema-e2e.test.ts index 3d0b565d..75a36fe5 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-table-postgres-schema-e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-table-postgres-schema-e2e.test.ts @@ -27,7 +27,7 @@ import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const testSearchedUserName = 'Vasia'; const testTables: Array = []; let currentTest; @@ -39,7 +39,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -97,8 +97,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( const testTableIndex = getTablesRO.findIndex((t) => t.table === testTableName); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -204,20 +204,20 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -278,19 +278,19 @@ test.serial(`${currentTest} should return rows of selected table with search and const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); - t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription)); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription, 10)); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -347,17 +347,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'integer'); @@ -421,17 +421,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'integer'); @@ -500,15 +500,15 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'integer'); @@ -578,15 +578,15 @@ should return all found rows with pagination page=1 perPage=3`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'integer'); @@ -654,9 +654,9 @@ should return all found rows with sorting ids by DESC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); @@ -664,8 +664,8 @@ should return all found rows with sorting ids by DESC`, t.is(getTableRowsRO.rows[41].id, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -726,9 +726,9 @@ should return all found rows with sorting ids by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -736,8 +736,8 @@ should return all found rows with sorting ids by ASC`, t.is(getTableRowsRO.rows[41].id, 42); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -799,17 +799,17 @@ should return all found rows with sorting ports by DESC and with pagination page const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); t.is(getTableRowsRO.rows[1].id, 41); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -870,17 +870,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); t.is(getTableRowsRO.rows[1].id, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -941,17 +941,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 39); t.is(getTableRowsRO.rows[1].id, 38); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1015,9 +1015,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1026,8 +1026,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1091,9 +1091,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1101,8 +1101,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1166,9 +1166,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1177,8 +1177,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1242,9 +1242,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1252,8 +1252,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1319,9 +1319,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1334,8 +1334,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1400,9 +1400,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1417,8 +1417,8 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1483,9 +1483,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1496,8 +1496,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1565,9 +1565,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1578,8 +1578,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1834,8 +1834,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1874,26 +1874,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 5); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -2041,11 +2041,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2059,9 +2059,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2080,13 +2080,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'id'), true); t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, 43); }); @@ -2135,9 +2135,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2192,9 +2192,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2239,9 +2239,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2296,9 +2296,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2342,11 +2342,11 @@ test.serial(`${currentTest} should update row in table and return result`, async t.is(updateRowInTableResponse.status, 200); const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2360,9 +2360,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2669,7 +2669,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2681,9 +2681,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2729,9 +2729,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2779,9 +2779,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2829,9 +2829,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2879,9 +2879,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2928,9 +2928,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2979,9 +2979,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3050,11 +3050,11 @@ test.serial(`${currentTest} found row`, async (t) => { t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3314,7 +3314,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3326,9 +3326,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-table-redis-e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-table-redis-e2e.test.ts index 679b792d..c22f3b05 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-table-redis-e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-table-redis-e2e.test.ts @@ -33,7 +33,7 @@ const __dirname = path.dirname(__filename); const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const testSearchedUserName = 'Vasia'; const testTables: Array = []; let currentTest; @@ -45,7 +45,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication() as any; - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -100,8 +100,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( const testTableIndex = getTablesRO.findIndex((t) => t.table === testTableName); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -206,21 +206,21 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); - t.is(getTableRowsRO.hasOwnProperty('large_dataset'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'large_dataset'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('key'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'key'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -283,19 +283,19 @@ test.serial(`${currentTest} should return rows of selected table with search and console.log('🚀 ~ getTableRowsRO:', getTableRowsRO); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0].key, searchedDescription); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -352,17 +352,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('key'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'key'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'key'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'string'); @@ -426,17 +426,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('key'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'key'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'key'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'string'); @@ -507,15 +507,15 @@ should return all found rows with pagination page=1 perPage=2`, t.is(getTableRowsResponse.status, 200); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'key'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'string'); @@ -585,15 +585,15 @@ should return all found rows with pagination page=1 perPage=3`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'key'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'string'); @@ -661,9 +661,9 @@ should return all found rows with sorting ids by DESC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); // t.is(getTableRowsRO.rows[0].key, 42); @@ -671,8 +671,8 @@ should return all found rows with sorting ids by DESC`, // t.is(getTableRowsRO.rows[41].id, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -733,9 +733,9 @@ should return all found rows with sorting age by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that rows are sorted by age in ASC order for (let i = 1; i < getTableRowsRO.rows.length; i++) { @@ -808,17 +808,17 @@ should return all found rows with sorting ages by DESC and with pagination page= const preSearchedLastId = insertedSearchedIds.find((id) => id.number === 21).id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[1].key, preSearchedLastId); t.is(getTableRowsRO.rows[0].key, searchedLastId); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -879,15 +879,15 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); // check that returned rows are sorted } catch (e) { @@ -954,17 +954,17 @@ test.skip(`${currentTest} should return all found rows with sorting ages by DESC const searchedSecondId = insertedSearchedIds.find((id) => id.number === 21).id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0].key, searchedFirstId); t.is(getTableRowsRO.rows[1].key, searchedSecondId); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1033,9 +1033,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const searchedSecondId = insertedSearchedIds.find((id) => id.number === 21).id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0].key, searchedFirstId); @@ -1044,8 +1044,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1111,9 +1111,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const searchedFirstId = insertedSearchedIds.find((id) => id.number === 0).id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0].key, searchedFirstId); @@ -1121,8 +1121,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1189,9 +1189,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0].key, searchedFirstId); @@ -1200,8 +1200,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1266,9 +1266,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const searchedFirstId = insertedSearchedIds.find((id) => id.number === 37).id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0].key, searchedFirstId); @@ -1276,8 +1276,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1348,9 +1348,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1362,8 +1362,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1434,9 +1434,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1450,8 +1450,8 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1525,9 +1525,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC console.log('🚀 ~ getTableRowsRO:', getTableRowsRO); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1540,8 +1540,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 3); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1796,8 +1796,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1836,26 +1836,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 6); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -2004,11 +2004,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2022,9 +2022,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; console.log('🚀 ~ rows:', rows); @@ -2045,13 +2045,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'key'), true); }); test.serial(`${currentTest} should throw an exception when connection id is not passed in request`, async (t) => { @@ -2099,9 +2099,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2156,9 +2156,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2203,9 +2203,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2260,9 +2260,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2308,11 +2308,11 @@ test.serial(`${currentTest} should update row in table and return result`, async const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); console.log('🚀 ~ updateRowInTableRO:', updateRowInTableRO); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2326,9 +2326,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2702,7 +2702,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2714,9 +2714,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2762,9 +2762,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2812,9 +2812,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2862,9 +2862,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2912,9 +2912,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2961,9 +2961,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3017,9 +3017,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3089,11 +3089,11 @@ test.serial(`${currentTest} found row`, async (t) => { t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3363,7 +3363,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3375,9 +3375,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3446,7 +3446,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3458,9 +3458,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(getTableRowsResponse.status, 200); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3667,7 +3667,7 @@ test.serial(`${currentTest} should import csv file with table data`, async (t) = // eslint-disable-next-line security/detect-non-literal-fs-filename const fileContent = fs.readFileSync(filePatch).toString(); const rows = fileContent.split('\n'); - const idColumnIndex = rows[0].split(',').findIndex((column) => column === 'key'); + const idColumnIndex = rows[0].split(',').indexOf('key'); const newRows = rows.map((row) => { const columns = row.split(','); if (columns.length === 1) { diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-table-settings-e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-table-settings-e2e.test.ts index c84b3c46..4a43720c 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-table-settings-e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-table-settings-e2e.test.ts @@ -23,7 +23,7 @@ import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; let currentTest; test.before(async () => { @@ -33,7 +33,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -92,7 +92,7 @@ test.serial(`${currentTest} should throw an exception when connectionId is missi const newConnection = getTestData(mockFactory).newConnectionToTestDB; const { token } = await registerUserAndReturnUserInfo(app); - const createdConnection = await request(app.getHttpServer()) + const _createdConnection = await request(app.getHttpServer()) .post('/connection') .send(newConnection) .set('Cookie', token) @@ -193,7 +193,7 @@ test.serial(`${currentTest} should return connection settings object`, async (t) .set('Accept', 'application/json'); const findSettingsRO = JSON.parse(findSettingsResponce.text); - t.is(findSettingsRO.hasOwnProperty('id'), true); + t.is(Object.hasOwn(findSettingsRO, 'id'), true); t.is(findSettingsRO.table_name, 'connection'); t.is(findSettingsRO.display_name, createTableSettingsDTO.display_name); t.deepEqual(findSettingsRO.search_fields, ['title']); @@ -259,7 +259,7 @@ test.serial(`${currentTest} should return created table settings`, async (t) => .set('Accept', 'application/json'); const findSettingsRO = JSON.parse(findSettingsResponce.text); - t.is(findSettingsRO.hasOwnProperty('id'), true); + t.is(Object.hasOwn(findSettingsRO, 'id'), true); t.is(findSettingsRO.table_name, 'connection'); t.is(findSettingsRO.display_name, createTableSettingsDTO.display_name); t.deepEqual(findSettingsRO.search_fields, ['title']); @@ -327,7 +327,7 @@ test.serial(`${currentTest} should throw exception when connectionId is missing` const newConnection = getTestData(mockFactory).newConnectionToTestDB; const { token } = await registerUserAndReturnUserInfo(app); - const createdConnection = await request(app.getHttpServer()) + const _createdConnection = await request(app.getHttpServer()) .post('/connection') .send(newConnection) .set('Cookie', token) diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-table-widgets-e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-table-widgets-e2e.test.ts index 46af377d..cff87731 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-table-widgets-e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-table-widgets-e2e.test.ts @@ -23,12 +23,12 @@ import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; let currentTest; const tableNameForWidgets = 'connection'; -const uuidRegex: RegExp = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i; +const _uuidRegex: RegExp = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i; test.before(async () => { setSaasEnvVariable(); @@ -37,7 +37,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -142,7 +142,7 @@ test.serial(`${currentTest} should return array of table widgets for table`, asy .set('Accept', 'application/json'); t.is(getTableStructureResponse.status, 200); const getTableStructureRO = JSON.parse(getTableStructureResponse.text); - t.is(getTableStructureRO.hasOwnProperty('table_widgets'), true); + t.is(Object.hasOwn(getTableStructureRO, 'table_widgets'), true); t.is(getTableStructureRO.table_widgets.length, 2); t.is(getTableStructureRO.table_widgets[0].field_name, newTableWidgets[0].field_name); t.is(getTableStructureRO.table_widgets[1].widget_type, newTableWidgets[1].widget_type); @@ -345,7 +345,7 @@ test.serial(`${currentTest} should return created table widgets`, async (t) => { .set('Cookie', token) .set('masterpwd', 'ahalaimahalai') .set('Accept', 'application/json'); - const createTableWidgetRO = JSON.parse(createTableWidgetResponse.text); + const _createTableWidgetRO = JSON.parse(createTableWidgetResponse.text); t.is(createTableWidgetResponse.status, 201); const getTableWidgets = await request(app.getHttpServer()) @@ -383,7 +383,7 @@ test.serial(`${currentTest} hould return updated table widgets`, async (t) => { .set('Cookie', token) .set('masterpwd', 'ahalaimahalai') .set('Accept', 'application/json'); - const createTableWidgetRO = JSON.parse(createTableWidgetResponse.text); + const _createTableWidgetRO = JSON.parse(createTableWidgetResponse.text); t.is(createTableWidgetResponse.status, 201); const updatedTableWidgets = mockFactory.generateUpdateWidgetDTOsArrayForConnectionTable(); const updateTableWidgetResponse = await request(app.getHttpServer()) @@ -393,7 +393,7 @@ test.serial(`${currentTest} hould return updated table widgets`, async (t) => { .set('Cookie', token) .set('masterpwd', 'ahalaimahalai') .set('Accept', 'application/json'); - const updateTableWidgetRO = JSON.parse(updateTableWidgetResponse.text); + const _updateTableWidgetRO = JSON.parse(updateTableWidgetResponse.text); t.is(updateTableWidgetResponse.status, 201); @@ -432,7 +432,7 @@ test.serial(`${currentTest} should return updated table widgets when old widget .set('Cookie', token) .set('masterpwd', 'ahalaimahalai') .set('Accept', 'application/json'); - const createTableWidgetRO = JSON.parse(createTableWidgetResponse.text); + const _createTableWidgetRO = JSON.parse(createTableWidgetResponse.text); t.is(createTableWidgetResponse.status, 201); const updatedTableWidgets = mockFactory.generateUpdateWidgetDTOsArrayForConnectionTable(); const updateTableWidgetResponse = await request(app.getHttpServer()) @@ -442,7 +442,7 @@ test.serial(`${currentTest} should return updated table widgets when old widget .set('Cookie', token) .set('masterpwd', 'ahalaimahalai') .set('Accept', 'application/json'); - const updateTableWidgetRO = JSON.parse(updateTableWidgetResponse.text); + const _updateTableWidgetRO = JSON.parse(updateTableWidgetResponse.text); t.is(updateTableWidgetResponse.status, 201); @@ -482,7 +482,7 @@ test.serial(`${currentTest} should return table widgets without deleted widget`, .set('Cookie', token) .set('masterpwd', 'ahalaimahalai') .set('Accept', 'application/json'); - const createTableWidgetRO = JSON.parse(createTableWidgetResponse.text); + const _createTableWidgetRO = JSON.parse(createTableWidgetResponse.text); t.is(createTableWidgetResponse.status, 201); const copyWidgets = [...newTableWidgets]; @@ -580,7 +580,7 @@ test.serial(`${currentTest} should throw exception when connection id not passed .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const connectionId = JSON.parse(createdConnection.text).id; + const _connectionId = JSON.parse(createdConnection.text).id; const newTableWidgets = mockFactory.generateCreateWidgetDTOsArrayForConnectionTable(); const emptyId = ''; const createTableWidgetResponse = await request(app.getHttpServer()) @@ -604,7 +604,7 @@ test.serial(`${currentTest} should throw exception when connection id passed in .set('Content-Type', 'application/json') .set('Accept', 'application/json'); const newTableWidgets = mockFactory.generateCreateWidgetDTOsArrayForConnectionTable(); - const connectionId = JSON.parse(createdConnection.text).id; + const _connectionId = JSON.parse(createdConnection.text).id; const fakeConnectionId = faker.string.uuid(); const createTableWidgetResponse = await request(app.getHttpServer()) .post(`/widget/${fakeConnectionId}?tableName=${tableNameForWidgets}`) diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-user-admin-permissions-e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-user-admin-permissions-e2e.test.ts index 2556d873..4cd5f1bf 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-user-admin-permissions-e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-user-admin-permissions-e2e.test.ts @@ -22,11 +22,10 @@ import { inviteUserInCompanyAndAcceptInvitation } from '../../utils/register-use import { setSaasEnvVariable } from '../../utils/set-saas-env-variable.js'; import { ValidationException } from '../../../src/exceptions/custom-exceptions/validation-exception.js'; import { ValidationError } from 'class-validator'; -import { ErrorsMessages } from '../../../src/exceptions/custom-exceptions/messages/custom-errors-messages.js'; import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; let currentTest: string; const mockFactory = new MockFactory(); @@ -39,7 +38,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -79,23 +78,23 @@ test.serial(`${currentTest} should return connections, where second user have ac const result = findAll.body.connections; t.is(result.length, 1); - t.is(result[0].hasOwnProperty('connection'), true); - t.is(result[0].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(result[0], 'connection'), true); + t.is(Object.hasOwn(result[0], 'accessLevel'), true); t.is(result[0].accessLevel, AccessLevelEnum.edit); - t.is(result[0].hasOwnProperty('accessLevel'), true); - t.is(result[0].connection.hasOwnProperty('host'), true); - t.is(result[0].connection.hasOwnProperty('host'), true); + t.is(Object.hasOwn(result[0], 'accessLevel'), true); + t.is(Object.hasOwn(result[0].connection, 'host'), true); + t.is(Object.hasOwn(result[0].connection, 'host'), true); t.is(typeof result[0].connection.port, 'number'); - t.is(result[0].connection.hasOwnProperty('port'), true); - t.is(result[0].connection.hasOwnProperty('username'), true); - t.is(result[0].connection.hasOwnProperty('database'), true); - t.is(result[0].connection.hasOwnProperty('sid'), true); - t.is(result[0].connection.hasOwnProperty('createdAt'), true); - t.is(result[0].connection.hasOwnProperty('updatedAt'), true); - t.is(result[0].connection.hasOwnProperty('password'), false); - t.is(result[0].connection.hasOwnProperty('groups'), false); - t.is(result[0].connection.hasOwnProperty('author'), false); + t.is(Object.hasOwn(result[0].connection, 'port'), true); + t.is(Object.hasOwn(result[0].connection, 'username'), true); + t.is(Object.hasOwn(result[0].connection, 'database'), true); + t.is(Object.hasOwn(result[0].connection, 'sid'), true); + t.is(Object.hasOwn(result[0].connection, 'createdAt'), true); + t.is(Object.hasOwn(result[0].connection, 'updatedAt'), true); + t.is(Object.hasOwn(result[0].connection, 'password'), false); + t.is(Object.hasOwn(result[0].connection, 'groups'), false); + t.is(Object.hasOwn(result[0].connection, 'author'), false); } catch (error) { console.error(error); throw error; @@ -125,11 +124,11 @@ test.serial(`${currentTest} should return a found connection`, async (t) => { t.is(result.username, 'postgres'); t.is(result.database, newConnectionToPostgres.database); t.is(result.sid, null); - t.is(result.hasOwnProperty('createdAt'), true); - t.is(result.hasOwnProperty('updatedAt'), true); - t.is(result.hasOwnProperty('password'), false); - t.is(result.hasOwnProperty('groups'), false); - t.is(result.hasOwnProperty('author'), false); + t.is(Object.hasOwn(result, 'createdAt'), true); + t.is(Object.hasOwn(result, 'updatedAt'), true); + t.is(Object.hasOwn(result, 'password'), false); + t.is(Object.hasOwn(result, 'groups'), false); + t.is(Object.hasOwn(result, 'author'), false); } catch (error) { console.error(error); throw error; @@ -184,10 +183,10 @@ test.serial(`${currentTest} should return updated connection`, async (t) => { t.is(result.username, 'admin'); t.is(result.database, 'testing_nestjs'); t.is(result.sid, null); - t.is(result.hasOwnProperty('createdAt'), true); - t.is(result.hasOwnProperty('updatedAt'), true); - t.is(result.hasOwnProperty('password'), false); - t.is(result.hasOwnProperty('groups'), false); + t.is(Object.hasOwn(result, 'createdAt'), true); + t.is(Object.hasOwn(result, 'updatedAt'), true); + t.is(Object.hasOwn(result, 'password'), false); + t.is(Object.hasOwn(result, 'groups'), false); } catch (error) { console.error(error); throw error; @@ -243,7 +242,7 @@ test.serial(`${currentTest} should return delete result`, async (t) => { t.is(response.status, 200); - t.is(result.hasOwnProperty('id'), false); + t.is(Object.hasOwn(result, 'id'), false); t.is(result.title, newConnectionToPostgres.title); t.is(result.type, 'postgres'); t.is(result.host, newConnectionToPostgres.host); @@ -252,11 +251,11 @@ test.serial(`${currentTest} should return delete result`, async (t) => { t.is(result.username, 'postgres'); t.is(result.database, newConnectionToPostgres.database); t.is(result.sid, null); - t.is(result.hasOwnProperty('createdAt'), true); - t.is(result.hasOwnProperty('updatedAt'), true); - t.is(result.hasOwnProperty('password'), false); - t.is(result.hasOwnProperty('groups'), false); - t.is(result.hasOwnProperty('author'), false); + t.is(Object.hasOwn(result, 'createdAt'), true); + t.is(Object.hasOwn(result, 'updatedAt'), true); + t.is(Object.hasOwn(result, 'password'), false); + t.is(Object.hasOwn(result, 'groups'), false); + t.is(Object.hasOwn(result, 'author'), false); } catch (error) { console.error(error); throw error; @@ -309,7 +308,7 @@ test.serial(`${currentTest} should return a created group`, async (t) => { const result = JSON.parse(createGroupResponse.text); t.is(result.title, newGroup1.title); - t.is(result.hasOwnProperty('users'), true); + t.is(Object.hasOwn(result, 'users'), true); t.is(typeof result.users, 'object'); t.is(result.users.length, 1); t.is(result.users[0].email, testData.users.simpleUserEmail.toLowerCase()); @@ -361,7 +360,7 @@ test.serial(`${currentTest} should return connection without deleted group resul t.is(createGroupResponse.status, 201); - t.is(result.hasOwnProperty('id'), true); + t.is(Object.hasOwn(result, 'id'), true); t.is(result.title, newGroup1.title); const createGroupRO = JSON.parse(createGroupResponse.text); @@ -376,7 +375,7 @@ test.serial(`${currentTest} should return connection without deleted group resul //after deleting group result = response.body; t.is(response.status, 200); - t.is(result.hasOwnProperty('title'), true); + t.is(Object.hasOwn(result, 'title'), true); t.is(result.title, createGroupRO.title); t.is(result.isMain, false); // check that group was deleted @@ -390,9 +389,9 @@ test.serial(`${currentTest} should return connection without deleted group resul t.is(response.status, 200); result = JSON.parse(response.text); t.is(result.length, 1); - const groupId = result[0].group.id; + const _groupId = result[0].group.id; - t.is(result[0].group.hasOwnProperty('title'), true); + t.is(Object.hasOwn(result[0].group, 'title'), true); t.is(result[0].accessLevel, AccessLevelEnum.edit); const index = result.findIndex((el: any) => { @@ -424,7 +423,7 @@ test.serial( t.is(createGroupResponse.status, 201); - t.is(result.hasOwnProperty('id'), true); + t.is(Object.hasOwn(result, 'id'), true); t.is(result.title, newGroup1.title); const createGroupRO = JSON.parse(createGroupResponse.text); @@ -469,9 +468,9 @@ test.serial(`${currentTest} return should groups in connection`, async (t) => { t.is(response.status, 200); const result = JSON.parse(response.text); - const groupId = result[0].group.id; + const _groupId = result[0].group.id; - t.is(result[1].group.hasOwnProperty('title'), true); + t.is(Object.hasOwn(result[1].group, 'title'), true); t.is(result[0].accessLevel, AccessLevelEnum.edit); const index = result.findIndex((el: any) => el.group.title === 'Admin'); @@ -538,9 +537,9 @@ test.serial(`${currentTest} should return permissions object for current group i const result = JSON.parse(response.text); t.is(response.status, 200); - t.is(result.hasOwnProperty('connection'), true); - t.is(result.hasOwnProperty('group'), true); - t.is(result.hasOwnProperty('tables'), true); + t.is(Object.hasOwn(result, 'connection'), true); + t.is(Object.hasOwn(result, 'group'), true); + t.is(Object.hasOwn(result, 'tables'), true); t.is(typeof result.connection, 'object'); t.is(typeof result.group, 'object'); t.is(result.connection.connectionId, testData.connections.firstId); @@ -553,7 +552,7 @@ test.serial(`${currentTest} should return permissions object for current group i const tableIndex = tables.findIndex((table) => table.tableName === testData.firstTableInfo.testTableName); t.is(tables.length > 0, true); t.is(typeof tables[0], 'object'); - t.is(tables[tableIndex].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(tables[tableIndex], 'accessLevel'), true); t.is(tables[tableIndex].accessLevel.visibility, false); t.is(tables[tableIndex].accessLevel.readonly, false); t.is(tables[tableIndex].accessLevel.add, false); @@ -594,9 +593,9 @@ test.serial(`${currentTest} should return permissions object for current group i t.is(response.status, 200); const result = JSON.parse(response.text); - t.is(result.hasOwnProperty('connection'), true); - t.is(result.hasOwnProperty('group'), true); - t.is(result.hasOwnProperty('tables'), true); + t.is(Object.hasOwn(result, 'connection'), true); + t.is(Object.hasOwn(result, 'group'), true); + t.is(Object.hasOwn(result, 'tables'), true); t.is(typeof result.connection, 'object'); t.is(typeof result.group, 'object'); t.is(result.connection.connectionId, testData.connections.firstId); @@ -609,7 +608,7 @@ test.serial(`${currentTest} should return permissions object for current group i const tableIndex = tables.findIndex((table) => table.tableName === testData.firstTableInfo.testTableName); t.is(tables.length > 0, true); t.is(typeof tables[0], 'object'); - t.is(tables[tableIndex].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(tables[tableIndex], 'accessLevel'), true); t.is(tables[tableIndex].accessLevel.visibility, true); t.is(tables[tableIndex].accessLevel.readonly, false); t.is(tables[tableIndex].accessLevel.add, true); @@ -651,9 +650,9 @@ test.serial( t.is(response.status, 200); const result = JSON.parse(response.text); - t.is(result.hasOwnProperty('connection'), true); - t.is(result.hasOwnProperty('group'), true); - t.is(result.hasOwnProperty('tables'), true); + t.is(Object.hasOwn(result, 'connection'), true); + t.is(Object.hasOwn(result, 'group'), true); + t.is(Object.hasOwn(result, 'tables'), true); t.is(typeof result.connection, 'object'); t.is(typeof result.group, 'object'); t.is(result.connection.connectionId, testData.connections.secondId); @@ -666,7 +665,7 @@ test.serial( const tableIndex = tables.findIndex((table) => table.tableName === testData.secondTableInfo.testTableName); t.is(tables.length > 0, true); t.is(typeof tables[0], 'object'); - t.is(tables[tableIndex].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(tables[tableIndex], 'accessLevel'), true); t.is(tables[tableIndex].accessLevel.visibility, false); t.is(tables[tableIndex].accessLevel.readonly, false); t.is(tables[tableIndex].accessLevel.add, false); @@ -697,11 +696,11 @@ test.serial(`${currentTest} should return found groups with current user`, async const { groups, groupsCount } = getGroupsRO; t.is(groupsCount, 1); t.is(groups.length, 1); - t.is(groups[0].hasOwnProperty('group'), true); - t.is(groups[0].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(groups[0], 'group'), true); + t.is(Object.hasOwn(groups[0], 'accessLevel'), true); - t.is(groups[0].group.hasOwnProperty('title'), true); - t.is(groups[0].group.hasOwnProperty('isMain'), true); + t.is(Object.hasOwn(groups[0].group, 'title'), true); + t.is(Object.hasOwn(groups[0].group, 'isMain'), true); } catch (error) { console.error(error); throw error; @@ -732,10 +731,10 @@ test.serial(`${currentTest} it should return users in group`, async (t) => { const getUsersRO = JSON.parse(response.text); t.is(getUsersRO.length, 2); t.is(getUsersRO[0].id === getUsersRO[1].id, false); - t.is(getUsersRO[0].hasOwnProperty('createdAt'), true); - t.is(getUsersRO[0].hasOwnProperty('password'), false); - t.is(getUsersRO[0].hasOwnProperty('isActive'), true); - t.is(getUsersRO[0].hasOwnProperty('email'), true); + t.is(Object.hasOwn(getUsersRO[0], 'createdAt'), true); + t.is(Object.hasOwn(getUsersRO[0], 'password'), false); + t.is(Object.hasOwn(getUsersRO[0], 'isActive'), true); + t.is(Object.hasOwn(getUsersRO[0], 'email'), true); } catch (error) { console.error(error); throw error; @@ -806,9 +805,9 @@ test.serial(`${currentTest} should return group with added user`, async (t) => { const addUserInGroupRO = JSON.parse(addUserInGroupResponse.text).group; - t.is(addUserInGroupRO.hasOwnProperty('title'), true); - t.is(addUserInGroupRO.hasOwnProperty('isMain'), true); - t.is(addUserInGroupRO.hasOwnProperty('users'), true); + t.is(Object.hasOwn(addUserInGroupRO, 'title'), true); + t.is(Object.hasOwn(addUserInGroupRO, 'isMain'), true); + t.is(Object.hasOwn(addUserInGroupRO, 'users'), true); const { users } = addUserInGroupRO; t.is(users.length, 3); t.is(users[0].id === users[1].id, false); @@ -839,7 +838,7 @@ test.serial(`${currentTest} should throw exception, when user email not passed i .send({ groupId }) .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const addUserInGroupRO = JSON.parse(addUserInGroupResponse.text); + const _addUserInGroupRO = JSON.parse(addUserInGroupResponse.text); t.is(addUserInGroupResponse.status, 400); // t.is(addUserInGroupRO.message, ErrorsMessages.VALIDATION_FAILED); } catch (error) { @@ -860,7 +859,7 @@ test.serial(`${currentTest} should throw exception, when group id not passed in t.is(getGroupsResponse.status, 200); const getGroupsRO = JSON.parse(getGroupsResponse.text); - const groupId = getGroupsRO[0].group.id; + const _groupId = getGroupsRO[0].group.id; const email = faker.internet.email(); const addUserInGroupResponse = await request(app.getHttpServer()) .put('/group/user') @@ -888,7 +887,7 @@ test.serial(`${currentTest} should throw exception, when group id passed in requ .set('Accept', 'application/json'); t.is(getGroupsResponse.status, 200); - const getGroupsRO = JSON.parse(getGroupsResponse.text); + const _getGroupsRO = JSON.parse(getGroupsResponse.text); const email = faker.internet.email(); const groupId = faker.string.uuid(); @@ -982,7 +981,7 @@ test.serial(`${currentTest} should throw an exception when group id not passed i .set('Accept', 'application/json'); t.is(getGroupsResponse.status, 200); - const getGroupsRO = JSON.parse(getGroupsResponse.text); + const _getGroupsRO = JSON.parse(getGroupsResponse.text); const deleteGroupResponse = await request(app.getHttpServer()) .delete(`/group/`) @@ -1064,9 +1063,9 @@ test.serial(`${currentTest} should return group without deleted user`, async (t) .set('Accept', 'application/json'); const deleteUserInGroupRO = JSON.parse(deleteUserInGroupResponse.text); - t.is(deleteUserInGroupRO.hasOwnProperty('title'), true); - t.is(deleteUserInGroupRO.hasOwnProperty('isMain'), true); - t.is(deleteUserInGroupRO.hasOwnProperty('users'), true); + t.is(Object.hasOwn(deleteUserInGroupRO, 'title'), true); + t.is(Object.hasOwn(deleteUserInGroupRO, 'isMain'), true); + t.is(Object.hasOwn(deleteUserInGroupRO, 'users'), true); const { users } = deleteUserInGroupRO; t.is(users.length, 2); t.is(users[0].id === users[1].id, false); @@ -1097,7 +1096,7 @@ test.serial(`${currentTest} should throw exception, when user email not passed i undefined, ); - const email = thirdTestUser.email; + const _email = thirdTestUser.email; const deleteUserInGroupResponse = await request(app.getHttpServer()) .put('/group/user/delete') @@ -1105,7 +1104,7 @@ test.serial(`${currentTest} should throw exception, when user email not passed i .send({ groupId }) .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const deleteUserInGroupRO = JSON.parse(deleteUserInGroupResponse.text); + const _deleteUserInGroupRO = JSON.parse(deleteUserInGroupResponse.text); // t.is(deleteUserInGroupRO.message, ErrorsMessages.VALIDATION_FAILED); } catch (error) { console.error(error); @@ -1125,7 +1124,7 @@ test.serial(`${currentTest} should throw exception, when group id not passed in t.is(getGroupsResponse.status, 200); const getGroupsRO = JSON.parse(getGroupsResponse.text); - const groupId = getGroupsRO[0].group.id; + const _groupId = getGroupsRO[0].group.id; const thirdTestUser = await inviteUserInCompanyAndAcceptInvitation( testData.users.adminUserToken, @@ -2203,15 +2202,15 @@ test.serial(`${currentTest} should return added row`, async (t) => { .set('Accept', 'application/json'); const addRowInTableRO = JSON.parse(addRowInTable.text); t.is(addRowInTable.status, 201); - t.is(addRowInTableRO.row.hasOwnProperty('id'), true); + t.is(Object.hasOwn(addRowInTableRO.row, 'id'), true); t.is(addRowInTableRO.row[testData.firstTableInfo.testTableColumnName], randomName); t.is(addRowInTableRO.row[testData.firstTableInfo.testTableSecondColumnName], randomEmail); - t.is(addRowInTableRO.row.hasOwnProperty('created_at'), true); - t.is(addRowInTableRO.row.hasOwnProperty('updated_at'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO.row, 'created_at'), true); + t.is(Object.hasOwn(addRowInTableRO.row, 'updated_at'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); } catch (error) { console.error(error); throw error; @@ -2427,15 +2426,15 @@ test.serial(`${currentTest} should return updated row`, async (t) => { .set('Accept', 'application/json'); const addRowInTableRO = JSON.parse(updateRowInTable.text); t.is(updateRowInTable.status, 200); - t.is(addRowInTableRO.row.hasOwnProperty('id'), true); + t.is(Object.hasOwn(addRowInTableRO.row, 'id'), true); t.is(addRowInTableRO.row[testData.firstTableInfo.testTableColumnName], randomName); t.is(addRowInTableRO.row[testData.firstTableInfo.testTableSecondColumnName], randomEmail); - t.is(addRowInTableRO.row.hasOwnProperty('created_at'), true); - t.is(addRowInTableRO.row.hasOwnProperty('updated_at'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO.row, 'created_at'), true); + t.is(Object.hasOwn(addRowInTableRO.row, 'updated_at'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); } catch (error) { console.error(error); throw error; @@ -2820,12 +2819,12 @@ test.serial(`${currentTest} `, async (t) => { const getRowInTableRO = JSON.parse(getRowInTable.text); t.is(getRowInTable.status, 200); t.is(getRowInTableRO.row.id, 5); - t.is(getRowInTableRO.row.hasOwnProperty('created_at'), true); - t.is(getRowInTableRO.row.hasOwnProperty('updated_at'), true); - t.is(getRowInTableRO.hasOwnProperty('structure'), true); - t.is(getRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(getRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(getRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(getRowInTableRO.row, 'created_at'), true); + t.is(Object.hasOwn(getRowInTableRO.row, 'updated_at'), true); + t.is(Object.hasOwn(getRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(getRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(getRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getRowInTableRO, 'readonly_fields'), true); } catch (error) { console.error(error); throw error; @@ -2988,15 +2987,15 @@ test.serial(`${currentTest} should return all found logs in connection`, async ( const getRowInTableRO = JSON.parse(getTableLogs.text); t.is(getRowInTableRO.logs.length, 1); - t.is(getRowInTableRO.logs[0].hasOwnProperty('table_name'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('received_data'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('old_data'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('cognitoUserName'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('email'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('operationType'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('operationStatusResult'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('createdAt'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('connection_id'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'table_name'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'received_data'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'old_data'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'cognitoUserName'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'email'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'operationType'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'operationStatusResult'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'createdAt'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'connection_id'), true); } catch (error) { console.error(error); throw error; @@ -3132,7 +3131,7 @@ test.serial(`${currentTest} should return table settings when it was created`, a .set('Accept', 'application/json'); const getTableSettingsRO = JSON.parse(getTableSettings.text); t.is(getTableSettings.status, 200); - t.is(getTableSettingsRO.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getTableSettingsRO, 'id'), true); t.is(getTableSettingsRO.table_name, createTableSettingsDTO.table_name); t.is(getTableSettingsRO.display_name, createTableSettingsDTO.display_name); t.is(JSON.stringify(getTableSettingsRO.search_fields), JSON.stringify(createTableSettingsDTO.search_fields)); @@ -3235,7 +3234,7 @@ test.serial(`${currentTest} should return created table settings`, async (t) => t.is(createTableSettingsResponse.status, 201); const createTableSettingsRO = JSON.parse(createTableSettingsResponse.text); - t.is(createTableSettingsRO.hasOwnProperty('id'), true); + t.is(Object.hasOwn(createTableSettingsRO, 'id'), true); t.is(createTableSettingsRO.table_name, createTableSettingsDTO.table_name); t.is(createTableSettingsRO.display_name, createTableSettingsDTO.display_name); t.is(JSON.stringify(createTableSettingsRO.search_fields), JSON.stringify(createTableSettingsDTO.search_fields)); @@ -3351,7 +3350,7 @@ test.serial(`${currentTest} should return updated table settings`, async (t) => const updateTableSettingsRO = JSON.parse(updateTableSettingsResponse.text); t.is(updateTableSettingsResponse.status, 200); - t.is(updateTableSettingsRO.hasOwnProperty('id'), true); + t.is(Object.hasOwn(updateTableSettingsRO, 'id'), true); t.is(updateTableSettingsRO.table_name, updateTableSettingsDTO.table_name); t.is(updateTableSettingsRO.display_name, updateTableSettingsDTO.display_name); t.is(JSON.stringify(updateTableSettingsRO.search_fields), JSON.stringify(updateTableSettingsDTO.search_fields)); @@ -3612,7 +3611,7 @@ test.serial(`${currentTest} should return array of table widgets for table`, asy .set('Accept', 'application/json'); t.is(getTableStructureResponse.status, 200); const getTableStructureRO = JSON.parse(getTableStructureResponse.text); - t.is(getTableStructureRO.hasOwnProperty('table_widgets'), true); + t.is(Object.hasOwn(getTableStructureRO, 'table_widgets'), true); getTableStructureRO.table_widgets.sort((a, b) => a.field_name.localeCompare(b.field_name)) t.is(getTableStructureRO.table_widgets.length, 2); diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-user-e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-user-e2e.test.ts index b1734995..42a8d701 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-user-e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-user-e2e.test.ts @@ -7,9 +7,7 @@ import { DatabaseService } from '../../../src/shared/database/database.service.j import { TestUtils } from '../../utils/test.utils.js'; import { INestApplication, ValidationPipe } from '@nestjs/common'; import request from 'supertest'; -import { Constants } from '../../../src/helpers/constants/constants.js'; import { IUserInfo } from '../../../src/entities/user/user.interface.js'; -import { faker } from '@faker-js/faker'; import { AllExceptionsFilter } from '../../../src/exceptions/all-exceptions.filter.js'; import cookieParser from 'cookie-parser'; import { registerUserAndReturnUserInfo } from '../../utils/register-user-and-return-user-info.js'; @@ -21,7 +19,7 @@ import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; let app: INestApplication; let currentTest: string; -let testUtils: TestUtils; +let _testUtils: TestUtils; test.beforeEach(async () => { setSaasEnvVariable(); @@ -30,7 +28,7 @@ test.beforeEach(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); // await testUtils.resetDb(); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -57,7 +55,6 @@ test.after(async () => { currentTest = 'GET /user'; test.serial(`${currentTest} should return user info for this user`, async (t) => { - try { const adminUserRegisterInfo = await registerUserAndReturnUserInfo(app); const { token } = adminUserRegisterInfo; @@ -70,17 +67,13 @@ test.serial(`${currentTest} should return user info for this user`, async (t) => t.is(getUserRO.isActive, true); t.is(getUserRO.email, adminUserRegisterInfo.email); - t.is(getUserRO.hasOwnProperty('createdAt'), true); - } catch (err) { - throw err; - } + t.is(Object.hasOwn(getUserRO, 'createdAt'), true); t.pass(); }); currentTest = 'DELETE /user'; test.serial(`${currentTest} should return user deletion result`, async (t) => { - try { const adminUserRegisterInfo = await registerUserAndReturnUserInfo(app); const { token } = adminUserRegisterInfo; @@ -103,14 +96,10 @@ test.serial(`${currentTest} should return user deletion result`, async (t) => { .set('Content-Type', 'application/json') .set('Accept', 'application/json'); t.is(getUserResult.status, 404); - } catch (err) { - throw err; - } t.pass(); }); test.serial(`${currentTest} should return expiration token when user login`, async (t) => { - try { const adminUserRegisterInfo = await registerUserAndReturnUserInfo(app); const { email, password } = adminUserRegisterInfo; @@ -120,15 +109,11 @@ test.serial(`${currentTest} should return expiration token when user login`, asy .set('Content-Type', 'application/json') .set('Accept', 'application/json'); const loginUserRO = JSON.parse(loginUserResult.text); - t.is(loginUserRO.hasOwnProperty('expires'), true); - } catch (err) { - throw err; - } + t.is(Object.hasOwn(loginUserRO, 'expires'), true); t.pass(); }); test.serial(`${currentTest} reject authorization when try to login with wrong password`, async (t) => { - try { const adminUserRegisterInfo = await registerUserAndReturnUserInfo(app); const { email, password } = adminUserRegisterInfo; @@ -148,16 +133,12 @@ test.serial(`${currentTest} reject authorization when try to login with wrong pa .set('Content-Type', 'application/json') .set('Accept', 'application/json'); const loginUserRO = JSON.parse(loginUserResult.text); - t.is(loginUserRO.hasOwnProperty('expires'), true); - } catch (err) { - throw err; - } + t.is(Object.hasOwn(loginUserRO, 'expires'), true); t.pass(); }); currentTest = 'GET /user/settings'; test.serial(`${currentTest} should return empty user settings when it was not created`, async (t) => { - try { const adminUserRegisterInfo = await registerUserAndReturnUserInfo(app); const { token } = adminUserRegisterInfo; @@ -168,17 +149,13 @@ test.serial(`${currentTest} should return empty user settings when it was not cr .set('Accept', 'application/json'); const getUserSettingsRO = JSON.parse(getUserSettingsResult.text); t.is(getUserSettingsResult.status, 200); - t.is(getUserSettingsRO.hasOwnProperty('userSettings'), true); + t.is(Object.hasOwn(getUserSettingsRO, 'userSettings'), true); t.is(getUserSettingsRO.userSettings, null); - } catch (err) { - throw err; - } t.pass(); }); currentTest = 'POST /user/settings'; test.serial(`${currentTest} should return created user settings`, async (t) => { - try { const adminUserRegisterInfo = await registerUserAndReturnUserInfo(app); const { token } = adminUserRegisterInfo; @@ -193,16 +170,12 @@ test.serial(`${currentTest} should return created user settings`, async (t) => { t.is(saveUserSettingsResult.status, 201); const saveUserSettingsRO = JSON.parse(saveUserSettingsResult.text); - t.is(saveUserSettingsRO.hasOwnProperty('userSettings'), true); + t.is(Object.hasOwn(saveUserSettingsRO, 'userSettings'), true); t.is(JSON.parse(saveUserSettingsRO.userSettings).test, 'test'); - } catch (err) { - throw err; - } t.pass(); }); test.serial(`${currentTest} should return user settings when it was created`, async (t) => { - try { const adminUserRegisterInfo = await registerUserAndReturnUserInfo(app); const { token } = adminUserRegisterInfo; @@ -224,10 +197,7 @@ test.serial(`${currentTest} should return user settings when it was created`, as .set('Accept', 'application/json'); const getUserSettingsRO = JSON.parse(getUserSettingsResult.text); t.is(getUserSettingsResult.status, 200); - t.is(getUserSettingsRO.hasOwnProperty('userSettings'), true); + t.is(Object.hasOwn(getUserSettingsRO, 'userSettings'), true); t.is(JSON.parse(getUserSettingsRO.userSettings).test, 'test'); - } catch (err) { - throw err; - } t.pass(); }); diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-user-group-edit-permissions-e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-user-group-edit-permissions-e2e.test.ts index c40b01f1..f689d6e0 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-user-group-edit-permissions-e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-user-group-edit-permissions-e2e.test.ts @@ -22,11 +22,10 @@ import { inviteUserInCompanyAndAcceptInvitation } from '../../utils/register-use import { setSaasEnvVariable } from '../../utils/set-saas-env-variable.js'; import { ValidationException } from '../../../src/exceptions/custom-exceptions/validation-exception.js'; import { ValidationError } from 'class-validator'; -import { ErrorsMessages } from '../../../src/exceptions/custom-exceptions/messages/custom-errors-messages.js'; import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; let currentTest: string; const mockFactory = new MockFactory(); @@ -48,7 +47,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -99,22 +98,22 @@ test.serial(`${currentTest} should return connections, where second user have ac const result = findAll.body.connections; t.is(result.length, 1); - t.is(result[0].hasOwnProperty('connection'), true); - t.is(result[0].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(result[0], 'connection'), true); + t.is(Object.hasOwn(result[0], 'accessLevel'), true); - t.is(result[0].hasOwnProperty('accessLevel'), true); - t.is(result[0].connection.hasOwnProperty('host'), true); - t.is(result[0].connection.hasOwnProperty('host'), true); + t.is(Object.hasOwn(result[0], 'accessLevel'), true); + t.is(Object.hasOwn(result[0].connection, 'host'), true); + t.is(Object.hasOwn(result[0].connection, 'host'), true); t.is(typeof result[0].connection.port, 'number'); - t.is(result[0].connection.hasOwnProperty('port'), true); - t.is(result[0].connection.hasOwnProperty('username'), true); - t.is(result[0].connection.hasOwnProperty('database'), true); - t.is(result[0].connection.hasOwnProperty('sid'), true); - t.is(result[0].connection.hasOwnProperty('createdAt'), true); - t.is(result[0].connection.hasOwnProperty('updatedAt'), true); - t.is(result[0].connection.hasOwnProperty('password'), false); - t.is(result[0].connection.hasOwnProperty('groups'), false); - t.is(result[0].connection.hasOwnProperty('author'), false); + t.is(Object.hasOwn(result[0].connection, 'port'), true); + t.is(Object.hasOwn(result[0].connection, 'username'), true); + t.is(Object.hasOwn(result[0].connection, 'database'), true); + t.is(Object.hasOwn(result[0].connection, 'sid'), true); + t.is(Object.hasOwn(result[0].connection, 'createdAt'), true); + t.is(Object.hasOwn(result[0].connection, 'updatedAt'), true); + t.is(Object.hasOwn(result[0].connection, 'password'), false); + t.is(Object.hasOwn(result[0].connection, 'groups'), false); + t.is(Object.hasOwn(result[0].connection, 'author'), false); } catch (e) { console.error(e); } @@ -152,11 +151,11 @@ test.serial(`${currentTest} should return a found connection`, async (t) => { t.is(result.username, 'postgres'); t.is(result.database, newConnectionToPostgres.database); t.is(result.sid, null); - t.is(result.hasOwnProperty('createdAt'), true); - t.is(result.hasOwnProperty('updatedAt'), true); - t.is(result.hasOwnProperty('password'), false); - t.is(result.hasOwnProperty('groups'), false); - t.is(result.hasOwnProperty('author'), false); + t.is(Object.hasOwn(result, 'createdAt'), true); + t.is(Object.hasOwn(result, 'updatedAt'), true); + t.is(Object.hasOwn(result, 'password'), false); + t.is(Object.hasOwn(result, 'groups'), false); + t.is(Object.hasOwn(result, 'author'), false); } catch (e) { console.error(e); } @@ -187,7 +186,7 @@ test.serial( // todo add checking connection object properties t.is(findOneResponce.status, 200); const findOneRO = JSON.parse(findOneResponce.text); - t.is(findOneRO.hasOwnProperty('host'), false); + t.is(Object.hasOwn(findOneRO, 'host'), false); } catch (e) { console.error(e); } @@ -404,7 +403,7 @@ test.serial(`${currentTest} should return connection without deleted group resul let result = createGroupResponse.body; t.is(createGroupResponse.status, 201); - t.is(result.hasOwnProperty('id'), true); + t.is(Object.hasOwn(result, 'id'), true); t.is(result.title, newGroup1.title); const createGroupRO = JSON.parse(createGroupResponse.text); @@ -451,7 +450,7 @@ test.serial( t.is(createGroupResponse.status, 201); - t.is(result.hasOwnProperty('id'), true); + t.is(Object.hasOwn(result, 'id'), true); t.is(result.title, newGroup1.title); const createGroupRO = JSON.parse(createGroupResponse.text); @@ -504,9 +503,9 @@ test.serial(`${currentTest} should groups in connection`, async (t) => { t.is(response.status, 200); const result = JSON.parse(response.text); - const groupId = result[0].group.id; + const _groupId = result[0].group.id; - t.is(result[0].group.hasOwnProperty('title'), true); + t.is(Object.hasOwn(result[0].group, 'title'), true); t.is(result[0].accessLevel, AccessLevelEnum.edit); const index = result.findIndex((el: any) => { @@ -586,9 +585,9 @@ test.serial(`${currentTest} should return permissions object for current group i const result = JSON.parse(response.text); t.is(response.status, 200); - t.is(result.hasOwnProperty('connection'), true); - t.is(result.hasOwnProperty('group'), true); - t.is(result.hasOwnProperty('tables'), true); + t.is(Object.hasOwn(result, 'connection'), true); + t.is(Object.hasOwn(result, 'group'), true); + t.is(Object.hasOwn(result, 'tables'), true); t.is(typeof result.connection, 'object'); t.is(typeof result.group, 'object'); t.is(result.connection.connectionId, connections.firstId); @@ -601,7 +600,7 @@ test.serial(`${currentTest} should return permissions object for current group i const tableIndex = tables.findIndex((table: any) => table.tableName === firstTableInfo.testTableName); t.is(tables.length > 0, true); t.is(typeof tables[tableIndex], 'object'); - t.is(tables[tableIndex].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(tables[tableIndex], 'accessLevel'), true); t.is(tables[tableIndex].accessLevel.visibility, tablePermissions.visibility); t.is(tables[tableIndex].accessLevel.readonly, tablePermissions.readonly); t.is(tables[tableIndex].accessLevel.add, tablePermissions.add); @@ -643,9 +642,9 @@ test.serial(`${currentTest} should return permissions object for current group i t.is(response.status, 200); const result = JSON.parse(response.text); - t.is(result.hasOwnProperty('connection'), true); - t.is(result.hasOwnProperty('group'), true); - t.is(result.hasOwnProperty('tables'), true); + t.is(Object.hasOwn(result, 'connection'), true); + t.is(Object.hasOwn(result, 'group'), true); + t.is(Object.hasOwn(result, 'tables'), true); t.is(typeof result.connection, 'object'); t.is(typeof result.group, 'object'); t.is(result.connection.connectionId, connections.firstId); @@ -658,7 +657,7 @@ test.serial(`${currentTest} should return permissions object for current group i const foundTableIndex = tables.findIndex((table) => table.tableName === firstTableInfo.testTableName); t.is(tables.length > 0, true); t.is(typeof tables[foundTableIndex], 'object'); - t.is(tables[foundTableIndex].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(tables[foundTableIndex], 'accessLevel'), true); t.is(tables[foundTableIndex].accessLevel.visibility, tablePermissions.visibility); t.is(tables[foundTableIndex].accessLevel.readonly, tablePermissions.readonly); t.is(tables[foundTableIndex].accessLevel.add, tablePermissions.add); @@ -702,9 +701,9 @@ test.serial( t.is(response.status, 200); const result = JSON.parse(response.text); - t.is(result.hasOwnProperty('connection'), true); - t.is(result.hasOwnProperty('group'), true); - t.is(result.hasOwnProperty('tables'), true); + t.is(Object.hasOwn(result, 'connection'), true); + t.is(Object.hasOwn(result, 'group'), true); + t.is(Object.hasOwn(result, 'tables'), true); t.is(typeof result.connection, 'object'); t.is(typeof result.group, 'object'); t.is(result.connection.connectionId, connections.secondId); @@ -717,7 +716,7 @@ test.serial( const foundTableIndex = tables.findIndex((table) => table.tableName === firstTableInfo.testTableName); t.is(tables.length > 0, true); t.is(typeof tables[0], 'object'); - t.is(tables[foundTableIndex].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(tables[foundTableIndex], 'accessLevel'), true); t.is(tables[foundTableIndex].accessLevel.visibility, false); t.is(tables[foundTableIndex].accessLevel.readonly, false); t.is(tables[foundTableIndex].accessLevel.add, false); @@ -751,11 +750,11 @@ test.serial(`${currentTest} should return found groups with current user`, async const { groups, groupsCount } = getGroupsRO; t.is(groupsCount, 1); t.is(groups.length, 1); - t.is(groups[0].hasOwnProperty('group'), true); - t.is(groups[0].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(groups[0], 'group'), true); + t.is(Object.hasOwn(groups[0], 'accessLevel'), true); - t.is(groups[0].group.hasOwnProperty('title'), true); - t.is(groups[0].group.hasOwnProperty('isMain'), true); + t.is(Object.hasOwn(groups[0].group, 'title'), true); + t.is(Object.hasOwn(groups[0].group, 'isMain'), true); } catch (e) { console.error(e); } @@ -792,10 +791,10 @@ test.serial(`${currentTest} it should return users in group`, async (t) => { const getUsersRO = JSON.parse(response.text); t.is(getUsersRO.length, 2); t.is(getUsersRO[0].id === getUsersRO[1].id, false); - t.is(getUsersRO[0].hasOwnProperty('createdAt'), true); - t.is(getUsersRO[0].hasOwnProperty('password'), false); - t.is(getUsersRO[0].hasOwnProperty('isActive'), true); - t.is(getUsersRO[0].hasOwnProperty('email'), true); + t.is(Object.hasOwn(getUsersRO[0], 'createdAt'), true); + t.is(Object.hasOwn(getUsersRO[0], 'password'), false); + t.is(Object.hasOwn(getUsersRO[0], 'isActive'), true); + t.is(Object.hasOwn(getUsersRO[0], 'email'), true); } catch (e) { console.error(e); } @@ -871,9 +870,9 @@ test.serial(`${currentTest} should return group with added user`, async (t) => { .set('Accept', 'application/json'); const addUserInGroupRO = JSON.parse(addUserInGroupResponse.text).group; - t.is(addUserInGroupRO.hasOwnProperty('title'), true); - t.is(addUserInGroupRO.hasOwnProperty('isMain'), true); - t.is(addUserInGroupRO.hasOwnProperty('users'), true); + t.is(Object.hasOwn(addUserInGroupRO, 'title'), true); + t.is(Object.hasOwn(addUserInGroupRO, 'isMain'), true); + t.is(Object.hasOwn(addUserInGroupRO, 'users'), true); const { users } = addUserInGroupRO; t.is(users.length, 3); t.is(users[0].id === users[1].id, false); @@ -911,7 +910,7 @@ test.serial(`${currentTest} should throw exception, when user email not passed i .send({ groupId }) .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const addUserInGroupRO = JSON.parse(addUserInGroupResponse.text); + const _addUserInGroupRO = JSON.parse(addUserInGroupResponse.text); t.is(addUserInGroupResponse.status, 400); // t.is(addUserInGroupRO.message, ErrorsMessages.VALIDATION_FAILED); } catch (e) { @@ -939,7 +938,7 @@ test.serial(`${currentTest} should throw exception, when group id not passed in t.is(getGroupsResponse.status, 200); const getGroupsRO = JSON.parse(getGroupsResponse.text); - const groupId = getGroupsRO[0].group.id; + const _groupId = getGroupsRO[0].group.id; const email = faker.internet.email(); const addUserInGroupResponse = await request(app.getHttpServer()) .put('/group/user') @@ -973,7 +972,7 @@ test.serial(`${currentTest} should throw exception, when group id passed in requ .set('Accept', 'application/json'); t.is(getGroupsResponse.status, 200); - const getGroupsRO = JSON.parse(getGroupsResponse.text); + const _getGroupsRO = JSON.parse(getGroupsResponse.text); const email = faker.internet.email(); const groupId = faker.string.uuid(); @@ -1080,7 +1079,7 @@ test.serial(`${currentTest} should throw an exception when group id not passed i t.is(getGroupsResponse.status, 200); const getGroupsRO = JSON.parse(getGroupsResponse.text); - const groupId = getGroupsRO[0].group.id; + const _groupId = getGroupsRO[0].group.id; const deleteGroupResponse = await request(app.getHttpServer()) .delete(`/group/`) .set('Cookie', simpleUserToken) @@ -1168,9 +1167,9 @@ test.serial(`${currentTest} should return group without deleted user`, async (t) .set('Accept', 'application/json'); const deleteUserInGroupRO = JSON.parse(deleteUserInGroupResponse.text); - t.is(deleteUserInGroupRO.hasOwnProperty('title'), true); - t.is(deleteUserInGroupRO.hasOwnProperty('isMain'), true); - t.is(deleteUserInGroupRO.hasOwnProperty('users'), true); + t.is(Object.hasOwn(deleteUserInGroupRO, 'title'), true); + t.is(Object.hasOwn(deleteUserInGroupRO, 'isMain'), true); + t.is(Object.hasOwn(deleteUserInGroupRO, 'users'), true); const { users } = deleteUserInGroupRO; t.is(users.length, 2); t.is(users[0].id === users[1].id, false); @@ -1203,7 +1202,7 @@ test.serial(`${currentTest} should throw exception, when user email not passed i const thirdTestUser = await inviteUserInCompanyAndAcceptInvitation(adminUserToken, undefined, app, undefined); - const email = thirdTestUser.email; + const _email = thirdTestUser.email; const deleteUserInGroupResponse = await request(app.getHttpServer()) .put('/group/user/delete') @@ -1211,7 +1210,7 @@ test.serial(`${currentTest} should throw exception, when user email not passed i .send({ groupId }) .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const deleteUserInGroupRO = JSON.parse(deleteUserInGroupResponse.text); + const _deleteUserInGroupRO = JSON.parse(deleteUserInGroupResponse.text); // t.is(deleteUserInGroupRO.message, ErrorsMessages.VALIDATION_FAILED); } catch (e) { console.error(e); @@ -1238,7 +1237,7 @@ test.serial(`${currentTest} should throw exception, when group id not passed in t.is(getGroupsResponse.status, 200); const getGroupsRO = JSON.parse(getGroupsResponse.text); - const groupId = getGroupsRO[0].group.id; + const _groupId = getGroupsRO[0].group.id; const thirdTestUser = await inviteUserInCompanyAndAcceptInvitation(adminUserToken, undefined, app, undefined); @@ -1412,7 +1411,7 @@ test.serial( .set('Cookie', simpleUserToken) .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const createOrUpdatePermissionRO = JSON.parse(createOrUpdatePermissionResponse.text); + const _createOrUpdatePermissionRO = JSON.parse(createOrUpdatePermissionResponse.text); t.is(createOrUpdatePermissionResponse.status, 403); } catch (e) { console.error(e); @@ -1827,15 +1826,15 @@ test.serial(`${currentTest} should return added row`, async (t) => { .set('Accept', 'application/json'); const addRowInTableRO = JSON.parse(addRowInTable.text); t.is(addRowInTable.status, 201); - t.is(addRowInTableRO.row.hasOwnProperty('id'), true); + t.is(Object.hasOwn(addRowInTableRO.row, 'id'), true); t.is(addRowInTableRO.row[firstTableInfo.testTableColumnName], randomName); t.is(addRowInTableRO.row[firstTableInfo.testTableSecondColumnName], randomEmail); - t.is(addRowInTableRO.row.hasOwnProperty('created_at'), true); - t.is(addRowInTableRO.row.hasOwnProperty('updated_at'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO.row, 'created_at'), true); + t.is(Object.hasOwn(addRowInTableRO.row, 'updated_at'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); } catch (e) { console.error(e); } @@ -2112,12 +2111,12 @@ test.serial(`${currentTest} should return row`, async (t) => { const getRowInTableRO = JSON.parse(getRowInTable.text); t.is(getRowInTable.status, 200); t.is(getRowInTableRO.row.id, 7); - t.is(getRowInTableRO.row.hasOwnProperty('created_at'), true); - t.is(getRowInTableRO.row.hasOwnProperty('updated_at'), true); - t.is(getRowInTableRO.hasOwnProperty('structure'), true); - t.is(getRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(getRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(getRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(getRowInTableRO.row, 'created_at'), true); + t.is(Object.hasOwn(getRowInTableRO.row, 'updated_at'), true); + t.is(Object.hasOwn(getRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(getRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(getRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getRowInTableRO, 'readonly_fields'), true); } catch (e) { console.error(e); } @@ -2211,15 +2210,15 @@ test.serial(`${currentTest} should return all found logs in connection'`, async const getRowInTableRO = JSON.parse(getTableLogs.text); t.is(getRowInTableRO.logs.length, 1); - t.is(getRowInTableRO.logs[0].hasOwnProperty('table_name'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('received_data'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('old_data'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('cognitoUserName'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('email'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('operationType'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('operationStatusResult'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('createdAt'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('connection_id'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'table_name'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'received_data'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'old_data'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'cognitoUserName'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'email'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'operationType'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'operationStatusResult'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'createdAt'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'connection_id'), true); } catch (e) { console.error(e); } @@ -2367,7 +2366,7 @@ test.serial(`${currentTest} 'should return table settings when it was created`, .set('Accept', 'application/json'); const getTableSettingsRO = JSON.parse(getTableSettings.text); t.is(getTableSettings.status, 200); - t.is(getTableSettingsRO.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getTableSettingsRO, 'id'), true); t.is(getTableSettingsRO.table_name, createTableSettingsDTO.table_name); t.is(getTableSettingsRO.display_name, createTableSettingsDTO.display_name); t.is(JSON.stringify(getTableSettingsRO.search_fields), JSON.stringify(createTableSettingsDTO.search_fields)); @@ -2842,7 +2841,7 @@ test.serial(`${currentTest} should return array of table widgets for table`, asy .set('Accept', 'application/json'); t.is(getTableStructureResponse.status, 200); const getTableStructureRO = JSON.parse(getTableStructureResponse.text); - t.is(getTableStructureRO.hasOwnProperty('table_widgets'), true); + t.is(Object.hasOwn(getTableStructureRO, 'table_widgets'), true); t.is(getTableStructureRO.table_widgets.length, 2); t.is(getTableStructureRO.table_widgets[0].field_name, newTableWidgets[0].field_name); t.is(getTableStructureRO.table_widgets[1].widget_type, newTableWidgets[1].widget_type); diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-user-sign-in-audit.e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-user-sign-in-audit.e2e.test.ts index 41da4e5f..b17237ba 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-user-sign-in-audit.e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-user-sign-in-audit.e2e.test.ts @@ -23,9 +23,9 @@ import { setSaasEnvVariable } from '../../utils/set-saas-env-variable.js'; let app: INestApplication; let currentTest: string; -let testUtils: TestUtils; +let _testUtils: TestUtils; -const mockFactory = new MockFactory(); +const _mockFactory = new MockFactory(); async function getCompanyIdByToken(app: INestApplication, token: string): Promise { const getCompanyResult = await request(app.getHttpServer()) @@ -44,7 +44,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -96,8 +96,8 @@ test.serial(`${currentTest} should return sign-in audit logs after successful lo t.is(getAuditLogsResult.status, 200); const auditLogsRO = JSON.parse(getAuditLogsResult.text); - t.is(auditLogsRO.hasOwnProperty('logs'), true); - t.is(auditLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(auditLogsRO, 'logs'), true); + t.is(Object.hasOwn(auditLogsRO, 'pagination'), true); t.true(auditLogsRO.logs.length >= 1); // Check that the log entry has expected structure @@ -105,8 +105,8 @@ test.serial(`${currentTest} should return sign-in audit logs after successful lo t.truthy(logEntry); t.is(logEntry.status, SignInStatusEnum.SUCCESS); t.is(logEntry.signInMethod, SignInMethodEnum.EMAIL); - t.is(logEntry.hasOwnProperty('createdAt'), true); - t.is(logEntry.hasOwnProperty('ipAddress'), true); + t.is(Object.hasOwn(logEntry, 'createdAt'), true); + t.is(Object.hasOwn(logEntry, 'ipAddress'), true); } catch (err) { console.error(err); throw err; @@ -140,7 +140,7 @@ test.serial(`${currentTest} should return sign-in audit logs with failed login a t.is(getAuditLogsResult.status, 200); const auditLogsRO = JSON.parse(getAuditLogsResult.text); - t.is(auditLogsRO.hasOwnProperty('logs'), true); + t.is(Object.hasOwn(auditLogsRO, 'logs'), true); t.true(auditLogsRO.logs.length >= 1); // Find the failed login entry @@ -189,7 +189,7 @@ test.serial(`${currentTest} should filter sign-in audit logs by status`, async ( t.is(getFailedLogsResult.status, 200); const failedLogsRO = JSON.parse(getFailedLogsResult.text); - t.is(failedLogsRO.hasOwnProperty('logs'), true); + t.is(Object.hasOwn(failedLogsRO, 'logs'), true); // All returned logs should have failed status failedLogsRO.logs.forEach((log: any) => { t.is(log.status, SignInStatusEnum.FAILED); @@ -205,7 +205,7 @@ test.serial(`${currentTest} should filter sign-in audit logs by status`, async ( t.is(getSuccessLogsResult.status, 200); const successLogsRO = JSON.parse(getSuccessLogsResult.text); - t.is(successLogsRO.hasOwnProperty('logs'), true); + t.is(Object.hasOwn(successLogsRO, 'logs'), true); // All returned logs should have success status successLogsRO.logs.forEach((log: any) => { t.is(log.status, SignInStatusEnum.SUCCESS); @@ -241,7 +241,7 @@ test.serial(`${currentTest} should filter sign-in audit logs by email`, async (t t.is(getAuditLogsResult.status, 200); const auditLogsRO = JSON.parse(getAuditLogsResult.text); - t.is(auditLogsRO.hasOwnProperty('logs'), true); + t.is(Object.hasOwn(auditLogsRO, 'logs'), true); // All returned logs should have the searched email auditLogsRO.logs.forEach((log: any) => { t.is(log.email, email.toLowerCase()); @@ -277,7 +277,7 @@ test.serial(`${currentTest} should filter sign-in audit logs by sign-in method`, t.is(getAuditLogsResult.status, 200); const auditLogsRO = JSON.parse(getAuditLogsResult.text); - t.is(auditLogsRO.hasOwnProperty('logs'), true); + t.is(Object.hasOwn(auditLogsRO, 'logs'), true); // All returned logs should have email sign-in method auditLogsRO.logs.forEach((log: any) => { t.is(log.signInMethod, SignInMethodEnum.EMAIL); @@ -315,13 +315,13 @@ test.serial(`${currentTest} should support pagination for sign-in audit logs`, a t.is(getAuditLogsResult.status, 200); const auditLogsRO = JSON.parse(getAuditLogsResult.text); - t.is(auditLogsRO.hasOwnProperty('logs'), true); - t.is(auditLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(auditLogsRO, 'logs'), true); + t.is(Object.hasOwn(auditLogsRO, 'pagination'), true); t.true(auditLogsRO.logs.length <= 2); - t.is(auditLogsRO.pagination.hasOwnProperty('total'), true); - t.is(auditLogsRO.pagination.hasOwnProperty('lastPage'), true); - t.is(auditLogsRO.pagination.hasOwnProperty('perPage'), true); - t.is(auditLogsRO.pagination.hasOwnProperty('currentPage'), true); + t.is(Object.hasOwn(auditLogsRO.pagination, 'total'), true); + t.is(Object.hasOwn(auditLogsRO.pagination, 'lastPage'), true); + t.is(Object.hasOwn(auditLogsRO.pagination, 'perPage'), true); + t.is(Object.hasOwn(auditLogsRO.pagination, 'currentPage'), true); } catch (err) { console.error(err); throw err; @@ -410,7 +410,7 @@ test.serial(`${currentTest} should filter sign-in audit logs by date range`, asy t.is(getAuditLogsResult.status, 200); const auditLogsRO = JSON.parse(getAuditLogsResult.text); - t.is(auditLogsRO.hasOwnProperty('logs'), true); + t.is(Object.hasOwn(auditLogsRO, 'logs'), true); t.true(auditLogsRO.logs.length >= 1); } catch (err) { console.error(err); diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-user-table-different-group-connection-readonly-permissions-e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-user-table-different-group-connection-readonly-permissions-e2e.test.ts index 868f6a7e..eef5d2cb 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-user-table-different-group-connection-readonly-permissions-e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-user-table-different-group-connection-readonly-permissions-e2e.test.ts @@ -25,7 +25,7 @@ import { ValidationError } from 'class-validator'; import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; let currentTest: string; const mockFactory = new MockFactory(); @@ -47,7 +47,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -102,22 +102,22 @@ test.serial(`${currentTest} should return connections, where second user have ac const result = findAll.body.connections; const nonTestConnection = result.find(({ connection }) => connection.id === connections.firstId); t.is(result.length, 1); - t.is(nonTestConnection.hasOwnProperty('connection'), true); - t.is(nonTestConnection.hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(nonTestConnection, 'connection'), true); + t.is(Object.hasOwn(nonTestConnection, 'accessLevel'), true); t.is(nonTestConnection.accessLevel, AccessLevelEnum.readonly); - t.is(nonTestConnection.connection.hasOwnProperty('host'), true); - t.is(result[0].connection.hasOwnProperty('host'), true); + t.is(Object.hasOwn(nonTestConnection.connection, 'host'), true); + t.is(Object.hasOwn(result[0].connection, 'host'), true); t.is(typeof result[0].connection.port, 'number'); - t.is(result[0].connection.hasOwnProperty('port'), true); - t.is(result[0].connection.hasOwnProperty('username'), true); - t.is(result[0].connection.hasOwnProperty('database'), true); - t.is(result[0].connection.hasOwnProperty('sid'), true); - t.is(result[0].connection.hasOwnProperty('createdAt'), true); - t.is(result[0].connection.hasOwnProperty('updatedAt'), true); - t.is(result[0].connection.hasOwnProperty('password'), false); - t.is(result[0].connection.hasOwnProperty('groups'), false); - t.is(result[0].connection.hasOwnProperty('author'), false); + t.is(Object.hasOwn(result[0].connection, 'port'), true); + t.is(Object.hasOwn(result[0].connection, 'username'), true); + t.is(Object.hasOwn(result[0].connection, 'database'), true); + t.is(Object.hasOwn(result[0].connection, 'sid'), true); + t.is(Object.hasOwn(result[0].connection, 'createdAt'), true); + t.is(Object.hasOwn(result[0].connection, 'updatedAt'), true); + t.is(Object.hasOwn(result[0].connection, 'password'), false); + t.is(Object.hasOwn(result[0].connection, 'groups'), false); + t.is(Object.hasOwn(result[0].connection, 'author'), false); } catch (e) { console.error(e); throw e; @@ -157,11 +157,11 @@ test.serial(`${currentTest} should return a found connection`, async (t) => { t.is(result.username, 'postgres'); t.is(result.database, newConnectionToPostgres.database); t.is(result.sid, null); - t.is(result.hasOwnProperty('createdAt'), true); - t.is(result.hasOwnProperty('updatedAt'), true); - t.is(result.hasOwnProperty('password'), false); - t.is(result.hasOwnProperty('groups'), false); - t.is(result.hasOwnProperty('author'), false); + t.is(Object.hasOwn(result, 'createdAt'), true); + t.is(Object.hasOwn(result, 'updatedAt'), true); + t.is(Object.hasOwn(result, 'password'), false); + t.is(Object.hasOwn(result, 'groups'), false); + t.is(Object.hasOwn(result, 'author'), false); } catch (e) { console.error(e); throw e; @@ -194,7 +194,7 @@ test.serial( // todo add checking connection object properties t.is(findOneResponce.status, 200); const findOneRO = JSON.parse(findOneResponce.text); - t.is(findOneRO.hasOwnProperty('host'), false); + t.is(Object.hasOwn(findOneRO, 'host'), false); } catch (e) { console.error(e); throw e; @@ -425,7 +425,7 @@ test.serial(`${currentTest} should return connection without deleted group resul let result = createGroupResponse.body; t.is(createGroupResponse.status, 201); - t.is(result.hasOwnProperty('id'), true); + t.is(Object.hasOwn(result, 'id'), true); t.is(result.title, newGroup1.title); const createGroupRO = JSON.parse(createGroupResponse.text); @@ -474,7 +474,7 @@ test.serial( t.is(createGroupResponse.status, 201); - t.is(result.hasOwnProperty('id'), true); + t.is(Object.hasOwn(result, 'id'), true); t.is(result.title, newGroup1.title); const createGroupRO = JSON.parse(createGroupResponse.text); @@ -529,9 +529,9 @@ test.serial(`${currentTest} should groups in connection`, async (t) => { t.is(response.status, 200); const result = JSON.parse(response.text); - const groupId = result[0].group.id; + const _groupId = result[0].group.id; - t.is(result[0].group.hasOwnProperty('title'), true); + t.is(Object.hasOwn(result[0].group, 'title'), true); t.is(result[0].accessLevel, AccessLevelEnum.readonly); const index = result.findIndex((el: any) => { @@ -615,9 +615,9 @@ test.serial(`${currentTest} should return permissions object for current group i const result = JSON.parse(response.text); t.is(response.status, 200); - t.is(result.hasOwnProperty('connection'), true); - t.is(result.hasOwnProperty('group'), true); - t.is(result.hasOwnProperty('tables'), true); + t.is(Object.hasOwn(result, 'connection'), true); + t.is(Object.hasOwn(result, 'group'), true); + t.is(Object.hasOwn(result, 'tables'), true); t.is(typeof result.connection, 'object'); t.is(typeof result.group, 'object'); t.is(result.connection.connectionId, connections.firstId); @@ -630,7 +630,7 @@ test.serial(`${currentTest} should return permissions object for current group i const tableIndex = tables.findIndex((table: any) => table.tableName === firstTableInfo.testTableName); t.is(tables.length > 0, true); t.is(typeof tables[tableIndex], 'object'); - t.is(tables[tableIndex].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(tables[tableIndex], 'accessLevel'), true); t.is(tables[tableIndex].accessLevel.visibility, tablePermissions.visibility); t.is(tables[tableIndex].accessLevel.readonly, tablePermissions.readonly); t.is(tables[tableIndex].accessLevel.add, tablePermissions.add); @@ -674,9 +674,9 @@ test.serial(`${currentTest} should return permissions object for current group i t.is(response.status, 200); const result = JSON.parse(response.text); - t.is(result.hasOwnProperty('connection'), true); - t.is(result.hasOwnProperty('group'), true); - t.is(result.hasOwnProperty('tables'), true); + t.is(Object.hasOwn(result, 'connection'), true); + t.is(Object.hasOwn(result, 'group'), true); + t.is(Object.hasOwn(result, 'tables'), true); t.is(typeof result.connection, 'object'); t.is(typeof result.group, 'object'); t.is(result.connection.connectionId, connections.firstId); @@ -689,7 +689,7 @@ test.serial(`${currentTest} should return permissions object for current group i const foundTableIndex = tables.findIndex((table) => table.tableName === firstTableInfo.testTableName); t.is(tables.length > 0, true); t.is(typeof tables[foundTableIndex], 'object'); - t.is(tables[foundTableIndex].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(tables[foundTableIndex], 'accessLevel'), true); t.is(tables[foundTableIndex].accessLevel.visibility, tablePermissions.visibility); t.is(tables[foundTableIndex].accessLevel.readonly, tablePermissions.readonly); t.is(tables[foundTableIndex].accessLevel.add, tablePermissions.add); @@ -735,9 +735,9 @@ test.serial( t.is(response.status, 200); const result = JSON.parse(response.text); - t.is(result.hasOwnProperty('connection'), true); - t.is(result.hasOwnProperty('group'), true); - t.is(result.hasOwnProperty('tables'), true); + t.is(Object.hasOwn(result, 'connection'), true); + t.is(Object.hasOwn(result, 'group'), true); + t.is(Object.hasOwn(result, 'tables'), true); t.is(typeof result.connection, 'object'); t.is(typeof result.group, 'object'); t.is(result.connection.connectionId, connections.secondId); @@ -774,11 +774,11 @@ test.serial(`${currentTest} should return found groups with current user`, async const { groups, groupsCount } = getGroupsRO; t.is(groupsCount, 1); t.is(groups.length, 1); - t.is(groups[0].hasOwnProperty('group'), true); - t.is(groups[0].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(groups[0], 'group'), true); + t.is(Object.hasOwn(groups[0], 'accessLevel'), true); - t.is(groups[0].group.hasOwnProperty('title'), true); - t.is(groups[0].group.hasOwnProperty('isMain'), true); + t.is(Object.hasOwn(groups[0].group, 'title'), true); + t.is(Object.hasOwn(groups[0].group, 'isMain'), true); } catch (e) { console.error(e); throw e; @@ -815,7 +815,7 @@ test.serial(`${currentTest} it should return users in groups`, async (t) => { .set('Content-Type', 'application/json') .set('Accept', 'application/json'); t.is(response.status, 200); - const getUsersRO = JSON.parse(response.text); + const _getUsersRO = JSON.parse(response.text); t.is(getGroupsRO.length, 2); } catch (e) { console.error(e); @@ -896,7 +896,7 @@ test.serial(`${currentTest} should throw exception ${Messages.DONT_HAVE_PERMISSI .set('Accept', 'application/json'); const addUserInGroupRO = JSON.parse(addUserInGroupResponse.text); t.is(addUserInGroupResponse.status, 403); - t.is(addUserInGroupRO.hasOwnProperty('message'), true); + t.is(Object.hasOwn(addUserInGroupRO, 'message'), true); t.is(addUserInGroupRO.message, Messages.DONT_HAVE_PERMISSIONS); } catch (e) { console.error(e); @@ -925,7 +925,7 @@ test.serial(`${currentTest} should throw exception, when group id not passed in t.is(getGroupsResponse.status, 200); const getGroupsRO = JSON.parse(getGroupsResponse.text); - const groupId = getGroupsRO[0].group.id; + const _groupId = getGroupsRO[0].group.id; const email = faker.internet.email(); const addUserInGroupResponse = await request(app.getHttpServer()) .put('/group/user') @@ -961,7 +961,7 @@ test.serial(`${currentTest} should throw exception, when group id passed in requ .set('Accept', 'application/json'); t.is(getGroupsResponse.status, 200); - const getGroupsRO = JSON.parse(getGroupsResponse.text); + const _getGroupsRO = JSON.parse(getGroupsResponse.text); const email = faker.internet.email(); const groupId = faker.string.uuid(); @@ -1074,7 +1074,7 @@ test.serial(`${currentTest} should throw an exception when group id not passed i t.is(getGroupsResponse.status, 200); const getGroupsRO = JSON.parse(getGroupsResponse.text); - const groupId = getGroupsRO[0].group.id; + const _groupId = getGroupsRO[0].group.id; const deleteGroupResponse = await request(app.getHttpServer()) .delete(`/group/`) .set('Cookie', simpleUserToken) @@ -1186,7 +1186,7 @@ test.serial(`${currentTest} should throw exception, when group id not passed in t.is(getGroupsResponse.status, 200); const getGroupsRO = JSON.parse(getGroupsResponse.text); - const groupId = getGroupsRO[0].group.id; + const _groupId = getGroupsRO[0].group.id; const thirdTestUser = await inviteUserInCompanyAndAcceptInvitation(adminUserToken, undefined, app, undefined); @@ -1769,15 +1769,15 @@ test.serial(`${currentTest} should return added row`, async (t) => { .set('Accept', 'application/json'); const addRowInTableRO = JSON.parse(addRowInTable.text); t.is(addRowInTable.status, 201); - t.is(addRowInTableRO.row.hasOwnProperty('id'), true); + t.is(Object.hasOwn(addRowInTableRO.row, 'id'), true); t.is(addRowInTableRO.row[firstTableInfo.testTableColumnName], randomName); t.is(addRowInTableRO.row[firstTableInfo.testTableSecondColumnName], randomEmail); - t.is(addRowInTableRO.row.hasOwnProperty('created_at'), true); - t.is(addRowInTableRO.row.hasOwnProperty('updated_at'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO.row, 'created_at'), true); + t.is(Object.hasOwn(addRowInTableRO.row, 'updated_at'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); } catch (e) { console.error(e); throw e; @@ -2072,12 +2072,12 @@ test.serial(`${currentTest} should return row`, async (t) => { const getRowInTableRO = JSON.parse(getRowInTable.text); t.is(getRowInTable.status, 200); t.is(getRowInTableRO.row.id, 7); - t.is(getRowInTableRO.row.hasOwnProperty('created_at'), true); - t.is(getRowInTableRO.row.hasOwnProperty('updated_at'), true); - t.is(getRowInTableRO.hasOwnProperty('structure'), true); - t.is(getRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(getRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(getRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(getRowInTableRO.row, 'created_at'), true); + t.is(Object.hasOwn(getRowInTableRO.row, 'updated_at'), true); + t.is(Object.hasOwn(getRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(getRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(getRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getRowInTableRO, 'readonly_fields'), true); } catch (e) { console.error(e); throw e; @@ -2177,15 +2177,15 @@ test.serial(`${currentTest} should return all found logs in connection'`, async const getRowInTableRO = JSON.parse(getTableLogs.text); t.is(getRowInTableRO.logs.length, 1); - t.is(getRowInTableRO.logs[0].hasOwnProperty('table_name'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('received_data'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('old_data'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('cognitoUserName'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('email'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('operationType'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('operationStatusResult'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('createdAt'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('connection_id'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'table_name'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'received_data'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'old_data'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'cognitoUserName'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'email'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'operationType'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'operationStatusResult'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'createdAt'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'connection_id'), true); } catch (e) { console.error(e); throw e; @@ -2338,7 +2338,7 @@ test.serial(`${currentTest} 'should should return created table settings`, async .set('Cookie', simpleUserToken) .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const getTableSettingsRO = JSON.parse(getTableSettings.text); + const _getTableSettingsRO = JSON.parse(getTableSettings.text); t.is(getTableSettings.status, 200); } catch (e) { console.error(e); @@ -2813,7 +2813,7 @@ test.serial(`${currentTest} should return array of table widgets for table`, asy .set('Accept', 'application/json'); t.is(getTableStructureResponse.status, 200); const getTableStructureRO = JSON.parse(getTableStructureResponse.text); - t.is(getTableStructureRO.hasOwnProperty('table_widgets'), true); + t.is(Object.hasOwn(getTableStructureRO, 'table_widgets'), true); t.is(getTableStructureRO.table_widgets.length, 2); t.truthy(getTableStructureRO.table_widgets.some((w) => w.field_name === newTableWidgets[0].field_name)); t.truthy(getTableStructureRO.table_widgets.some((w) => w.widget_type === newTableWidgets[1].widget_type)); diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-user-with-table-only-permissions-e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-user-with-table-only-permissions-e2e.test.ts index 91b79cb3..95a500ba 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-user-with-table-only-permissions-e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-user-with-table-only-permissions-e2e.test.ts @@ -20,17 +20,16 @@ import { TestUtils } from '../../utils/test.utils.js'; import { createConnectionsAndInviteNewUserInNewGroupWithOnlyTablePermissions } from '../../utils/user-with-different-permissions-utils.js'; import { inviteUserInCompanyAndAcceptInvitation } from '../../utils/register-user-and-return-user-info.js'; import { setSaasEnvVariable } from '../../utils/set-saas-env-variable.js'; -import { pauseCode } from '../../../src/helpers/pause-code.js'; import { ValidationException } from '../../../src/exceptions/custom-exceptions/validation-exception.js'; import { ValidationError } from 'class-validator'; import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; let currentTest: string; const mockFactory = new MockFactory(); -const newConnectionToPostgres = mockFactory.generateConnectionToTestPostgresDBInDocker(); +const _newConnectionToPostgres = mockFactory.generateConnectionToTestPostgresDBInDocker(); const updateConnection = mockFactory.generateUpdateConnectionDto(); const newGroup1 = mockFactory.generateCreateGroupDto1(); const tablePermissions = { @@ -48,7 +47,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -96,7 +95,7 @@ test.serial(`${currentTest} should return connections, where second user have ac .set('Accept', 'application/json'); t.is(findAll.status, 200); - const resultRO = JSON.parse(findAll.text); + const _resultRO = JSON.parse(findAll.text); const result = findAll.body.connections; t.is(result.length, 1); const nonTestConnection = result.find(({ connection }) => connection.id === connections.firstId); @@ -166,7 +165,7 @@ test.serial( // todo add checking connection object properties t.is(findOneResponce.status, 200); const findOneRO = JSON.parse(findOneResponce.text); - t.is(findOneRO.hasOwnProperty('host'), false); + t.is(Object.hasOwn(findOneRO, 'host'), false); } catch (e) { console.error(e); throw e; @@ -390,7 +389,7 @@ test.serial(`${currentTest} should return connection without deleted group resul let result = createGroupResponse.body; t.is(createGroupResponse.status, 201); - t.is(result.hasOwnProperty('id'), true); + t.is(Object.hasOwn(result, 'id'), true); t.is(result.title, newGroup1.title); const createGroupRO = JSON.parse(createGroupResponse.text); @@ -438,7 +437,7 @@ test.serial( t.is(createGroupResponse.status, 201); - t.is(result.hasOwnProperty('id'), true); + t.is(Object.hasOwn(result, 'id'), true); t.is(result.title, newGroup1.title); const createGroupRO = JSON.parse(createGroupResponse.text); @@ -492,9 +491,9 @@ test.serial(`${currentTest} should groups in connection`, async (t) => { t.is(response.status, 200); const result = JSON.parse(response.text); - const groupId = result[0].group.id; + const _groupId = result[0].group.id; - t.is(result[0].group.hasOwnProperty('title'), true); + t.is(Object.hasOwn(result[0].group, 'title'), true); t.is(result[0].accessLevel, AccessLevelEnum.none); const index = result.findIndex((el: any) => { @@ -576,9 +575,9 @@ test.serial(`${currentTest} should return permissions object for current group i const result = JSON.parse(response.text); t.is(response.status, 200); - t.is(result.hasOwnProperty('connection'), true); - t.is(result.hasOwnProperty('group'), true); - t.is(result.hasOwnProperty('tables'), true); + t.is(Object.hasOwn(result, 'connection'), true); + t.is(Object.hasOwn(result, 'group'), true); + t.is(Object.hasOwn(result, 'tables'), true); t.is(typeof result.connection, 'object'); t.is(typeof result.group, 'object'); t.is(result.connection.connectionId, connections.firstId); @@ -591,7 +590,7 @@ test.serial(`${currentTest} should return permissions object for current group i const tableIndex = tables.findIndex((table: any) => table.tableName === firstTableInfo.testTableName); t.is(tables.length > 0, true); t.is(typeof tables[tableIndex], 'object'); - t.is(tables[tableIndex].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(tables[tableIndex], 'accessLevel'), true); t.is(tables[tableIndex].accessLevel.visibility, tablePermissions.visibility); t.is(tables[tableIndex].accessLevel.readonly, tablePermissions.readonly); t.is(tables[tableIndex].accessLevel.add, tablePermissions.add); @@ -634,9 +633,9 @@ test.serial(`${currentTest} should return permissions object for current group i t.is(response.status, 200); const result = JSON.parse(response.text); - t.is(result.hasOwnProperty('connection'), true); - t.is(result.hasOwnProperty('group'), true); - t.is(result.hasOwnProperty('tables'), true); + t.is(Object.hasOwn(result, 'connection'), true); + t.is(Object.hasOwn(result, 'group'), true); + t.is(Object.hasOwn(result, 'tables'), true); t.is(typeof result.connection, 'object'); t.is(typeof result.group, 'object'); t.is(result.connection.connectionId, connections.firstId); @@ -649,7 +648,7 @@ test.serial(`${currentTest} should return permissions object for current group i const foundTableIndex = tables.findIndex((table) => table.tableName === firstTableInfo.testTableName); t.is(tables.length > 0, true); t.is(typeof tables[foundTableIndex], 'object'); - t.is(tables[foundTableIndex].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(tables[foundTableIndex], 'accessLevel'), true); t.is(tables[foundTableIndex].accessLevel.visibility, tablePermissions.visibility); t.is(tables[foundTableIndex].accessLevel.readonly, tablePermissions.readonly); t.is(tables[foundTableIndex].accessLevel.add, tablePermissions.add); @@ -694,9 +693,9 @@ test.serial( t.is(response.status, 200); const result = JSON.parse(response.text); - t.is(result.hasOwnProperty('connection'), true); - t.is(result.hasOwnProperty('group'), true); - t.is(result.hasOwnProperty('tables'), true); + t.is(Object.hasOwn(result, 'connection'), true); + t.is(Object.hasOwn(result, 'group'), true); + t.is(Object.hasOwn(result, 'tables'), true); t.is(typeof result.connection, 'object'); t.is(typeof result.group, 'object'); t.is(result.connection.connectionId, connections.secondId); @@ -732,11 +731,11 @@ test.serial(`${currentTest} should return found groups with current user`, async const { groups, groupsCount } = getGroupsRO; t.is(groupsCount, 1); t.is(groups.length, 1); - t.is(groups[0].hasOwnProperty('group'), true); - t.is(groups[0].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(groups[0], 'group'), true); + t.is(Object.hasOwn(groups[0], 'accessLevel'), true); - t.is(groups[0].group.hasOwnProperty('title'), true); - t.is(groups[0].group.hasOwnProperty('isMain'), true); + t.is(Object.hasOwn(groups[0].group, 'title'), true); + t.is(Object.hasOwn(groups[0].group, 'isMain'), true); } catch (e) { console.error(e); throw e; @@ -773,7 +772,7 @@ test.serial(`${currentTest} it should throw exception ${Messages.DONT_HAVE_PERMI .set('Accept', 'application/json'); t.is(response.status, 403); const getUsersRO = JSON.parse(response.text); - t.is(getUsersRO.hasOwnProperty('message'), true); + t.is(Object.hasOwn(getUsersRO, 'message'), true); t.is(getUsersRO.message, Messages.DONT_HAVE_PERMISSIONS); } catch (e) { console.error(e); @@ -852,7 +851,7 @@ test.serial(`${currentTest} should throw exception ${Messages.DONT_HAVE_PERMISSI .set('Accept', 'application/json'); const addUserInGroupRO = JSON.parse(addUserInGroupResponse.text); t.is(addUserInGroupResponse.status, 403); - t.is(addUserInGroupRO.hasOwnProperty('message'), true); + t.is(Object.hasOwn(addUserInGroupRO, 'message'), true); t.is(addUserInGroupRO.message, Messages.DONT_HAVE_PERMISSIONS); } catch (e) { console.error(e); @@ -880,7 +879,7 @@ test.serial(`${currentTest} should throw exception, when group id not passed in t.is(getGroupsResponse.status, 200); const getGroupsRO = JSON.parse(getGroupsResponse.text); - const groupId = getGroupsRO[0].group.id; + const _groupId = getGroupsRO[0].group.id; const email = faker.internet.email(); const addUserInGroupResponse = await request(app.getHttpServer()) .put('/group/user') @@ -915,7 +914,7 @@ test.serial(`${currentTest} should throw exception, when group id passed in requ .set('Accept', 'application/json'); t.is(getGroupsResponse.status, 200); - const getGroupsRO = JSON.parse(getGroupsResponse.text); + const _getGroupsRO = JSON.parse(getGroupsResponse.text); const email = faker.internet.email(); const groupId = faker.string.uuid(); @@ -1025,7 +1024,7 @@ test.serial(`${currentTest} should throw an exception when group id not passed i t.is(getGroupsResponse.status, 200); const getGroupsRO = JSON.parse(getGroupsResponse.text); - const groupId = getGroupsRO[0].group.id; + const _groupId = getGroupsRO[0].group.id; const deleteGroupResponse = await request(app.getHttpServer()) .delete(`/group/`) .set('Cookie', simpleUserToken) @@ -1132,7 +1131,7 @@ test.serial(`${currentTest} should throw exception, when group id not passed in .set('Accept', 'application/json'); t.is(getGroupsResponse.status, 200); - const getGroupsRO = JSON.parse(getGroupsResponse.text); + const _getGroupsRO = JSON.parse(getGroupsResponse.text); const thirdTestUser = await inviteUserInCompanyAndAcceptInvitation(adminUserToken, undefined, app, undefined); @@ -1699,15 +1698,15 @@ test.serial(`${currentTest} should return added row`, async (t) => { .set('Accept', 'application/json'); const addRowInTableRO = JSON.parse(addRowInTable.text); t.is(addRowInTable.status, 201); - t.is(addRowInTableRO.row.hasOwnProperty('id'), true); + t.is(Object.hasOwn(addRowInTableRO.row, 'id'), true); t.is(addRowInTableRO.row[firstTableInfo.testTableColumnName], randomName); t.is(addRowInTableRO.row[firstTableInfo.testTableSecondColumnName], randomEmail); - t.is(addRowInTableRO.row.hasOwnProperty('created_at'), true); - t.is(addRowInTableRO.row.hasOwnProperty('updated_at'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO.row, 'created_at'), true); + t.is(Object.hasOwn(addRowInTableRO.row, 'updated_at'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); } catch (e) { console.error(e); throw e; @@ -1993,12 +1992,12 @@ test.serial(`${currentTest} should return row`, async (t) => { const getRowInTableRO = JSON.parse(getRowInTable.text); t.is(getRowInTable.status, 200); t.is(getRowInTableRO.row.id, 7); - t.is(getRowInTableRO.row.hasOwnProperty('created_at'), true); - t.is(getRowInTableRO.row.hasOwnProperty('updated_at'), true); - t.is(getRowInTableRO.hasOwnProperty('structure'), true); - t.is(getRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(getRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(getRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(getRowInTableRO.row, 'created_at'), true); + t.is(Object.hasOwn(getRowInTableRO.row, 'updated_at'), true); + t.is(Object.hasOwn(getRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(getRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(getRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getRowInTableRO, 'readonly_fields'), true); } catch (e) { console.error(e); throw e; @@ -2095,15 +2094,15 @@ test.serial(`${currentTest} should return all found logs in connection'`, async const getRowInTableRO = JSON.parse(getTableLogs.text); t.is(getRowInTableRO.logs.length, 1); - t.is(getRowInTableRO.logs[0].hasOwnProperty('table_name'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('received_data'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('old_data'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('cognitoUserName'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('email'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('operationType'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('operationStatusResult'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('createdAt'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('connection_id'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'table_name'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'received_data'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'old_data'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'cognitoUserName'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'email'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'operationType'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'operationStatusResult'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'createdAt'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'connection_id'), true); } catch (e) { console.error(e); throw e; @@ -2153,7 +2152,7 @@ test.serial( .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const connectionPropertiesResult = JSON.parse(createConnectionPropertiesResponse.text); + const _connectionPropertiesResult = JSON.parse(createConnectionPropertiesResponse.text); t.is(createConnectionPropertiesResponse.status, 201); @@ -2725,7 +2724,7 @@ test.serial(`${currentTest} should return array of table widgets for table`, asy .set('Accept', 'application/json'); t.is(getTableStructureResponse.status, 200); const getTableStructureRO = JSON.parse(getTableStructureResponse.text); - t.is(getTableStructureRO.hasOwnProperty('table_widgets'), true); + t.is(Object.hasOwn(getTableStructureRO, 'table_widgets'), true); t.is(getTableStructureRO.table_widgets.length, 2); getTableStructureRO.table_widgets.sort((a, b) => a.field_name.localeCompare(b.field_name)) newTableWidgets.sort((a, b) => a.field_name.localeCompare(b.field_name)) diff --git a/backend/test/ava-tests/saas-tests/action-rules-e2e.test.ts b/backend/test/ava-tests/saas-tests/action-rules-e2e.test.ts index 852f49a6..5c69e800 100644 --- a/backend/test/ava-tests/saas-tests/action-rules-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/action-rules-e2e.test.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ -import { fa, faker } from '@faker-js/faker'; +import { faker } from '@faker-js/faker'; import { INestApplication, ValidationPipe } from '@nestjs/common'; import { Test } from '@nestjs/testing'; import test from 'ava'; @@ -79,7 +79,7 @@ async function resetPostgresTestDB() { }); await Knex.schema.dropTableIfExists('transactions'); await Knex.schema.dropTableIfExists(testTableName); - await Knex.schema.createTableIfNotExists(testTableName, function (table) { + await Knex.schema.createTableIfNotExists(testTableName, (table) => { table.increments(); table.string(testTableColumnName); table.string(testTAbleSecondColumnName); @@ -106,7 +106,7 @@ async function resetPostgresTestDB() { await Knex.destroy(); } -async function deleteTable(tableName: string): Promise { +async function _deleteTable(tableName: string): Promise { const { host, username, password, database, port, type, ssl, cert } = newConnection; const Knex = knex({ client: type, @@ -138,7 +138,7 @@ async function resetPostgresTestDbTableCompositePrimaryKeys( }, }); await Knex.schema.dropTableIfExists(secondTestTableName); - await Knex.schema.createTableIfNotExists(secondTestTableName, function (table) { + await Knex.schema.createTableIfNotExists(secondTestTableName, (table) => { table.increments('id'); table.string(testTableColumnName); table.string(testTAbleSecondColumnName); @@ -842,7 +842,7 @@ test.serial(`${currentTest} should return created table rule with action and eve const createTableRuleRO: FoundActionRulesWithActionsAndEventsDTO = JSON.parse(createTableRuleResult.text); const customEventId = createTableRuleRO.events.find((event) => event.event === TableActionEventEnum.CUSTOM).id; - const addRowEventId = createTableRuleRO.events.find((event) => event.event === TableActionEventEnum.ADD_ROW).id; + const _addRowEventId = createTableRuleRO.events.find((event) => event.event === TableActionEventEnum.ADD_ROW).id; const urlActionId = createTableRuleRO.table_actions.find((action) => action.method === TableActionMethodEnum.URL).id; const createTableRuleROId = createTableRuleRO.id; @@ -1056,7 +1056,7 @@ test.serial(`${currentTest} should return created table rule with action and eve const scope = nock(fakeUrl) .post('/') .times(2) - .reply(201, (uri, requestBody) => { + .reply(201, (_uri, requestBody) => { nockBodiesArray.push(requestBody); return { status: 201, @@ -1072,25 +1072,25 @@ test.serial(`${currentTest} should return created table rule with action and eve .set('Accept', 'application/json'); const activateTableRuleRO: ActivatedTableActionsDTO = JSON.parse(activateTableRuleResult.text); t.is(activateTableRuleResult.status, 201); - t.is(activateTableRuleRO.hasOwnProperty('activationResults'), true); + t.is(Object.hasOwn(activateTableRuleRO, 'activationResults'), true); t.is(activateTableRuleRO.activationResults.length, 2); t.is(nockBodiesArray.length, 2); - const urlActionRequestBody = nockBodiesArray.find((body) => body.hasOwnProperty(`$$_raUserId`)); + const urlActionRequestBody = nockBodiesArray.find((body) => Object.hasOwn(body, `$$_raUserId`)); t.truthy(urlActionRequestBody); - t.truthy(urlActionRequestBody['$$_raUserId']); - t.truthy(urlActionRequestBody['$$_date']); - t.truthy(urlActionRequestBody['$$_tableName']); - t.truthy(urlActionRequestBody['$$_actionId']); - t.is(urlActionRequestBody['$$_tableName'], testTableName); - t.is(urlActionRequestBody['primaryKeys'][0].id, 2); + t.truthy(urlActionRequestBody.$$_raUserId); + t.truthy(urlActionRequestBody.$$_date); + t.truthy(urlActionRequestBody.$$_tableName); + t.truthy(urlActionRequestBody.$$_actionId); + t.is(urlActionRequestBody.$$_tableName, testTableName); + t.is(urlActionRequestBody.primaryKeys[0].id, 2); - const slackActionRequestBody = nockBodiesArray.find((body) => body.hasOwnProperty(`text`)); + const slackActionRequestBody = nockBodiesArray.find((body) => Object.hasOwn(body, `text`)); t.truthy(slackActionRequestBody); - t.truthy(slackActionRequestBody['text']); - t.truthy(slackActionRequestBody['text'].includes(testTableName)); - t.truthy(slackActionRequestBody['text'].includes(`[{"id":2,"second_id":"test_key"}]`)); + t.truthy(slackActionRequestBody.text); + t.truthy(slackActionRequestBody.text.includes(testTableName)); + t.truthy(slackActionRequestBody.text.includes(`[{"id":2,"second_id":"test_key"}]`)); scope.done(); await resetPostgresTestDB(); }); @@ -1172,7 +1172,7 @@ test.serial(`${currentTest} should create impersonate action`, async (t) => { const actionActivationRO = JSON.parse(activateTableActionResult.text); t.is(activateTableActionResult.status, 201); - t.is(actionActivationRO.hasOwnProperty('location'), true); + t.is(Object.hasOwn(actionActivationRO, 'location'), true); const redirectionLink = actionActivationRO.location; const getLinkResult = await fetch(redirectionLink, { @@ -1260,7 +1260,7 @@ test.serial(`${currentTest} should create trigger and activate http table action const scope = nock(fakeUrl) .post('/') .times(6) - .reply(201, (uri, requestBody) => { + .reply(201, (_uri, requestBody) => { nockBodiesArray.push(requestBody); return { status: 201, @@ -1308,28 +1308,28 @@ test.serial(`${currentTest} should create trigger and activate http table action t.is(nockBodiesArray.length, 6); const userDeletedRowSlackMessageRequestBody = nockBodiesArray.find( - (body) => body.hasOwnProperty(`text`) && body['text'].includes('deleted'), + (body) => Object.hasOwn(body, `text`) && body.text.includes('deleted'), ); t.truthy(userDeletedRowSlackMessageRequestBody); - t.truthy(userDeletedRowSlackMessageRequestBody['text']); - t.truthy(userDeletedRowSlackMessageRequestBody['text'].includes(testTableName)); - t.truthy(userDeletedRowSlackMessageRequestBody['text'].includes(`[{"id":"${idForDeletion}"}]`)); + t.truthy(userDeletedRowSlackMessageRequestBody.text); + t.truthy(userDeletedRowSlackMessageRequestBody.text.includes(testTableName)); + t.truthy(userDeletedRowSlackMessageRequestBody.text.includes(`[{"id":"${idForDeletion}"}]`)); const userAddedRowSlackMessageRequestBody = nockBodiesArray.find( - (body) => body.hasOwnProperty(`text`) && body['text'].includes('added'), + (body) => Object.hasOwn(body, `text`) && body.text.includes('added'), ); t.truthy(userAddedRowSlackMessageRequestBody); - t.truthy(userAddedRowSlackMessageRequestBody['text']); - t.truthy(userAddedRowSlackMessageRequestBody['text'].includes(testTableName)); - t.truthy(userAddedRowSlackMessageRequestBody['text'].includes(`[{"id":${testEntitiesSeedsCount + 1}}]`)); + t.truthy(userAddedRowSlackMessageRequestBody.text); + t.truthy(userAddedRowSlackMessageRequestBody.text.includes(testTableName)); + t.truthy(userAddedRowSlackMessageRequestBody.text.includes(`[{"id":${testEntitiesSeedsCount + 1}}]`)); const userUpdatedRowSlackMessageRequestBody = nockBodiesArray.find( - (body) => body.hasOwnProperty(`text`) && body['text'].includes('updated'), + (body) => Object.hasOwn(body, `text`) && body.text.includes('updated'), ); t.truthy(userUpdatedRowSlackMessageRequestBody); - t.truthy(userUpdatedRowSlackMessageRequestBody['text']); - t.truthy(userUpdatedRowSlackMessageRequestBody['text'].includes(testTableName)); - t.truthy(userUpdatedRowSlackMessageRequestBody['text'].includes(`[{"id":"1"}]`)); + t.truthy(userUpdatedRowSlackMessageRequestBody.text); + t.truthy(userUpdatedRowSlackMessageRequestBody.text.includes(testTableName)); + t.truthy(userUpdatedRowSlackMessageRequestBody.text.includes(`[{"id":"1"}]`)); scope.done(); }); diff --git a/backend/test/ava-tests/saas-tests/api-key-e2e.test.ts b/backend/test/ava-tests/saas-tests/api-key-e2e.test.ts index 8cda8730..eaeac49e 100644 --- a/backend/test/ava-tests/saas-tests/api-key-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/api-key-e2e.test.ts @@ -102,8 +102,8 @@ test.serial(`${currentTest} should return created api key for this user`, async const testTableIndex = getTablesRO.findIndex((t) => t.table === testTableName); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); diff --git a/backend/test/ava-tests/saas-tests/company-info-e2e.test.ts b/backend/test/ava-tests/saas-tests/company-info-e2e.test.ts index f9cc02d4..13954e5c 100644 --- a/backend/test/ava-tests/saas-tests/company-info-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/company-info-e2e.test.ts @@ -31,9 +31,9 @@ import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); -const mockFactory = new MockFactory(); +const _mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; let currentTest: string; test.before(async () => { @@ -42,7 +42,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication() as any; - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -89,10 +89,10 @@ test.serial(`${currentTest} should return found company info for user`, async (t t.is(foundCompanyInfo.status, 200); const foundCompanyInfoRO = JSON.parse(foundCompanyInfo.text); t.is(Object.keys(foundCompanyInfoRO).length, 10); - t.is(foundCompanyInfoRO.hasOwnProperty('id'), true); - t.is(foundCompanyInfoRO.hasOwnProperty('name'), true); - t.is(foundCompanyInfoRO.hasOwnProperty('createdAt'), true); - t.is(foundCompanyInfoRO.hasOwnProperty('updatedAt'), true); + t.is(Object.hasOwn(foundCompanyInfoRO, 'id'), true); + t.is(Object.hasOwn(foundCompanyInfoRO, 'name'), true); + t.is(Object.hasOwn(foundCompanyInfoRO, 'createdAt'), true); + t.is(Object.hasOwn(foundCompanyInfoRO, 'updatedAt'), true); } catch (error) { console.error(error); } @@ -121,35 +121,35 @@ test.serial(`${currentTest} should return full found company info for company ad const foundCompanyInfoRO = JSON.parse(foundCompanyInfo.text); t.is(foundCompanyInfo.status, 200); - t.is(foundCompanyInfoRO.hasOwnProperty('id'), true); - t.is(foundCompanyInfoRO.hasOwnProperty('name'), true); - t.is(foundCompanyInfoRO.hasOwnProperty('createdAt'), true); - t.is(foundCompanyInfoRO.hasOwnProperty('updatedAt'), true); + t.is(Object.hasOwn(foundCompanyInfoRO, 'id'), true); + t.is(Object.hasOwn(foundCompanyInfoRO, 'name'), true); + t.is(Object.hasOwn(foundCompanyInfoRO, 'createdAt'), true); + t.is(Object.hasOwn(foundCompanyInfoRO, 'updatedAt'), true); t.is(Object.keys(foundCompanyInfoRO).length, 15); - t.is(foundCompanyInfoRO.hasOwnProperty('connections'), true); + t.is(Object.hasOwn(foundCompanyInfoRO, 'connections'), true); t.is(foundCompanyInfoRO.connections.length > 3, true); - t.is(foundCompanyInfoRO.hasOwnProperty('invitations'), true); + t.is(Object.hasOwn(foundCompanyInfoRO, 'invitations'), true); t.is(foundCompanyInfoRO.invitations.length, 0); t.is(Object.keys(foundCompanyInfoRO.connections[0]).length, 7); - t.is(foundCompanyInfoRO.connections[0].hasOwnProperty('id'), true); - t.is(foundCompanyInfoRO.connections[0].hasOwnProperty('title'), true); - t.is(foundCompanyInfoRO.connections[0].hasOwnProperty('createdAt'), true); - t.is(foundCompanyInfoRO.connections[0].hasOwnProperty('updatedAt'), true); - t.is(foundCompanyInfoRO.connections[0].hasOwnProperty('author'), true); - t.is(foundCompanyInfoRO.connections[0].hasOwnProperty('groups'), true); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0], 'id'), true); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0], 'title'), true); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0], 'createdAt'), true); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0], 'updatedAt'), true); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0], 'author'), true); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0], 'groups'), true); t.is(foundCompanyInfoRO.connections[0].groups.length > 0, true); t.is(Object.keys(foundCompanyInfoRO.connections[0].groups[0]).length, 4); - t.is(foundCompanyInfoRO.connections[0].groups[0].hasOwnProperty('id'), true); - t.is(foundCompanyInfoRO.connections[0].groups[0].hasOwnProperty('title'), true); - t.is(foundCompanyInfoRO.connections[0].groups[0].hasOwnProperty('isMain'), true); - t.is(foundCompanyInfoRO.connections[0].groups[0].hasOwnProperty('users'), true); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0], 'id'), true); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0], 'title'), true); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0], 'isMain'), true); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0], 'users'), true); t.is(foundCompanyInfoRO.connections[0].groups[0].users.length > 0, true); t.is(Object.keys(foundCompanyInfoRO.connections[0].groups[0].users[0]).length, 9); - t.is(foundCompanyInfoRO.connections[0].groups[0].users[0].hasOwnProperty('id'), true); - t.is(foundCompanyInfoRO.connections[0].groups[0].users[0].hasOwnProperty('email'), true); - t.is(foundCompanyInfoRO.connections[0].groups[0].users[0].hasOwnProperty('role'), true); - t.is(foundCompanyInfoRO.connections[0].groups[0].users[0].hasOwnProperty('createdAt'), true); - t.is(foundCompanyInfoRO.connections[0].groups[0].users[0].hasOwnProperty('password'), false); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0].users[0], 'id'), true); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0].users[0], 'email'), true); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0].users[0], 'role'), true); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0].users[0], 'createdAt'), true); + t.is(Object.hasOwn(foundCompanyInfoRO.connections[0].groups[0].users[0], 'password'), false); } catch (error) { console.error(error); throw error; @@ -178,10 +178,10 @@ test.serial(`${currentTest} should return found company info for non-admin user` t.is(foundCompanyInfo.status, 200); t.is(Object.keys(foundCompanyInfoRO).length, 10); - t.is(foundCompanyInfoRO.hasOwnProperty('id'), true); - t.is(foundCompanyInfoRO.hasOwnProperty('name'), true); - t.is(foundCompanyInfoRO.hasOwnProperty('createdAt'), true); - t.is(foundCompanyInfoRO.hasOwnProperty('updatedAt'), true); + t.is(Object.hasOwn(foundCompanyInfoRO, 'id'), true); + t.is(Object.hasOwn(foundCompanyInfoRO, 'name'), true); + t.is(Object.hasOwn(foundCompanyInfoRO, 'createdAt'), true); + t.is(Object.hasOwn(foundCompanyInfoRO, 'updatedAt'), true); } catch (error) { console.error(error); throw error; @@ -212,9 +212,9 @@ test.serial(`${currentTest} should return found company infos for admin user`, a t.is(foundCompanyInfo.status, 200); t.is(Array.isArray(foundCompanyInfoRO), true); t.is(foundCompanyInfoRO.length, 1); - t.is(foundCompanyInfoRO[0].hasOwnProperty('id'), true); + t.is(Object.hasOwn(foundCompanyInfoRO[0], 'id'), true); t.is(Object.keys(foundCompanyInfoRO[0]).length, 2); - t.is(foundCompanyInfoRO[0].hasOwnProperty('name'), true); + t.is(Object.hasOwn(foundCompanyInfoRO[0], 'name'), true); } catch (error) { console.error(error); throw error; @@ -244,7 +244,7 @@ test.serial(`${currentTest} should return found company infos for non-admin user t.is(Array.isArray(foundCompanyInfoRO), true); t.is(foundCompanyInfoRO.length, 1); t.is(Object.keys(foundCompanyInfoRO[0]).length, 2); - t.is(foundCompanyInfoRO[0].hasOwnProperty('name'), true); + t.is(Object.hasOwn(foundCompanyInfoRO[0], 'name'), true); } catch (error) { console.error(error); throw error; @@ -275,8 +275,8 @@ test.serial(`${currentTest} should remove user from company`, async (t) => { t.is(foundCompanyInfo.status, 200); - const allGroupsInResult = foundCompanyInfoRO.connections.map((connection) => connection.groups).flat(); - const allUsersInResult = allGroupsInResult.map((group) => group.users).flat(); + const allGroupsInResult = foundCompanyInfoRO.connections.flatMap((connection) => connection.groups); + const allUsersInResult = allGroupsInResult.flatMap((group) => group.users); const foundSimpleUserInResult = allUsersInResult.find((user) => user.email === simpleUserEmail.toLowerCase()); t.is(foundSimpleUserInResult.email, simpleUserEmail.toLowerCase()); @@ -301,9 +301,8 @@ test.serial(`${currentTest} should remove user from company`, async (t) => { const foundCompanyInfoROAfterUserDeletion = JSON.parse(foundCompanyInfoAfterUserDeletion.text); const allGroupsInResultAfterUserDeletion = foundCompanyInfoROAfterUserDeletion.connections - .map((connection) => connection.groups) - .flat(); - const allUsersInResultAfterUserDeletion = allGroupsInResultAfterUserDeletion.map((group) => group.users).flat(); + .flatMap((connection) => connection.groups); + const allUsersInResultAfterUserDeletion = allGroupsInResultAfterUserDeletion.flatMap((group) => group.users); const foundSimpleUserInResultAfterUserDeletion = !!allUsersInResultAfterUserDeletion.find( (user) => user.email === simpleUserEmail, ); @@ -340,8 +339,8 @@ test.serial( t.is(foundCompanyInfo.status, 200); - const allGroupsInResult = foundCompanyInfoRO.connections.map((connection) => connection.groups).flat(); - const allUsersInResult = allGroupsInResult.map((group) => group.users).flat(); + const allGroupsInResult = foundCompanyInfoRO.connections.flatMap((connection) => connection.groups); + const allUsersInResult = allGroupsInResult.flatMap((group) => group.users); const foundSimpleUserInResult = allUsersInResult.find((user) => user.email === simpleUserEmail.toLowerCase()); t.is(foundSimpleUserInResult.email, simpleUserEmail.toLowerCase()); @@ -366,9 +365,8 @@ test.serial( const foundCompanyInfoROAfterUserDeletion = JSON.parse(foundCompanyInfoAfterUserDeletion.text); const allGroupsInResultAfterUserDeletion = foundCompanyInfoROAfterUserDeletion.connections - .map((connection) => connection.groups) - .flat(); - const allUsersInResultAfterUserDeletion = allGroupsInResultAfterUserDeletion.map((group) => group.users).flat(); + .flatMap((connection) => connection.groups); + const allUsersInResultAfterUserDeletion = allGroupsInResultAfterUserDeletion.flatMap((group) => group.users); const foundSimpleUserInResultAfterUserDeletion = !!allUsersInResultAfterUserDeletion.find( (user) => user.email === simpleUserEmail, ); @@ -415,8 +413,8 @@ test.serial(`${currentTest} should revoke user invitation from company`, async ( const foundCompanyInfoRO = JSON.parse(foundCompanyInfo.text); t.is(foundCompanyInfoRO.invitations.length, 0); - const allGroupsInResult = foundCompanyInfoRO.connections.map((connection) => connection.groups).flat(); - const allUsersInResult = allGroupsInResult.map((group) => group.users).flat(); + const allGroupsInResult = foundCompanyInfoRO.connections.flatMap((connection) => connection.groups); + const allUsersInResult = allGroupsInResult.flatMap((group) => group.users); const foundSimpleUserInResult = allUsersInResult.find((user) => user.email === simpleUserEmail.toLowerCase()); const removeUserFromCompanyResult = await request(app.getHttpServer()) @@ -498,7 +496,7 @@ test.serial(`${currentTest} should update company name`, async (t) => { t.is(foundCompanyInfo.status, 200); const foundCompanyInfoRO = JSON.parse(foundCompanyInfo.text); - t.is(foundCompanyInfoRO.hasOwnProperty('name'), true); + t.is(Object.hasOwn(foundCompanyInfoRO, 'name'), true); const newName = `${faker.company.name()}_${nanoid(5)}`; const updateCompanyNameResult = await request(app.getHttpServer()) @@ -519,7 +517,7 @@ test.serial(`${currentTest} should update company name`, async (t) => { t.is(foundCompanyInfo.status, 200); const foundCompanyInfoROAfterUpdate = JSON.parse(foundCompanyInfoAfterUpdate.text); - t.is(foundCompanyInfoROAfterUpdate.hasOwnProperty('name'), true); + t.is(Object.hasOwn(foundCompanyInfoROAfterUpdate, 'name'), true); t.is(foundCompanyInfoROAfterUpdate.name, newName); }); @@ -553,7 +551,7 @@ test.serial(`${currentTest} should return company name`, async (t) => { t.is(foundCompanyName.status, 200); const foundCompanyNameRO = JSON.parse(foundCompanyName.text); - t.is(foundCompanyNameRO.hasOwnProperty('name'), true); + t.is(Object.hasOwn(foundCompanyNameRO, 'name'), true); t.is(foundCompanyNameRO.name, foundCompanyInfoRO.name); t.pass(); }); @@ -752,7 +750,7 @@ test.serial(`${currentTest} should enable 2fa for company`, async (t) => { t.is(foundCompanyInfo.status, 200); const foundCompanyRo = JSON.parse(foundCompanyInfo.text); - t.is(foundCompanyRo.hasOwnProperty('is2faEnabled'), true); + t.is(Object.hasOwn(foundCompanyRo, 'is2faEnabled'), true); t.is(foundCompanyRo.is2faEnabled, false); const requestBody = { @@ -775,7 +773,7 @@ test.serial(`${currentTest} should enable 2fa for company`, async (t) => { t.is(foundCompanyInfoAfterUpdate.status, 200); const foundCompanyRoAfterUpdate = JSON.parse(foundCompanyInfoAfterUpdate.text); - t.is(foundCompanyRoAfterUpdate.hasOwnProperty('is2faEnabled'), true); + t.is(Object.hasOwn(foundCompanyRoAfterUpdate, 'is2faEnabled'), true); t.is(foundCompanyRoAfterUpdate.is2faEnabled, true); // user should not be able to use endpoints that require 2fa after login @@ -866,7 +864,7 @@ test.serial( t.is(user.suspended, false); }); - const subscriptionUpgradeResult = await fetch( + const _subscriptionUpgradeResult = await fetch( `http://rocketadmin-private-microservice:3001/saas/company/subscription/upgrade/${foundCompanyInfoRO.id}`, { method: 'POST', @@ -1118,7 +1116,7 @@ test.serial( .set('Accept', 'application/json'); t.is(foundCompanyInfo.status, 200); - const foundCompanyInfoRO = JSON.parse(foundCompanyInfo.text); + const _foundCompanyInfoRO = JSON.parse(foundCompanyInfo.text); const foundUserTestConnectionsInfo = await request(app.getHttpServer()) .get('/connections') @@ -1205,7 +1203,7 @@ test.serial(`${currentTest} should create and return found company logo after cr .set('Cookie', adminUserToken) .set('Accept', 'image/png'); - const createLogoRO = JSON.parse(createLogoResponse.text); + const _createLogoRO = JSON.parse(createLogoResponse.text); t.is(createLogoResponse.status, 201); const foundCompanyLogo = await request(app.getHttpServer()) @@ -1251,7 +1249,7 @@ test.serial(`${currentTest} should create and return found company logo after cr t.is(foundCompanyInfoWithLogo.status, 200); const foundCompanyInfoWithLogoRO = JSON.parse(foundCompanyInfoWithLogo.text); - t.is(foundCompanyInfoWithLogoRO.hasOwnProperty('logo'), true); + t.is(Object.hasOwn(foundCompanyInfoWithLogoRO, 'logo'), true); t.is(foundCompanyInfoWithLogoRO.logo.mimeType, 'image/png'); t.is(foundCompanyInfoWithLogoRO.logo.image.length > 0, true); @@ -1270,7 +1268,7 @@ test.serial(`${currentTest} should create and return found company logo after cr t.is(foundCompanyInfoWithLogoForSimpleUser.status, 200); const foundCompanyInfoWithLogoForSimpleUserRO = JSON.parse(foundCompanyInfoWithLogoForSimpleUser.text); - t.is(foundCompanyInfoWithLogoForSimpleUserRO.hasOwnProperty('logo'), true); + t.is(Object.hasOwn(foundCompanyInfoWithLogoForSimpleUserRO, 'logo'), true); t.is(foundCompanyInfoWithLogoForSimpleUserRO.logo.mimeType, 'image/png'); t.is(foundCompanyInfoWithLogoForSimpleUserRO.logo.image.length > 0, true); @@ -1316,7 +1314,7 @@ test.serial(`${currentTest} should create and return found company favicon after .set('Cookie', adminUserToken) .set('Accept', 'image/png'); - const createFaviconRO = JSON.parse(createFaviconResponse.text); + const _createFaviconRO = JSON.parse(createFaviconResponse.text); t.is(createFaviconResponse.status, 201); const foundCompanyFavicon = await request(app.getHttpServer()) @@ -1362,7 +1360,7 @@ test.serial(`${currentTest} should create and return found company favicon after t.is(foundCompanyInfoWithFavicon.status, 200); const foundCompanyInfoWithFaviconRO = JSON.parse(foundCompanyInfoWithFavicon.text); - t.is(foundCompanyInfoWithFaviconRO.hasOwnProperty('favicon'), true); + t.is(Object.hasOwn(foundCompanyInfoWithFaviconRO, 'favicon'), true); t.is(foundCompanyInfoWithFaviconRO.favicon.mimeType, 'image/png'); t.is(foundCompanyInfoWithFaviconRO.favicon.image.length > 0, true); @@ -1384,7 +1382,7 @@ test.serial(`${currentTest} should create and return found company favicon after t.is(foundCompanyInfoWithFaviconForSimpleUser.status, 200); const foundCompanyInfoWithFaviconForSimpleUserRO = JSON.parse(foundCompanyInfoWithFaviconForSimpleUser.text); - t.is(foundCompanyInfoWithFaviconForSimpleUserRO.hasOwnProperty('favicon'), true); + t.is(Object.hasOwn(foundCompanyInfoWithFaviconForSimpleUserRO, 'favicon'), true); t.is(foundCompanyInfoWithFaviconForSimpleUserRO.favicon.mimeType, 'image/png'); t.is(foundCompanyInfoWithFaviconForSimpleUserRO.favicon.image.length > 0, true); @@ -1443,7 +1441,7 @@ test.serial(`${currentTest} should create and return found company tab title aft t.is(foundCompanyInfoAfterUpdate.status, 200); const foundCompanyInfoROAfterUpdate = JSON.parse(foundCompanyInfoAfterUpdate.text); - t.is(foundCompanyInfoROAfterUpdate.hasOwnProperty('tab_title'), true); + t.is(Object.hasOwn(foundCompanyInfoROAfterUpdate, 'tab_title'), true); t.is(foundCompanyInfoROAfterUpdate.tab_title, newTabTitle); const foundCompanyTabTitle = await request(app.getHttpServer()) @@ -1454,7 +1452,7 @@ test.serial(`${currentTest} should create and return found company tab title aft t.is(foundCompanyTabTitle.status, 200); const foundCompanyTabTitleRO = JSON.parse(foundCompanyTabTitle.text); - t.is(foundCompanyTabTitleRO.hasOwnProperty('tab_title'), true); + t.is(Object.hasOwn(foundCompanyTabTitleRO, 'tab_title'), true); t.is(foundCompanyTabTitleRO.tab_title, newTabTitle); //should return tab title in full company info for simple user @@ -1467,7 +1465,7 @@ test.serial(`${currentTest} should create and return found company tab title aft t.is(foundCompanyTabTitleForSimpleUser.status, 200); const foundCompanyTabTitleForSimpleUserRO = JSON.parse(foundCompanyTabTitleForSimpleUser.text); - t.is(foundCompanyTabTitleForSimpleUserRO.hasOwnProperty('tab_title'), true); + t.is(Object.hasOwn(foundCompanyTabTitleForSimpleUserRO, 'tab_title'), true); t.is(foundCompanyTabTitleForSimpleUserRO.tab_title, newTabTitle); }); @@ -1495,7 +1493,7 @@ test.serial(`${currentTest} should return found company white label properties f // crete company logo const testLogoPatch = join(process.cwd(), 'test', 'ava-tests', 'test-files', 'test_logo.png'); - const downloadedLogoPatch = join(os.tmpdir(), `${foundCompanyInfoRO.id}_test_logo.png`); + const _downloadedLogoPatch = join(os.tmpdir(), `${foundCompanyInfoRO.id}_test_logo.png`); const createLogoResponse = await request(app.getHttpServer()) .post(`/company/logo/${foundCompanyInfoRO.id}`) @@ -1504,12 +1502,12 @@ test.serial(`${currentTest} should return found company white label properties f .set('Cookie', adminUserToken) .set('Accept', 'image/png'); - const createLogoRO = JSON.parse(createLogoResponse.text); + const _createLogoRO = JSON.parse(createLogoResponse.text); t.is(createLogoResponse.status, 201); // crete company favicon const testFaviconPatch = join(process.cwd(), 'test', 'ava-tests', 'test-files', 'test_logo.png'); - const downloadedFaviconPatch = join(os.tmpdir(), `${foundCompanyInfoRO.id}_test_favicon.png`); + const _downloadedFaviconPatch = join(os.tmpdir(), `${foundCompanyInfoRO.id}_test_favicon.png`); const createFaviconResponse = await request(app.getHttpServer()) .post(`/company/favicon/${foundCompanyInfoRO.id}`) @@ -1518,7 +1516,7 @@ test.serial(`${currentTest} should return found company white label properties f .set('Cookie', adminUserToken) .set('Accept', 'image/png'); - const createFaviconRO = JSON.parse(createFaviconResponse.text); + const _createFaviconRO = JSON.parse(createFaviconResponse.text); t.is(createFaviconResponse.status, 201); // crete company tab title @@ -1544,9 +1542,9 @@ test.serial(`${currentTest} should return found company white label properties f t.is(foundCompanyWhiteLabelProperties.status, 200); const foundCompanyWhiteLabelPropertiesRO = JSON.parse(foundCompanyWhiteLabelProperties.text); - t.is(foundCompanyWhiteLabelPropertiesRO.hasOwnProperty('logo'), true); - t.is(foundCompanyWhiteLabelPropertiesRO.hasOwnProperty('favicon'), true); - t.is(foundCompanyWhiteLabelPropertiesRO.hasOwnProperty('tab_title'), true); + t.is(Object.hasOwn(foundCompanyWhiteLabelPropertiesRO, 'logo'), true); + t.is(Object.hasOwn(foundCompanyWhiteLabelPropertiesRO, 'favicon'), true); + t.is(Object.hasOwn(foundCompanyWhiteLabelPropertiesRO, 'tab_title'), true); t.is(foundCompanyWhiteLabelPropertiesRO.logo.mimeType, 'image/png'); t.is(foundCompanyWhiteLabelPropertiesRO.logo.image.length > 0, true); t.is(foundCompanyWhiteLabelPropertiesRO.favicon.mimeType, 'image/png'); @@ -1565,9 +1563,9 @@ test.serial(`${currentTest} should return found company white label properties f const foundCompanyWhiteLabelPropertiesForSimpleUserRO = JSON.parse( foundCompanyWhiteLabelPropertiesForSimpleUser.text, ); - t.is(foundCompanyWhiteLabelPropertiesForSimpleUserRO.hasOwnProperty('logo'), true); - t.is(foundCompanyWhiteLabelPropertiesForSimpleUserRO.hasOwnProperty('favicon'), true); - t.is(foundCompanyWhiteLabelPropertiesForSimpleUserRO.hasOwnProperty('tab_title'), true); + t.is(Object.hasOwn(foundCompanyWhiteLabelPropertiesForSimpleUserRO, 'logo'), true); + t.is(Object.hasOwn(foundCompanyWhiteLabelPropertiesForSimpleUserRO, 'favicon'), true); + t.is(Object.hasOwn(foundCompanyWhiteLabelPropertiesForSimpleUserRO, 'tab_title'), true); t.is(foundCompanyWhiteLabelPropertiesForSimpleUserRO.logo.mimeType, 'image/png'); t.is(foundCompanyWhiteLabelPropertiesForSimpleUserRO.logo.image.length > 0, true); t.is(foundCompanyWhiteLabelPropertiesForSimpleUserRO.favicon.mimeType, 'image/png'); diff --git a/backend/test/ava-tests/saas-tests/connection-e2e.test.ts b/backend/test/ava-tests/saas-tests/connection-e2e.test.ts index 3d055c59..9234d906 100644 --- a/backend/test/ava-tests/saas-tests/connection-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/connection-e2e.test.ts @@ -20,12 +20,11 @@ import { registerUserAndReturnUserInfo, } from '../../utils/register-user-and-return-user-info.js'; import { TestUtils } from '../../utils/test.utils.js'; -import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; import { ConnectionTypesEnum } from '@rocketadmin/shared-code/dist/src/shared/enums/connection-types-enum.js'; const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; let currentTest: string; type RegisterUserData = { @@ -38,7 +37,7 @@ test.before(async () => { imports: [ApplicationModule, DatabaseModule], providers: [DatabaseService, TestUtils], }).compile(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app = moduleFixture.createNestApplication() as any; app.use(cookieParser()); @@ -79,7 +78,6 @@ function getTestConnectionData() { currentTest = '> GET /connections >'; test.serial(`${currentTest} should return all connections for this user`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -121,32 +119,28 @@ test.serial(`${currentTest} should return all connections for this user`, async const result = findAll.body.connections; t.is(result.length, 6); - t.is(result[0].hasOwnProperty('connection'), true); - t.is(result[1].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(result[0], 'connection'), true); + t.is(Object.hasOwn(result[1], 'accessLevel'), true); t.is(result[2].accessLevel, AccessLevelEnum.edit); - t.is(result[3].hasOwnProperty('accessLevel'), true); - t.is(result[4].connection.hasOwnProperty('host'), true); - t.is(result[3].connection.hasOwnProperty('host'), true); + t.is(Object.hasOwn(result[3], 'accessLevel'), true); + t.is(Object.hasOwn(result[4].connection, 'host'), true); + t.is(Object.hasOwn(result[3].connection, 'host'), true); t.is(typeof result[0].connection.port, 'number'); - t.is(result[2].connection.hasOwnProperty('username'), true); - t.is(result[3].connection.hasOwnProperty('database'), true); - t.is(result[0].connection.hasOwnProperty('createdAt'), true); - t.is(result[1].connection.hasOwnProperty('updatedAt'), true); - t.is(result[2].connection.hasOwnProperty('password'), false); - t.is(result[3].connection.hasOwnProperty('groups'), false); + t.is(Object.hasOwn(result[2].connection, 'username'), true); + t.is(Object.hasOwn(result[3].connection, 'database'), true); + t.is(Object.hasOwn(result[0].connection, 'createdAt'), true); + t.is(Object.hasOwn(result[1].connection, 'updatedAt'), true); + t.is(Object.hasOwn(result[2].connection, 'password'), false); + t.is(Object.hasOwn(result[3].connection, 'groups'), false); const oracleConnectionIndex = result.findIndex((e) => e.connection.type === ConnectionTypesEnum.oracledb); // eslint-disable-next-line security/detect-object-injection - t.is(result[oracleConnectionIndex].connection.hasOwnProperty('sid'), true); + t.is(Object.hasOwn(result[oracleConnectionIndex].connection, 'sid'), true); t.pass(); - } catch (e) { - throw e; - } }); currentTest = '> GET connection/users/:slug >'; test.serial(`${currentTest} should return all connection users`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -173,15 +167,11 @@ test.serial(`${currentTest} should return all connection users`, async (t) => { t.is(foundUsersRO.length, 1); t.is(foundUsersRO[0].isActive, false); - t.is(foundUsersRO[0].hasOwnProperty('createdAt'), true); + t.is(Object.hasOwn(foundUsersRO[0], 'createdAt'), true); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should return all connection users from different groups`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -233,19 +223,15 @@ test.serial(`${currentTest} should return all connection users from different gr // t.is(foundUsersRO[0].isActive, false); t.is(foundUsersRO[1].isActive, true); - t.is(foundUsersRO[1].hasOwnProperty('email'), true); - t.is(foundUsersRO[0].hasOwnProperty('email'), true); - t.is(foundUsersRO[0].hasOwnProperty('createdAt'), true); - t.is(foundUsersRO[1].hasOwnProperty('createdAt'), true); + t.is(Object.hasOwn(foundUsersRO[1], 'email'), true); + t.is(Object.hasOwn(foundUsersRO[0], 'email'), true); + t.is(Object.hasOwn(foundUsersRO[0], 'createdAt'), true); + t.is(Object.hasOwn(foundUsersRO[1], 'createdAt'), true); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw an exception, when connection id is incorrect`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -294,13 +280,9 @@ test.serial(`${currentTest} should throw an exception, when connection id is inc t.is(findAllUsersRO.message, Messages.DONT_HAVE_PERMISSIONS); t.pass(); - } catch (e) { - throw e; - } }); test(`${currentTest} should return a found connection`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -333,23 +315,19 @@ test(`${currentTest} should return a found connection`, async (t) => { t.is(result.username, 'postgres'); t.is(result.database, 'nestjs_testing'); t.is(result.sid, null); - t.is(result.hasOwnProperty('createdAt'), true); - t.is(result.hasOwnProperty('updatedAt'), true); - t.is(result.hasOwnProperty('password'), false); - t.is(result.hasOwnProperty('groups'), false); - t.is(result.hasOwnProperty('author'), false); - t.is(result.hasOwnProperty('id'), true); + t.is(Object.hasOwn(result, 'createdAt'), true); + t.is(Object.hasOwn(result, 'updatedAt'), true); + t.is(Object.hasOwn(result, 'password'), false); + t.is(Object.hasOwn(result, 'groups'), false); + t.is(Object.hasOwn(result, 'author'), false); + t.is(Object.hasOwn(result, 'id'), true); t.pass(); - } catch (e) { - throw e; - } }); test.serial( `${currentTest} should return a found connection when user not added into any connection group`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -370,7 +348,7 @@ test.serial( .set('Content-Type', 'application/json') .set('Accept', 'application/json'); t.is(createGroupResponse.status, 201); - const createGroupRO = JSON.parse(createGroupResponse.text); + const _createGroupRO = JSON.parse(createGroupResponse.text); const secondUserRegisterInfo = await inviteUserInCompanyAndAcceptInvitation(token, undefined, app, undefined); @@ -385,31 +363,27 @@ test.serial( const findOneConnectionRO = JSON.parse(findOneResponse.text); t.is(findOneResponse.status, 200); - t.is(findOneConnectionRO.connection.hasOwnProperty('id'), true); - t.is(findOneConnectionRO.connection.hasOwnProperty('title'), true); - t.is(findOneConnectionRO.connection.hasOwnProperty('type'), true); - t.is(findOneConnectionRO.connection.hasOwnProperty('host'), false); - t.is(findOneConnectionRO.connection.hasOwnProperty('port'), false); - t.is(findOneConnectionRO.connection.hasOwnProperty('username'), false); - t.is(findOneConnectionRO.connection.hasOwnProperty('database'), true); - t.is(findOneConnectionRO.connection.hasOwnProperty('sid'), false); - t.is(findOneConnectionRO.connection.hasOwnProperty('password'), false); - t.is(findOneConnectionRO.connection.hasOwnProperty('groups'), false); - t.is(findOneConnectionRO.connection.hasOwnProperty('author'), false); + t.is(Object.hasOwn(findOneConnectionRO.connection, 'id'), true); + t.is(Object.hasOwn(findOneConnectionRO.connection, 'title'), true); + t.is(Object.hasOwn(findOneConnectionRO.connection, 'type'), true); + t.is(Object.hasOwn(findOneConnectionRO.connection, 'host'), false); + t.is(Object.hasOwn(findOneConnectionRO.connection, 'port'), false); + t.is(Object.hasOwn(findOneConnectionRO.connection, 'username'), false); + t.is(Object.hasOwn(findOneConnectionRO.connection, 'database'), true); + t.is(Object.hasOwn(findOneConnectionRO.connection, 'sid'), false); + t.is(Object.hasOwn(findOneConnectionRO.connection, 'password'), false); + t.is(Object.hasOwn(findOneConnectionRO.connection, 'groups'), false); + t.is(Object.hasOwn(findOneConnectionRO.connection, 'author'), false); t.is(findOneConnectionRO.accessLevel, AccessLevelEnum.none); t.is(findOneConnectionRO.groupManagement, false); t.is(findOneConnectionRO.connectionProperties, null); t.pass(); - } catch (e) { - throw e; - } }, ); test.serial( `${currentTest} should throw an exception "id is missing" when connection id not passed in the request`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -434,15 +408,11 @@ test.serial( t.is(message, Messages.UUID_INVALID); t.pass(); - } catch (e) { - throw e; - } }, ); currentTest = 'POST /connection'; test.serial(`${currentTest} should return created connection`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -465,10 +435,10 @@ test.serial(`${currentTest} should return created connection`, async (t) => { t.is(result.username, 'postgres'); t.is(result.database, 'nestjs_testing'); t.is(result.sid, null); - t.is(result.hasOwnProperty('createdAt'), true); - t.is(result.hasOwnProperty('updatedAt'), true); - t.is(result.hasOwnProperty('password'), false); - t.is(result.hasOwnProperty('groups'), true); + t.is(Object.hasOwn(result, 'createdAt'), true); + t.is(Object.hasOwn(result, 'updatedAt'), true); + t.is(Object.hasOwn(result, 'password'), false); + t.is(Object.hasOwn(result, 'groups'), true); t.is(typeof result.groups, 'object'); t.is(result.groups.length >= 1, true); @@ -481,13 +451,9 @@ test.serial(`${currentTest} should return created connection`, async (t) => { t.is(index >= 0, true); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw error when create connection without type`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -500,18 +466,14 @@ test.serial(`${currentTest} should throw error when create connection without ty .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const responseObject = JSON.parse(response.text); + const _responseObject = JSON.parse(response.text); const { message } = JSON.parse(response.text); t.is(response.status, 400); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw error when create connection without host`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -528,13 +490,9 @@ test.serial(`${currentTest} should throw error when create connection without ho t.is(message, Messages.HOST_MISSING); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw error when create connection without port`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -551,13 +509,9 @@ test.serial(`${currentTest} should throw error when create connection without po t.is(message, `${Messages.PORT_MISSING}, ${Messages.PORT_FORMAT_INCORRECT}`); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw error when create connection wit port value more than 65535`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -574,13 +528,9 @@ test.serial(`${currentTest} should throw error when create connection wit port v // t.is(message, ErrorsMessages.VALIDATION_FAILED); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw error when create connection wit port value less than 0`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -597,13 +547,9 @@ test.serial(`${currentTest} should throw error when create connection wit port v const { message } = JSON.parse(response.text); // t.is(message, ErrorsMessages.VALIDATION_FAILED); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw error when create connection without username`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -620,13 +566,9 @@ test.serial(`${currentTest} should throw error when create connection without us t.is(message, Messages.USERNAME_MISSING); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw error when create connection without database`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -643,13 +585,9 @@ test.serial(`${currentTest} should throw error when create connection without da t.is(message, Messages.DATABASE_MISSING); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw error when create connection without password`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -665,15 +603,11 @@ test.serial(`${currentTest} should throw error when create connection without pa const { message } = JSON.parse(response.text); t.is(message, Messages.PASSWORD_MISSING); t.pass(); - } catch (e) { - throw e; - } }); test.serial( `${currentTest} should throw error with complex message when create connection without database, type, port`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -693,15 +627,11 @@ test.serial( // t.is(message, ErrorsMessages.VALIDATION_FAILED); t.pass(); - } catch (e) { - throw e; - } }, ); currentTest = 'PUT /connection'; test.serial(`${currentTest} should return updated connection`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -731,19 +661,15 @@ test.serial(`${currentTest} should return updated connection`, async (t) => { t.is(result.username, 'admin'); t.is(result.database, 'testing_nestjs'); t.is(result.sid, null); - t.is(result.hasOwnProperty('createdAt'), true); - t.is(result.hasOwnProperty('updatedAt'), true); - t.is(result.hasOwnProperty('password'), false); - t.is(result.hasOwnProperty('groups'), false); + t.is(Object.hasOwn(result, 'createdAt'), true); + t.is(Object.hasOwn(result, 'updatedAt'), true); + t.is(Object.hasOwn(result, 'password'), false); + t.is(Object.hasOwn(result, 'groups'), false); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} 'should throw error when update connection without type'`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -769,13 +695,9 @@ test.serial(`${currentTest} 'should throw error when update connection without t // t.is(message, ErrorsMessages.VALIDATION_FAILED); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw error when update connection without host`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -800,13 +722,9 @@ test.serial(`${currentTest} should throw error when update connection without ho const { message } = JSON.parse(response.text); t.is(message, Messages.HOST_MISSING); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw error when update connection without port`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -833,13 +751,9 @@ test.serial(`${currentTest} should throw error when update connection without po t.is(message, `${Messages.PORT_MISSING}, ${Messages.PORT_FORMAT_INCORRECT}`); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw error when update connection wit port value more than 65535`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -865,13 +779,9 @@ test.serial(`${currentTest} should throw error when update connection wit port v // t.is(message, ErrorsMessages.VALIDATION_FAILED); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw error when update connection wit port value less than 0`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -898,13 +808,9 @@ test.serial(`${currentTest} should throw error when update connection wit port v // t.is(message, ErrorsMessages.VALIDATION_FAILED); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw error when update connection without username`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -930,13 +836,9 @@ test.serial(`${currentTest} should throw error when update connection without us t.is(message, Messages.USERNAME_MISSING); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw error when update connection without database`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -963,15 +865,11 @@ test.serial(`${currentTest} should throw error when update connection without da t.is(message, Messages.DATABASE_MISSING); t.pass(); - } catch (e) { - throw e; - } }); test.serial( `${currentTest} should throw error with complex message when update connection without database, type, port`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1000,15 +898,11 @@ test.serial( // t.is(message, ErrorsMessages.VALIDATION_FAILED); t.pass(); - } catch (e) { - throw e; - } }, ); currentTest = 'DELETE /connection/:slug'; test.serial(`${currentTest} should return delete result`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1042,7 +936,7 @@ test.serial(`${currentTest} should return delete result`, async (t) => { const { message } = JSON.parse(findOneResponce.text); t.is(message, Messages.CONNECTION_NOT_FOUND); - t.is(result.hasOwnProperty('id'), false); + t.is(Object.hasOwn(result, 'id'), false); t.is(result.title, 'Test Connection'); t.is(result.type, 'postgres'); t.is(result.host, 'nestjs_testing'); @@ -1051,19 +945,15 @@ test.serial(`${currentTest} should return delete result`, async (t) => { t.is(result.username, 'postgres'); t.is(result.database, 'nestjs_testing'); t.is(result.sid, null); - t.is(result.hasOwnProperty('createdAt'), true); - t.is(result.hasOwnProperty('updatedAt'), true); - t.is(result.hasOwnProperty('password'), false); - t.is(result.hasOwnProperty('groups'), false); - t.is(result.hasOwnProperty('author'), false); + t.is(Object.hasOwn(result, 'createdAt'), true); + t.is(Object.hasOwn(result, 'updatedAt'), true); + t.is(Object.hasOwn(result, 'password'), false); + t.is(Object.hasOwn(result, 'groups'), false); + t.is(Object.hasOwn(result, 'author'), false); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw an exception when connection not found`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1089,13 +979,9 @@ test.serial(`${currentTest} should throw an exception when connection not found` const { message } = JSON.parse(response.text); t.is(message, Messages.DONT_HAVE_PERMISSIONS); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw an exception when connection id not passed in the request`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1119,14 +1005,10 @@ test.serial(`${currentTest} should throw an exception when connection id not pas t.is(response.status, 404); t.pass(); - } catch (e) { - throw e; - } }); currentTest = 'POST /connection/group/:slug'; test.serial(`${currentTest} should return a created group`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token, email } = await registerUserAndReturnUserInfo(app); @@ -1151,20 +1033,16 @@ test.serial(`${currentTest} should return a created group`, async (t) => { const result = JSON.parse(createGroupResponse.text); t.is(result.title, newGroup1.title); - t.is(result.hasOwnProperty('users'), true); + t.is(Object.hasOwn(result, 'users'), true); t.is(typeof result.users, 'object'); t.is(result.users.length, 1); t.is(result.users[0].email, email.toLowerCase()); t.is(result.users[0].isActive, false); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} throw an exception when connectionId not passed in request`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1188,13 +1066,9 @@ test.serial(`${currentTest} throw an exception when connectionId not passed in r t.is(createGroupResponse.status, 404); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} throw an exception when group title not passed in request`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1221,13 +1095,9 @@ test.serial(`${currentTest} throw an exception when group title not passed in re // t.is(message, ErrorsMessages.VALIDATION_FAILED); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} throw an exception when connectionId is incorrect`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1254,13 +1124,9 @@ test.serial(`${currentTest} throw an exception when connectionId is incorrect`, t.is(message, Messages.DONT_HAVE_PERMISSIONS); t.pass(); - } catch (e) { - throw e; - } }); test(`${currentTest} throw an exception when group name is not unique`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1288,14 +1154,10 @@ test(`${currentTest} throw an exception when group name is not unique`, async (t t.is(message, Messages.GROUP_NAME_UNIQUE); t.pass(); - } catch (e) { - throw e; - } }); currentTest = 'PUT /connection/group/delete/:slug'; test.serial(`${currentTest} should return connection without deleted group result`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1321,7 +1183,7 @@ test.serial(`${currentTest} should return connection without deleted group resul t.is(createGroupResponse.status, 201); - t.is(result.hasOwnProperty('id'), true); + t.is(Object.hasOwn(result, 'id'), true); t.is(result.title, newGroup1.title); const createGroupRO = JSON.parse(createGroupResponse.text); @@ -1337,7 +1199,7 @@ test.serial(`${currentTest} should return connection without deleted group resul result = response.body; t.is(response.status, 200); - t.is(result.hasOwnProperty('title'), true); + t.is(Object.hasOwn(result, 'title'), true); t.is(result.title, createGroupRO.title); t.is(result.isMain, false); // check that group was deleted @@ -1351,9 +1213,9 @@ test.serial(`${currentTest} should return connection without deleted group resul t.is(response.status, 200); result = JSON.parse(response.text); t.is(result.length, 1); - const groupId = result[0].group.id; + const _groupId = result[0].group.id; - t.is(result[0].group.hasOwnProperty('title'), true); + t.is(Object.hasOwn(result[0].group, 'title'), true); t.is(result[0].accessLevel, AccessLevelEnum.edit); const index = result @@ -1365,24 +1227,16 @@ test.serial(`${currentTest} should return connection without deleted group resul t.is(index >= 0, true); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest}`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw an exception when connection id is not passed in the request`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1407,7 +1261,7 @@ test.serial(`${currentTest} should throw an exception when connection id is not t.is(createGroupResponse.status, 201); - t.is(result.hasOwnProperty('id'), true); + t.is(Object.hasOwn(result, 'id'), true); t.is(result.title, newGroup1.title); const createGroupRO = JSON.parse(createGroupResponse.text); @@ -1421,13 +1275,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not t.is(response.status, 404); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw an exception when group id is not passed in the request`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1452,7 +1302,7 @@ test.serial(`${currentTest} should throw an exception when group id is not passe t.is(createGroupResponse.status, 201); - t.is(result.hasOwnProperty('id'), true); + t.is(Object.hasOwn(result, 'id'), true); t.is(result.title, newGroup1.title); const createGroupRO = JSON.parse(createGroupResponse.text); @@ -1469,13 +1319,9 @@ test.serial(`${currentTest} should throw an exception when group id is not passe t.is(message, Messages.PARAMETER_NAME_MISSING('groupId')); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw an exception when group id is incorrect`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1501,7 +1347,7 @@ test.serial(`${currentTest} should throw an exception when group id is incorrect t.is(createGroupResponse.status, 201); - t.is(result.hasOwnProperty('id'), true); + t.is(Object.hasOwn(result, 'id'), true); t.is(result.title, newGroup1.title); const createGroupRO = JSON.parse(createGroupResponse.text); @@ -1518,13 +1364,9 @@ test.serial(`${currentTest} should throw an exception when group id is incorrect t.is(message, Messages.GROUP_NOT_FOUND); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw an exception when connection id is incorrect`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1550,7 +1392,7 @@ test.serial(`${currentTest} should throw an exception when connection id is inco t.is(createGroupResponse.status, 201); - t.is(result.hasOwnProperty('id'), true); + t.is(Object.hasOwn(result, 'id'), true); t.is(result.title, newGroup1.title); const createGroupRO = JSON.parse(createGroupResponse.text); @@ -1567,13 +1409,9 @@ test.serial(`${currentTest} should throw an exception when connection id is inco t.is(message, Messages.DONT_HAVE_PERMISSIONS); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw an exception when trying delete admin group`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1599,14 +1437,10 @@ test.serial(`${currentTest} should throw an exception when trying delete admin g t.is(message, Messages.CANT_DELETE_ADMIN_GROUP); t.pass(); - } catch (e) { - throw e; - } }); currentTest = 'PUT /connection/encryption/restore/:slug'; test.serial(`${currentTest} should return restored connection`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1650,15 +1484,11 @@ test.serial(`${currentTest} should return restored connection`, async (t) => { t.is(groupIdInRestoredConnection, groupId); t.pass(); - } catch (e) { - throw e; - } }); test.serial( `${currentTest} should return restored connection. Restored connection should will return list of tables correctly`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1677,7 +1507,7 @@ test.serial( const createConnectionRO = JSON.parse(createConnectionResult.text); const { id, groups } = createConnectionRO; - const groupId = groups[0].id; + const _groupId = groups[0].id; const restoreConnectionResult = await request(app.getHttpServer()) .put(`/connection/encryption/restore/${id}`) .send(newPgConnection) @@ -1701,15 +1531,11 @@ test.serial( t.is(findTablesResponse.status, 200); t.is(tables.length > 0, true); - } catch (e) { - throw e; - } }, ); currentTest = 'GET /connection/groups/:slug'; test.serial(`${currentTest} should groups in connection`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1740,9 +1566,9 @@ test.serial(`${currentTest} should groups in connection`, async (t) => { t.is(response.status, 200); const result = JSON.parse(response.text); - const groupId = result[0].group.id; + const _groupId = result[0].group.id; - t.is(result[1].group.hasOwnProperty('title'), true); + t.is(Object.hasOwn(result[1].group, 'title'), true); t.is(result[0].accessLevel, AccessLevelEnum.edit); const index = result @@ -1754,13 +1580,9 @@ test.serial(`${currentTest} should groups in connection`, async (t) => { t.is(index >= 0, true); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw an exception when connection id not passed in the request`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1793,13 +1615,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas t.is(response.status, 404); t.pass(); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw an exception when connection id is invalid`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1834,9 +1652,6 @@ test.serial(`${currentTest} should throw an exception when connection id is inva t.is(getGroupsRO.length, 0); t.pass(); - } catch (e) { - throw e; - } }); currentTest = 'POST /connection/test/'; @@ -1931,7 +1746,7 @@ test.serial( .set('Accept', 'application/json'); t.is(encryptConnectionResponse.status, 200); - const encryptConnectionRO = JSON.parse(encryptConnectionResponse.text); + const _encryptConnectionRO = JSON.parse(encryptConnectionResponse.text); // test encrypted connection const testConnectionResponse4 = await request(app.getHttpServer()) @@ -1950,7 +1765,6 @@ test.serial( currentTest = 'GET /connection/masterpwd/verify/:connectionId'; test.serial(`${currentTest} should return positive result if passed connection master password is valid`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -1980,13 +1794,9 @@ test.serial(`${currentTest} should return positive result if passed connection m t.is(masterPwdValidationResponse.status, 200); const { isValid } = JSON.parse(masterPwdValidationResponse.text); t.is(isValid, true); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} negative result if passed connection master password is invalid`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -2016,14 +1826,10 @@ test.serial(`${currentTest} negative result if passed connection master password t.is(masterPwdValidationResponse.status, 200); const { isValid } = JSON.parse(masterPwdValidationResponse.text); t.is(isValid, false); - } catch (e) { - throw e; - } }); currentTest = `PUT /connection/unfreeze/:connectionId`; test.serial(`${currentTest} should unfreeze connection`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestConnectionData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -2059,7 +1865,4 @@ test.serial(`${currentTest} should unfreeze connection`, async (t) => { t.is(findOneResponce.status, 200); const result = findOneResponce.body.connection; t.is(result.isFrozen, false); - } catch (error) { - throw error; - } }); diff --git a/backend/test/ava-tests/saas-tests/connection-properties-e2e.test.ts b/backend/test/ava-tests/saas-tests/connection-properties-e2e.test.ts index 300f922a..6b71559b 100644 --- a/backend/test/ava-tests/saas-tests/connection-properties-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/connection-properties-e2e.test.ts @@ -15,13 +15,12 @@ import { registerUserAndReturnUserInfo } from '../../utils/register-user-and-ret import { ValidationException } from '../../../src/exceptions/custom-exceptions/validation-exception.js'; import { ValidationError } from 'class-validator'; import { Cacher } from '../../../src/helpers/cache/cacher.js'; -import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; import { CreateTableCategoryDto } from '../../../src/entities/table-categories/dto/create-table-category.dto.js'; const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; -let newConnection; +let _testUtils: TestUtils; +let _newConnection; let newConnectionProperties; let testTableName: string; const testTableColumnName = 'name'; @@ -36,7 +35,7 @@ test.before(async () => { imports: [ApplicationModule, DatabaseModule], providers: [DatabaseService, TestUtils], }).compile(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app = moduleFixture.createNestApplication(); app.use(cookieParser()); @@ -53,7 +52,7 @@ test.before(async () => { async function resetPostgresTestDB(testTableName) { const Knex = getTestKnex(mockFactory.generateConnectionToTestPostgresDBInDocker()); - await Knex.schema.createTableIfNotExists(testTableName, function (table) { + await Knex.schema.createTableIfNotExists(testTableName, (table) => { table.increments(); table.string(testTableColumnName); table.string(testTAbleSecondColumnName); @@ -79,7 +78,7 @@ async function resetPostgresTestDB(testTableName) { } } -test.beforeEach(async (t) => { +test.beforeEach(async (_t) => { testTableName = `${faker.lorem.words(1)}_${faker.string.uuid()}`; testTables.push(testTableName); newConnectionProperties = mockFactory.generateConnectionPropertiesUserExcluded(testTableName); @@ -117,7 +116,6 @@ function getTestData() { currentTest = 'POST /connection/properties/:slug'; test.serial(`${currentTest} should return created connection properties`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -142,13 +140,9 @@ test.serial(`${currentTest} should return created connection properties`, async t.is(createConnectionPropertiesRO.connectionId, createConnectionRO.id); t.is(createConnectionPropertiesRO.allow_ai_requests, newConnectionProperties.allow_ai_requests); t.is(createConnectionPropertiesRO.default_showing_table, newConnectionProperties.default_showing_table); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should return created connection properties with table categories`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -275,15 +269,11 @@ test.serial(`${currentTest} should return created connection properties with tab updatedConnectionPropertiesWithOutCategories.default_showing_table, ); t.is(updateConnectionPropertiesROWithoutCategories.table_categories.length, 1); - } catch (e) { - throw e; - } }); test.serial( `${currentTest} should return created connection properties with table categories and return created categories in get tables request`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -347,8 +337,8 @@ test.serial( const testTableIndex = findTablesRO.tables.findIndex((t) => t.table === testTableName); - t.is(findTablesRO.tables[testTableIndex].hasOwnProperty('table'), true); - t.is(findTablesRO.tables[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(findTablesRO.tables[testTableIndex], 'table'), true); + t.is(Object.hasOwn(findTablesRO.tables[testTableIndex], 'permissions'), true); t.is(typeof findTablesRO.tables[testTableIndex].permissions, 'object'); t.is(Object.keys(findTablesRO.tables[testTableIndex].permissions).length, 5); t.is(findTablesRO.tables[testTableIndex].table, testTableName); @@ -357,14 +347,10 @@ test.serial( t.is(findTablesRO.tables[testTableIndex].permissions.add, true); t.is(findTablesRO.tables[testTableIndex].permissions.delete, true); t.is(findTablesRO.tables[testTableIndex].permissions.edit, true); - } catch (e) { - throw e; - } }, ); test.serial(`${currentTest} should return connection without excluded tables`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -397,13 +383,9 @@ test.serial(`${currentTest} should return connection without excluded tables`, a t.is(getConnectionTablesRO.length > 0, true); const hiddenTable = getConnectionTablesRO.find((table) => table.name === newConnectionProperties.hidden_tables[0]); t.is(hiddenTable, undefined); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw an exception when excluded table name is incorrect`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -426,16 +408,12 @@ test.serial(`${currentTest} should throw an exception when excluded table name i .set('Cookie', token) .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const createConnectionPropertiesRO = JSON.parse(createConnectionPropertiesResponse.text); + const _createConnectionPropertiesRO = JSON.parse(createConnectionPropertiesResponse.text); t.is(createConnectionPropertiesResponse.status, 400); - } catch (e) { - throw e; - } }); currentTest = 'GET /connection/properties/:slug'; test.serial(`${currentTest} should return connection properties`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -465,13 +443,9 @@ test.serial(`${currentTest} should return connection properties`, async (t) => { const getConnectionPropertiesRO = JSON.parse(getConnectionPropertiesResponse.text); t.is(getConnectionPropertiesRO.hidden_tables[0], newConnectionProperties.hidden_tables[0]); t.is(getConnectionPropertiesRO.connectionId, createConnectionRO.id); - } catch (e) { - throw e; - } }); test.serial(`${currentTest} should throw exception when connection id is incorrect`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -498,14 +472,10 @@ test.serial(`${currentTest} should throw exception when connection id is incorre .set('Content-Type', 'application/json') .set('Accept', 'application/json'); t.is(getConnectionPropertiesResponse.status, 403); - } catch (e) { - throw e; - } }); currentTest = 'DELETE /connection/properties/:slug'; test.serial(`${currentTest} should return deleted connection properties`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -553,16 +523,10 @@ test.serial(`${currentTest} should return deleted connection properties`, async .set('Content-Type', 'application/json') .set('Accept', 'application/json'); t.is(createConnectionPropertiesResponse.status, 201); - const getConnectionPropertiesAfterDeletionRO = getConnectionPropertiesResponseAfterDeletion.text; - //todo check - // t.is(JSON.stringify(getConnectionPropertiesAfterDeletionRO)).toBe(null); - } catch (e) { - throw e; - } + const _getConnectionPropertiesAfterDeletionRO = getConnectionPropertiesResponseAfterDeletion.text; }); test.serial(`${currentTest} should throw exception when connection id is incorrect`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -589,14 +553,10 @@ test.serial(`${currentTest} should throw exception when connection id is incorre .set('Content-Type', 'application/json') .set('Accept', 'application/json'); t.is(getConnectionPropertiesResponse.status, 403); - } catch (e) { - throw e; - } }); currentTest = 'PUT /connection/properties/:slug'; test.serial(`${currentTest} should return updated connection properties`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); @@ -619,15 +579,11 @@ test.serial(`${currentTest} should return updated connection properties`, async t.is(createConnectionPropertiesResponse.status, 201); t.is(createConnectionPropertiesRO.hidden_tables[0], newConnectionProperties.hidden_tables[0]); t.is(createConnectionPropertiesRO.connectionId, createConnectionRO.id); - } catch (e) { - throw e; - } }); test.serial( `${currentTest} should keep created table categories if the exists return updated connection properties`, async (t) => { - try { const { newConnection2, newConnectionToTestDB, updateConnection, newGroup1, newConnection } = getTestData(); const { token } = await registerUserAndReturnUserInfo(app); const secondHiddenTableName = `${faker.lorem.words(1)}_${faker.string.uuid()}`; @@ -669,7 +625,7 @@ test.serial( .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const createTableCategoriesRO = JSON.parse(createTableCategoriesResponse.text); + const _createTableCategoriesRO = JSON.parse(createTableCategoriesResponse.text); t.is(createTableCategoriesResponse.status, 200); @@ -709,8 +665,5 @@ test.serial( t.is(findTableCategoriesRO[0].category_name, 'Category 1'); t.is(findTableCategoriesRO[0].tables.length, 1); t.is(findTableCategoriesRO[0].tables[0], testTableName); - } catch (e) { - throw e; - } }, ); diff --git a/backend/test/ava-tests/saas-tests/custom-domains-e2e.test.ts b/backend/test/ava-tests/saas-tests/custom-domains-e2e.test.ts index fb631aba..5f4104b4 100644 --- a/backend/test/ava-tests/saas-tests/custom-domains-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/custom-domains-e2e.test.ts @@ -20,9 +20,9 @@ import { Cacher } from '../../../src/helpers/cache/cacher.js'; // import nock from 'nock'; import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; -const mockFactory = new MockFactory(); +const _mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; let currentTest: string; // custom domains test (available only in saas mode) @@ -33,7 +33,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication() as any; - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -124,8 +124,8 @@ test.serial(`${currentTest} - should return registered custom domain`, async (t) t.is(registerDomainResponseRO.hostname, customDomain); t.is(registerDomainResponseRO.companyId, companyId); - t.is(registerDomainResponseRO.hasOwnProperty('id'), true); - t.is(registerDomainResponseRO.hasOwnProperty('createdAt'), true); + t.is(Object.hasOwn(registerDomainResponseRO, 'id'), true); + t.is(Object.hasOwn(registerDomainResponseRO, 'createdAt'), true); t.is(Object.keys(registerDomainResponseRO).length, 5); } catch (error) { t.fail(error.message); @@ -209,8 +209,8 @@ test.serial(`${currentTest} - should return found custom domain`, async (t) => { t.is(registerDomainResponseRO.hostname, customDomain); t.is(registerDomainResponseRO.companyId, companyId); - t.is(registerDomainResponseRO.hasOwnProperty('id'), true); - t.is(registerDomainResponseRO.hasOwnProperty('createdAt'), true); + t.is(Object.hasOwn(registerDomainResponseRO, 'id'), true); + t.is(Object.hasOwn(registerDomainResponseRO, 'createdAt'), true); t.is(Object.keys(registerDomainResponseRO).length, 5); const foundDomainResponse = await sendRequestToSaasPart( @@ -221,15 +221,15 @@ test.serial(`${currentTest} - should return found custom domain`, async (t) => { ); t.is(foundDomainResponse.status, 200); const foundDomainResponseRO = await foundDomainResponse.json(); - t.is(foundDomainResponseRO.hasOwnProperty('success'), true); - t.is(foundDomainResponseRO.hasOwnProperty('domain_info'), true); + t.is(Object.hasOwn(foundDomainResponseRO, 'success'), true); + t.is(Object.hasOwn(foundDomainResponseRO, 'domain_info'), true); const domainInfo = foundDomainResponseRO.domain_info; t.is(domainInfo.hostname, customDomain); t.is(domainInfo.companyId, companyId); - t.is(domainInfo.hasOwnProperty('id'), true); - t.is(domainInfo.hasOwnProperty('createdAt'), true); + t.is(Object.hasOwn(domainInfo, 'id'), true); + t.is(Object.hasOwn(domainInfo, 'createdAt'), true); t.is(Object.keys(domainInfo).length, 5); const foundCompanyFullInfoResponse = await request(app.getHttpServer()) @@ -240,7 +240,7 @@ test.serial(`${currentTest} - should return found custom domain`, async (t) => { t.is(foundCompanyFullInfoResponse.status, 200); const foundCompanyFullInfoResponseRO = JSON.parse(foundCompanyFullInfoResponse.text); - t.is(foundCompanyFullInfoResponseRO.hasOwnProperty('custom_domain'), true); + t.is(Object.hasOwn(foundCompanyFullInfoResponseRO, 'custom_domain'), true); t.is(foundCompanyFullInfoResponseRO.custom_domain, requestDomainData.hostname); } catch (error) { t.fail(error.message); @@ -284,8 +284,8 @@ test.serial(`${currentTest} - should throw exception when company id is invalid` t.is(registerDomainResponseRO.hostname, customDomain); t.is(registerDomainResponseRO.companyId, companyId); - t.is(registerDomainResponseRO.hasOwnProperty('id'), true); - t.is(registerDomainResponseRO.hasOwnProperty('createdAt'), true); + t.is(Object.hasOwn(registerDomainResponseRO, 'id'), true); + t.is(Object.hasOwn(registerDomainResponseRO, 'createdAt'), true); t.is(Object.keys(registerDomainResponseRO).length, 5); const foundDomainResponse = await sendRequestToSaasPart( @@ -338,8 +338,8 @@ test.serial(`${currentTest} - should return updated custom domain`, async (t) => t.is(registerDomainResponseRO.hostname, customDomain); t.is(registerDomainResponseRO.companyId, companyId); - t.is(registerDomainResponseRO.hasOwnProperty('id'), true); - t.is(registerDomainResponseRO.hasOwnProperty('createdAt'), true); + t.is(Object.hasOwn(registerDomainResponseRO, 'id'), true); + t.is(Object.hasOwn(registerDomainResponseRO, 'createdAt'), true); t.is(Object.keys(registerDomainResponseRO).length, 5); const updatedCustomDomain = faker.internet.domainName(); @@ -357,9 +357,9 @@ test.serial(`${currentTest} - should return updated custom domain`, async (t) => t.is(updateDomainResponse.status, 200); t.is(updateDomainResponseRO.hostname, updatedCustomDomain); t.is(updateDomainResponseRO.companyId, companyId); - t.is(updateDomainResponseRO.hasOwnProperty('id'), true); - t.is(updateDomainResponseRO.hasOwnProperty('createdAt'), true); - t.is(updateDomainResponseRO.hasOwnProperty('updatedAt'), true); + t.is(Object.hasOwn(updateDomainResponseRO, 'id'), true); + t.is(Object.hasOwn(updateDomainResponseRO, 'createdAt'), true); + t.is(Object.hasOwn(updateDomainResponseRO, 'updatedAt'), true); t.is(Object.keys(updateDomainResponseRO).length, 5); } catch (error) { t.fail(error.message); @@ -403,8 +403,8 @@ test.serial(`${currentTest} - should throw exception when hostname is invalid`, t.is(registerDomainResponse.status, 201); t.is(registerDomainResponseRO.hostname, customDomain); t.is(registerDomainResponseRO.companyId, companyId); - t.is(registerDomainResponseRO.hasOwnProperty('id'), true); - t.is(registerDomainResponseRO.hasOwnProperty('createdAt'), true); + t.is(Object.hasOwn(registerDomainResponseRO, 'id'), true); + t.is(Object.hasOwn(registerDomainResponseRO, 'createdAt'), true); t.is(Object.keys(registerDomainResponseRO).length, 5); const updateDomainData = { @@ -459,8 +459,8 @@ test.serial(`${currentTest} - should throw exception when company id is incorrec t.is(registerDomainResponseRO.hostname, customDomain); t.is(registerDomainResponseRO.companyId, companyId); - t.is(registerDomainResponseRO.hasOwnProperty('id'), true); - t.is(registerDomainResponseRO.hasOwnProperty('createdAt'), true); + t.is(Object.hasOwn(registerDomainResponseRO, 'id'), true); + t.is(Object.hasOwn(registerDomainResponseRO, 'createdAt'), true); t.is(Object.keys(registerDomainResponseRO).length, 5); const updatedCustomDomain = faker.internet.domainName(); @@ -517,8 +517,8 @@ test.serial(`${currentTest} - should delete custom domain`, async (t) => { t.is(registerDomainResponseRO.hostname, customDomain); t.is(registerDomainResponseRO.companyId, companyId); - t.is(registerDomainResponseRO.hasOwnProperty('id'), true); - t.is(registerDomainResponseRO.hasOwnProperty('createdAt'), true); + t.is(Object.hasOwn(registerDomainResponseRO, 'id'), true); + t.is(Object.hasOwn(registerDomainResponseRO, 'createdAt'), true); t.is(Object.keys(registerDomainResponseRO).length, 5); const deleteDomainResponse = await sendRequestToSaasPart( @@ -541,9 +541,9 @@ test.serial(`${currentTest} - should delete custom domain`, async (t) => { ); const foundDomainResponseRO = await foundDomainResponse.json(); - t.is(foundDomainResponseRO.hasOwnProperty('success'), true); + t.is(Object.hasOwn(foundDomainResponseRO, 'success'), true); t.is(foundDomainResponseRO.success, false); - t.is(foundDomainResponseRO.hasOwnProperty('domain_info'), true); + t.is(Object.hasOwn(foundDomainResponseRO, 'domain_info'), true); t.is(foundDomainResponseRO.domain_info, null); } catch (error) { t.fail(error.message); diff --git a/backend/test/ava-tests/saas-tests/custom-field-e2e.test.ts b/backend/test/ava-tests/saas-tests/custom-field-e2e.test.ts index c5bb6ed0..9f608291 100644 --- a/backend/test/ava-tests/saas-tests/custom-field-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/custom-field-e2e.test.ts @@ -22,17 +22,17 @@ import { Cacher } from '../../../src/helpers/cache/cacher.js'; import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const mockFactory = new MockFactory(); const masterPwd = 'ahalaimahalai'; -const decryptValue = (data) => { +const _decryptValue = (data) => { return Encryptor.decryptData(data); }; -const decryptValueMaterPwd = (data) => { +const _decryptValueMaterPwd = (data) => { return Encryptor.decryptDataMasterPwd(data, masterPwd); }; @@ -42,7 +42,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -119,7 +119,7 @@ test.serial(`${currentTest} should return custom fields array, when custom field .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -149,7 +149,7 @@ test.serial(`${currentTest} should return custom fields array, when custom field t.is(getTableRowsRO.rows.length > 0, true); for (const row of getTableRowsRO.rows) { - t.is(row.hasOwnProperty('#autoadmin:customFields'), true); + t.is(Object.hasOwn(row, '#autoadmin:customFields'), true); t.is(typeof row['#autoadmin:customFields'], 'object'); t.is(row['#autoadmin:customFields'].length, 1); t.is(row['#autoadmin:customFields'][0].type, newCustomField.type); @@ -310,7 +310,7 @@ test.serial(`${currentTest} should return table settings with created custom fie .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -354,7 +354,7 @@ test.serial( .set('Content-Type', 'application/json') .set('masterpwd', 'ahalaimahalai') .set('Accept', 'application/json'); - const createCustomField = JSON.parse(createCustomFieldResponse.text); + const _createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 400); // t.is(createCustomField.message, ErrorsMessages.VALIDATION_FAILED); @@ -386,7 +386,7 @@ test.serial( .set('Cookie', token) .set('masterpwd', 'ahalaimahalai') .set('Accept', 'application/json'); - const createCustomField = JSON.parse(createCustomFieldResponse.text); + const _createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 400); // t.is(createCustomField.message, ErrorsMessages.VALIDATION_FAILED); @@ -420,7 +420,7 @@ test.serial( .set('masterpwd', 'ahalaimahalai') .set('Accept', 'application/json'); - const createCustomField = JSON.parse(createCustomFieldResponse.text); + const _createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 400); // t.is(createCustomField.message, ErrorsMessages.VALIDATION_FAILED); @@ -483,7 +483,7 @@ test.serial( .set('Cookie', token) .set('masterpwd', 'ahalaimahalai') .set('Accept', 'application/json'); - const createCustomField = JSON.parse(createCustomFieldResponse.text); + const _createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 400); // t.is(createCustomField.message, ErrorsMessages.VALIDATION_FAILED); @@ -627,7 +627,7 @@ test.serial(`${currentTest} should return updated custom field`, async (t) => { .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -691,7 +691,7 @@ test.serial(`${currentTest} should throw exception, when connection id not passe .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -750,7 +750,7 @@ test.serial(`${currentTest} should throw exception, when connection id passed in .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -812,7 +812,7 @@ test.serial(`${currentTest} should throw exception, when tableName passed in req .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -874,7 +874,7 @@ test.serial(`${currentTest} should throw exception, when tableName not passed in .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -936,7 +936,7 @@ test.serial(`${currentTest} should throw exception, when field id not passed in .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -969,7 +969,7 @@ test.serial(`${currentTest} should throw exception, when field id not passed in .set('masterpwd', 'ahalaimahalai') .set('Accept', 'application/json'); - const updatedCustomFieldRO = JSON.parse(updateCustomFieldResponse.text); + const _updatedCustomFieldRO = JSON.parse(updateCustomFieldResponse.text); t.is(updateCustomFieldResponse.status, 400); // t.is(updatedCustomFieldRO.message, ErrorsMessages.VALIDATION_FAILED); }); @@ -998,7 +998,7 @@ test.serial(`${currentTest} should throw exception, when field type not passed i .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -1031,7 +1031,7 @@ test.serial(`${currentTest} should throw exception, when field type not passed i .set('masterpwd', 'ahalaimahalai') .set('Accept', 'application/json'); - const updatedCustomFieldRO = JSON.parse(updateCustomFieldResponse.text); + const _updatedCustomFieldRO = JSON.parse(updateCustomFieldResponse.text); t.is(updateCustomFieldResponse.status, 400); // t.is(updatedCustomFieldRO.message, ErrorsMessages.VALIDATION_FAILED); }); @@ -1059,7 +1059,7 @@ test.serial(`${currentTest} should throw exception, when field type passed in re .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -1120,7 +1120,7 @@ test.serial(`${currentTest} should throw exception, when field text is not passe .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -1153,7 +1153,7 @@ test.serial(`${currentTest} should throw exception, when field text is not passe .set('masterpwd', 'ahalaimahalai') .set('Accept', 'application/json'); - const updatedCustomFieldRO = JSON.parse(updateCustomFieldResponse.text); + const _updatedCustomFieldRO = JSON.parse(updateCustomFieldResponse.text); t.is(updateCustomFieldResponse.status, 400); // t.is(updatedCustomFieldRO.message, ErrorsMessages.VALIDATION_FAILED); }); @@ -1182,7 +1182,7 @@ test.serial(`${currentTest} should throw exception, when field template_string i .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -1215,7 +1215,7 @@ test.serial(`${currentTest} should throw exception, when field template_string i .set('masterpwd', 'ahalaimahalai') .set('Accept', 'application/json'); - const updatedCustomFieldRO = JSON.parse(updateCustomFieldResponse.text); + const _updatedCustomFieldRO = JSON.parse(updateCustomFieldResponse.text); t.is(updateCustomFieldResponse.status, 400); // t.is(updatedCustomFieldRO.message, ErrorsMessages.VALIDATION_FAILED); }); @@ -1243,7 +1243,7 @@ test.serial(`${currentTest} should throw exception, when fields passed in templa .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -1311,7 +1311,7 @@ test.serial( .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -1344,7 +1344,7 @@ test.serial( .set('masterpwd', 'ahalaimahalai') .set('Accept', 'application/json'); - const updatedCustomFieldRO = JSON.parse(updateCustomFieldResponse.text); + const _updatedCustomFieldRO = JSON.parse(updateCustomFieldResponse.text); t.is(updateCustomFieldResponse.status, 400); // t.is(updatedCustomFieldRO.message, ErrorsMessages.VALIDATION_FAILED); }, @@ -1375,7 +1375,7 @@ test.serial(`${currentTest} should return table settings without deleted custom .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); let getCustomFields = await request(app.getHttpServer()) @@ -1446,7 +1446,7 @@ test.serial(`${currentTest} should throw exception, when connection id not passe .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -1498,7 +1498,7 @@ test.serial(`${currentTest} should throw exception, when connection id passed in .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -1552,7 +1552,7 @@ test.serial(`${currentTest} should throw exception, when tableName not passed in .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -1606,7 +1606,7 @@ test.serial(`${currentTest} should throw exception, when tableName passed in req .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -1660,7 +1660,7 @@ test.serial(`${currentTest} should throw exception, when field id is not passed .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) @@ -1714,7 +1714,7 @@ test.serial(`${currentTest} should throw exception, when field id passed in requ .set('Accept', 'application/json'); const createCustomField = JSON.parse(createCustomFieldResponse.text); t.is(createCustomFieldResponse.status, 201); - t.is(createCustomField.hasOwnProperty('custom_fields'), true); + t.is(Object.hasOwn(createCustomField, 'custom_fields'), true); t.is(typeof createCustomField.custom_fields, 'object'); const getCustomFields = await request(app.getHttpServer()) diff --git a/backend/test/ava-tests/saas-tests/different-tables-structures-e2e-test.ts b/backend/test/ava-tests/saas-tests/different-tables-structures-e2e-test.ts index 5677513b..b3225c75 100644 --- a/backend/test/ava-tests/saas-tests/different-tables-structures-e2e-test.ts +++ b/backend/test/ava-tests/saas-tests/different-tables-structures-e2e-test.ts @@ -8,23 +8,17 @@ import test from 'ava'; import cookieParser from 'cookie-parser'; import request from 'supertest'; import { ApplicationModule } from '../../../src/app.module.js'; -import { LogOperationTypeEnum, QueryOrderingEnum } from '../../../src/enums/index.js'; import { AllExceptionsFilter } from '../../../src/exceptions/all-exceptions.filter.js'; -import { Messages } from '../../../src/exceptions/text/messages.js'; -import { Constants } from '../../../src/helpers/constants/constants.js'; import { DatabaseModule } from '../../../src/shared/database/database.module.js'; import { DatabaseService } from '../../../src/shared/database/database.service.js'; import { MockFactory } from '../../mock.factory.js'; -import { createTestTable } from '../../utils/create-test-table.js'; import { getTestData } from '../../utils/get-test-data.js'; import { registerUserAndReturnUserInfo } from '../../utils/register-user-and-return-user-info.js'; import { TestUtils } from '../../utils/test.utils.js'; import { ValidationException } from '../../../src/exceptions/custom-exceptions/validation-exception.js'; import { ValidationError } from 'class-validator'; -import fs from 'fs'; import path from 'path'; import { fileURLToPath } from 'url'; -import { join } from 'path'; import { Cacher } from '../../../src/helpers/cache/cacher.js'; import { clearAllTestKnex, getTestKnex } from '../../utils/get-test-knex.js'; import { Knex } from 'knex'; @@ -35,9 +29,9 @@ const __dirname = path.dirname(__filename); const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; -const testSearchedUserName = 'Vasia'; -const testTables: Array = []; +let _testUtils: TestUtils; +const _testSearchedUserName = 'Vasia'; +const _testTables: Array = []; let currentTest; test.before(async () => { @@ -46,7 +40,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication() as any; - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -204,14 +198,14 @@ test.serial(`${currentTest} should return list of rows of the tables`, async (t) const foundRowsFromUsersTableRO = JSON.parse(foundRowsFromUsersTableResponse.text); t.is(typeof foundRowsFromUsersTableRO, 'object'); - t.is(foundRowsFromUsersTableRO.hasOwnProperty('rows'), true); - t.is(foundRowsFromUsersTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowsFromUsersTableRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(foundRowsFromUsersTableRO, 'rows'), true); + t.is(Object.hasOwn(foundRowsFromUsersTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowsFromUsersTableRO, 'pagination'), true); t.is(foundRowsFromUsersTableRO.rows.length, 500); t.is(Object.keys(foundRowsFromUsersTableRO.rows[1]).length, 4); - t.is(foundRowsFromUsersTableRO.rows[0].hasOwnProperty('userid'), true); - t.is(foundRowsFromUsersTableRO.rows[1].hasOwnProperty('username'), true); - t.is(foundRowsFromUsersTableRO.rows[2].hasOwnProperty('created_at'), true); + t.is(Object.hasOwn(foundRowsFromUsersTableRO.rows[0], 'userid'), true); + t.is(Object.hasOwn(foundRowsFromUsersTableRO.rows[1], 'username'), true); + t.is(Object.hasOwn(foundRowsFromUsersTableRO.rows[2], 'created_at'), true); const foundRowsFromTransactionsTableResponse = await request(app.getHttpServer()) .get(`/table/rows/${createConnectionRO.id}?tableName=${testTransactionsTableName}&page=1&perPage=500`) @@ -221,24 +215,24 @@ test.serial(`${currentTest} should return list of rows of the tables`, async (t) const foundRowsFromTransactionsTableRO = JSON.parse(foundRowsFromTransactionsTableResponse.text); t.is(typeof foundRowsFromTransactionsTableRO, 'object'); - t.is(foundRowsFromTransactionsTableRO.hasOwnProperty('rows'), true); - t.is(foundRowsFromTransactionsTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowsFromTransactionsTableRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(foundRowsFromTransactionsTableRO, 'rows'), true); + t.is(Object.hasOwn(foundRowsFromTransactionsTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowsFromTransactionsTableRO, 'pagination'), true); t.is(foundRowsFromTransactionsTableRO.rows.length, 500); t.is(Object.keys(foundRowsFromTransactionsTableRO.rows[1]).length, 7); - t.is(foundRowsFromTransactionsTableRO.rows[0].hasOwnProperty('buyerid'), true); - t.is(foundRowsFromTransactionsTableRO.rows[1].hasOwnProperty('reviewerid'), true); - t.is(foundRowsFromTransactionsTableRO.rows[2].hasOwnProperty('transaction_date'), true); + t.is(Object.hasOwn(foundRowsFromTransactionsTableRO.rows[0], 'buyerid'), true); + t.is(Object.hasOwn(foundRowsFromTransactionsTableRO.rows[1], 'reviewerid'), true); + t.is(Object.hasOwn(foundRowsFromTransactionsTableRO.rows[2], 'transaction_date'), true); for (const row of foundRowsFromTransactionsTableRO.rows) { - t.is(row.hasOwnProperty('buyerid'), true); + t.is(Object.hasOwn(row, 'buyerid'), true); const buyerId = row.buyerid; t.is(typeof buyerId, 'object'); - t.is(buyerId.hasOwnProperty('userid'), true); + t.is(Object.hasOwn(buyerId, 'userid'), true); t.is(typeof buyerId.userid, 'number'); const reviewerId = row.reviewerid; t.is(typeof reviewerId, 'object'); - t.is(reviewerId.hasOwnProperty('userid'), true); + t.is(Object.hasOwn(reviewerId, 'userid'), true); t.is(typeof reviewerId.userid, 'number'); } } catch (error) { diff --git a/backend/test/ava-tests/saas-tests/group-e2e.test.ts b/backend/test/ava-tests/saas-tests/group-e2e.test.ts index ae57df8a..8c57f472 100644 --- a/backend/test/ava-tests/saas-tests/group-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/group-e2e.test.ts @@ -20,12 +20,11 @@ import { faker } from '@faker-js/faker'; import { Messages } from '../../../src/exceptions/text/messages.js'; import { ValidationException } from '../../../src/exceptions/custom-exceptions/validation-exception.js'; import { ValidationError } from 'class-validator'; -import { ErrorsMessages } from '../../../src/exceptions/custom-exceptions/messages/custom-errors-messages.js'; import { Cacher } from '../../../src/helpers/cache/cacher.js'; import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const mockFactory = new MockFactory(); @@ -35,7 +34,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -102,10 +101,10 @@ test.serial(`${currentTest} should return all user groups`, async (t) => { t.is(result.length, 2); - t.is(result[1].group.hasOwnProperty('users'), true); - t.is(result[1].group.users[0].hasOwnProperty('password'), false); - t.is(result[0].group.hasOwnProperty('title'), true); - t.is(result[0].group.hasOwnProperty('connection'), false); + t.is(Object.hasOwn(result[1].group, 'users'), true); + t.is(Object.hasOwn(result[1].group.users[0], 'password'), false); + t.is(Object.hasOwn(result[0].group, 'title'), true); + t.is(Object.hasOwn(result[0].group, 'connection'), false); t.is(result[1].accessLevel, AccessLevelEnum.edit); } catch (e) { console.error(e); @@ -620,7 +619,7 @@ test.serial(`${currentTest} should return an delete result`, async (t) => { t.is(response.status, 200); const result = JSON.parse(response.text); - const groupId = result[0].group.id; + const _groupId = result[0].group.id; t.is(result.length, 1); t.is(result[0].group.title, 'Admin'); @@ -810,7 +809,7 @@ test.serial(`${currentTest} should return a group without deleted user`, async ( t.is(typeof result, 'object'); t.is(result.title, newGroup1.title); - t.is(result.hasOwnProperty('users'), true); + t.is(Object.hasOwn(result, 'users'), true); t.is(typeof result.users, 'object'); t.is(result.users.length, 1); @@ -1157,7 +1156,7 @@ test.serial(`${currentTest} should throw an error, trying delete last user from .set('Accept', 'application/json'); t.is(createGroupResponse.status, 201); - const createGroupRO = JSON.parse(createGroupResponse.text); + const _createGroupRO = JSON.parse(createGroupResponse.text); const groupId = createConnectionRO.groups[0].id; const requestBody = { email: firstUserRegisterInfo.email, diff --git a/backend/test/ava-tests/saas-tests/permissions-e2e.test.ts b/backend/test/ava-tests/saas-tests/permissions-e2e.test.ts index 4ffcdc5d..93ed1556 100644 --- a/backend/test/ava-tests/saas-tests/permissions-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/permissions-e2e.test.ts @@ -23,7 +23,7 @@ import { Cacher } from '../../../src/helpers/cache/cacher.js'; import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const mockFactory = new MockFactory(); @@ -33,7 +33,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); diff --git a/backend/test/ava-tests/saas-tests/postgres-with-binary-e2e.test.ts b/backend/test/ava-tests/saas-tests/postgres-with-binary-e2e.test.ts index c01f8a1c..db07271a 100644 --- a/backend/test/ava-tests/saas-tests/postgres-with-binary-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/postgres-with-binary-e2e.test.ts @@ -24,7 +24,7 @@ import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; let currentTest; test.before(async () => { @@ -33,7 +33,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -71,7 +71,7 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( const testTableColumnName = `${faker.lorem.words(1)}_${faker.lorem.words(1)}`; const testTableSecondColumnName = `${faker.lorem.words(1)}_${faker.lorem.words(1)}`; const Knex = getTestKnex(connectionParamsCopy); - await Knex.schema.createTable(testTableName, function (table) { + await Knex.schema.createTable(testTableName, (table) => { table.increments(); table.binary(testTableColumnName); table.string(testTableSecondColumnName); diff --git a/backend/test/ava-tests/saas-tests/table-cassandra-agent.e2e.test.ts b/backend/test/ava-tests/saas-tests/table-cassandra-agent.e2e.test.ts index 4eef5672..55436405 100644 --- a/backend/test/ava-tests/saas-tests/table-cassandra-agent.e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/table-cassandra-agent.e2e.test.ts @@ -33,9 +33,9 @@ const __dirname = path.dirname(__filename); const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const testSearchedUserName = 'Vasia'; -const testTables: Array = []; +const _testTables: Array = []; let currentTest; let testTableName: string; let testTableColumnName: string; @@ -51,7 +51,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication() as any; - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); connectionToTestDB = getTestData(mockFactory).cassandraAgentTestConnection; app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -114,8 +114,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( const testTableIndex = getTablesRO.findIndex((t) => t.table === testTableName); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -208,21 +208,21 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(getTableRowsResponse.status, 200); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); - t.is(getTableRowsRO.hasOwnProperty('large_dataset'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'large_dataset'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -278,19 +278,19 @@ test.serial(`${currentTest} should return rows of selected table with search and const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(getTableRowsResponse.status, 200); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0].id, searchedDescription); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -343,17 +343,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'uuid'); @@ -413,17 +413,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'uuid'); @@ -488,15 +488,15 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'uuid'); @@ -562,15 +562,15 @@ should return all found rows with pagination page=1 perPage=3`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'uuid'); @@ -635,9 +635,9 @@ should return all found rows with sorting ids by DESC`, t.is(getTableRowsResponse.status, 200); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); @@ -657,8 +657,8 @@ should return all found rows with sorting ids by DESC`, ); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -715,9 +715,9 @@ should return all found rows with sorting ids by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); @@ -735,8 +735,8 @@ should return all found rows with sorting ids by ASC`, t.truthy(lowestAgeRow, 'Should find the test user with age 14'); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -793,9 +793,9 @@ should return all found rows with sorting ports by DESC and with pagination page const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(getTableRowsResponse.status, 200); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); @@ -813,8 +813,8 @@ should return all found rows with sorting ports by DESC and with pagination page t.truthy(lowestAgeRow, 'Should find the test user with age 90'); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -871,9 +871,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); @@ -889,8 +889,8 @@ test.serial( t.truthy(lowestAgeRow, 'Should find the test user with age 14'); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -947,9 +947,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); @@ -962,8 +962,8 @@ test.serial( } t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1023,9 +1023,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsResponse.status, 200); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); @@ -1044,8 +1044,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.truthy(highestAgeRow, 'Should find the test user with age 95'); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1091,7 +1091,7 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC .set('Cookie', firstUserToken) .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const createTableSettingsRO = JSON.parse(createTableSettingsResponse.text); + const _createTableSettingsRO = JSON.parse(createTableSettingsResponse.text); t.is(createTableSettingsResponse.status, 201); @@ -1107,9 +1107,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0].age, 14); @@ -1117,8 +1117,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1178,9 +1178,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0].age, 14); @@ -1189,8 +1189,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1250,9 +1250,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0].age, 95); @@ -1260,8 +1260,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1328,9 +1328,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); @@ -1343,8 +1343,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1406,9 +1406,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1419,8 +1419,8 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1481,9 +1481,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1494,8 +1494,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1617,8 +1617,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1652,26 +1652,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 6); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -1782,8 +1782,8 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const fakeId = faker.string.uuid(); const row = { - ['id']: fakeId, - ['age']: 99, + "id": fakeId, + "age": 99, [testTableColumnName]: fakeName, [testTableSecondColumnName]: fakeMail, }; @@ -1798,11 +1798,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -1816,9 +1816,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -1834,13 +1834,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'id'), true); t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, fakeId); }); @@ -1861,7 +1861,7 @@ test.serial(`${currentTest} should throw an exception when connection id is not const row = { id: faker.string.uuid(), - ['age']: 99, + "age": 99, [testTableColumnName]: fakeName, [testTableSecondColumnName]: fakeMail, }; @@ -1885,9 +1885,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -1938,9 +1938,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -1980,9 +1980,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2033,9 +2033,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2074,11 +2074,11 @@ test.serial(`${currentTest} should update row in table and return result`, async t.is(updateRowInTableResponse.status, 200); const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2092,9 +2092,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2433,7 +2433,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2445,9 +2445,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2488,9 +2488,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2533,9 +2533,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2578,9 +2578,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2623,9 +2623,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2667,9 +2667,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2713,9 +2713,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2774,11 +2774,11 @@ test.serial(`${currentTest} found row`, async (t) => { t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3001,7 +3001,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3013,9 +3013,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3080,7 +3080,7 @@ test.serial(`${currentTest} should delete rows in table and return result`, asyn .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); t.is(deleteRowInTableResponse.status, 200); //checking that the line was deleted @@ -3093,9 +3093,9 @@ test.serial(`${currentTest} should delete rows in table and return result`, asyn const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(getTableRowsResponse.status, 200); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3385,7 +3385,7 @@ test.serial(`${currentTest} should import csv file with table data`, async (t) = .set('Cookie', firstUserToken) .set('Accept', 'application/json'); - const importCsvRO = JSON.parse(importCsvResponse.text); + const _importCsvRO = JSON.parse(importCsvResponse.text); t.is(importCsvResponse.status, 201); //checking that the lines was added diff --git a/backend/test/ava-tests/saas-tests/table-cassandra.e2e.test.ts b/backend/test/ava-tests/saas-tests/table-cassandra.e2e.test.ts index 6d93cf12..0649b09e 100644 --- a/backend/test/ava-tests/saas-tests/table-cassandra.e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/table-cassandra.e2e.test.ts @@ -33,7 +33,7 @@ const __dirname = path.dirname(__filename); const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const testSearchedUserName = 'Vasia'; const testTables: Array = []; let currentTest; @@ -44,7 +44,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication() as any; - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -99,8 +99,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( const testTableIndex = getTablesRO.findIndex((t) => t.table === testTableName); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -205,21 +205,21 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(getTableRowsResponse.status, 200); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); - t.is(getTableRowsRO.hasOwnProperty('large_dataset'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'large_dataset'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -267,7 +267,7 @@ test.serial(`${currentTest} should return rows of selected table with search and .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const createTableSettingsRO = JSON.parse(createTableSettingsResponse.text); + const _createTableSettingsRO = JSON.parse(createTableSettingsResponse.text); t.is(createTableSettingsResponse.status, 201); @@ -282,19 +282,19 @@ test.serial(`${currentTest} should return rows of selected table with search and const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(getTableRowsResponse.status, 200); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0].id, searchedDescription); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -351,17 +351,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'uuid'); @@ -425,17 +425,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'uuid'); @@ -504,15 +504,15 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'uuid'); @@ -582,15 +582,15 @@ should return all found rows with pagination page=1 perPage=3`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'uuid'); @@ -659,9 +659,9 @@ should return all found rows with sorting ids by DESC`, t.is(getTableRowsResponse.status, 200); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); @@ -681,8 +681,8 @@ should return all found rows with sorting ids by DESC`, ); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -743,9 +743,9 @@ should return all found rows with sorting ids by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); @@ -763,8 +763,8 @@ should return all found rows with sorting ids by ASC`, t.truthy(lowestAgeRow, 'Should find the test user with age 14'); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -825,9 +825,9 @@ should return all found rows with sorting ports by DESC and with pagination page const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(getTableRowsResponse.status, 200); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); @@ -845,8 +845,8 @@ should return all found rows with sorting ports by DESC and with pagination page t.truthy(lowestAgeRow, 'Should find the test user with age 90'); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -907,9 +907,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); @@ -925,8 +925,8 @@ test.serial( t.truthy(lowestAgeRow, 'Should find the test user with age 14'); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -987,9 +987,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); @@ -1002,8 +1002,8 @@ test.serial( } t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1067,9 +1067,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsResponse.status, 200); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); @@ -1088,8 +1088,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.truthy(highestAgeRow, 'Should find the test user with age 95'); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1139,7 +1139,7 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC .set('Cookie', firstUserToken) .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const createTableSettingsRO = JSON.parse(createTableSettingsResponse.text); + const _createTableSettingsRO = JSON.parse(createTableSettingsResponse.text); t.is(createTableSettingsResponse.status, 201); @@ -1155,9 +1155,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0].age, 14); @@ -1165,8 +1165,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1230,9 +1230,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0].age, 14); @@ -1241,8 +1241,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1306,9 +1306,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0].age, 95); @@ -1316,8 +1316,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1388,9 +1388,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); @@ -1403,8 +1403,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1470,9 +1470,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1483,8 +1483,8 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1549,9 +1549,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1562,8 +1562,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1693,8 +1693,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1733,26 +1733,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 6); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -1888,8 +1888,8 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const fakeId = faker.string.uuid(); const row = { - ['id']: fakeId, - ['age']: 99, + "id": fakeId, + "age": 99, [testTableColumnName]: fakeName, [testTableSecondColumnName]: fakeMail, }; @@ -1904,11 +1904,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -1922,9 +1922,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -1940,13 +1940,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'id'), true); t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, fakeId); }); @@ -1972,7 +1972,7 @@ test.serial(`${currentTest} should throw an exception when connection id is not const row = { id: faker.string.uuid(), - ['age']: 99, + "age": 99, [testTableColumnName]: fakeName, [testTableSecondColumnName]: fakeMail, }; @@ -1996,9 +1996,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2054,9 +2054,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2101,9 +2101,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2159,9 +2159,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2205,11 +2205,11 @@ test.serial(`${currentTest} should update row in table and return result`, async t.is(updateRowInTableResponse.status, 200); const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2223,9 +2223,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2608,7 +2608,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2620,9 +2620,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2667,9 +2667,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2717,9 +2717,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2767,9 +2767,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2817,9 +2817,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2866,9 +2866,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2922,9 +2922,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2993,11 +2993,11 @@ test.serial(`${currentTest} found row`, async (t) => { t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3270,7 +3270,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3282,9 +3282,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3354,7 +3354,7 @@ test.serial(`${currentTest} should delete rows in table and return result`, asyn .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); t.is(deleteRowInTableResponse.status, 200); //checking that the line was deleted @@ -3367,9 +3367,9 @@ test.serial(`${currentTest} should delete rows in table and return result`, asyn const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(getTableRowsResponse.status, 200); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3680,7 +3680,7 @@ test.serial(`${currentTest} should import csv file with table data`, async (t) = .set('Cookie', firstUserToken) .set('Accept', 'application/json'); - const importCsvRO = JSON.parse(importCsvResponse.text); + const _importCsvRO = JSON.parse(importCsvResponse.text); t.is(importCsvResponse.status, 201); //checking that the lines was added diff --git a/backend/test/ava-tests/saas-tests/table-categories-e2e.test.ts b/backend/test/ava-tests/saas-tests/table-categories-e2e.test.ts index 489d47c7..1104e949 100644 --- a/backend/test/ava-tests/saas-tests/table-categories-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/table-categories-e2e.test.ts @@ -10,7 +10,6 @@ import path from 'path'; import request from 'supertest'; import { fileURLToPath } from 'url'; import { ApplicationModule } from '../../../src/app.module.js'; -import { QueryOrderingEnum } from '../../../src/enums/index.js'; import { AllExceptionsFilter } from '../../../src/exceptions/all-exceptions.filter.js'; import { ValidationException } from '../../../src/exceptions/custom-exceptions/validation-exception.js'; import { Cacher } from '../../../src/helpers/cache/cacher.js'; @@ -29,9 +28,9 @@ const __dirname = path.dirname(__filename); const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; -const testSearchedUserName = 'Vasia'; -const testTables: Array = []; +let _testUtils: TestUtils; +const _testSearchedUserName = 'Vasia'; +const _testTables: Array = []; let currentTest; test.before(async () => { @@ -40,7 +39,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication() as any; - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -188,7 +187,7 @@ test.serial(`${currentTest} should throw validation exceptions, when table categ .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const createTableCategoriesRO = JSON.parse(createTableCategoriesResponse.text); + const _createTableCategoriesRO = JSON.parse(createTableCategoriesResponse.text); // console.log('🚀 ~ createTableCategoriesRO:', createTableCategoriesRO); t.is(createTableCategoriesResponse.status, 400); @@ -276,7 +275,7 @@ test.serial(`${currentTest} find table categories`, async (t) => { .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const recreateTableCategoriesRO = JSON.parse(recreateTableCategoriesResponse.text); + const _recreateTableCategoriesRO = JSON.parse(recreateTableCategoriesResponse.text); t.is(recreateTableCategoriesResponse.status, 200); diff --git a/backend/test/ava-tests/saas-tests/table-clickhouse-agent-e2e.test.ts b/backend/test/ava-tests/saas-tests/table-clickhouse-agent-e2e.test.ts index b15cb087..d2030f2c 100644 --- a/backend/test/ava-tests/saas-tests/table-clickhouse-agent-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/table-clickhouse-agent-e2e.test.ts @@ -27,24 +27,23 @@ import { getTestData } from '../../utils/get-test-data.js'; import { registerUserAndReturnUserInfo } from '../../utils/register-user-and-return-user-info.js'; import { TestUtils } from '../../utils/test.utils.js'; import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; -import { getRandomTestTableName } from '../../utils/get-random-test-table-name.js'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const testSearchedUserName = 'Vasia'; const testTables: Array = []; let currentTest: string; -let connectionToTestDB: any; -let firstUserToken: string; +let _connectionToTestDB: any; +let _firstUserToken: string; let testTableName: string; let testTableColumnName: string; let testTableSecondColumnName: string; let testEntitiesSeedsCount: number; -let insertedSearchedIds: Array<{ _id?: string; number: number }>; +let _insertedSearchedIds: Array<{ _id?: string; number: number }>; test.before(async () => { const moduleFixture = await Test.createTestingModule({ @@ -52,7 +51,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication() as any; - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -116,8 +115,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( const testTableIndex = getTablesRO.findIndex((t) => t.table === testTableName); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -219,21 +218,21 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); - t.is(getTableRowsRO.hasOwnProperty('large_dataset'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'large_dataset'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -292,19 +291,19 @@ test.serial(`${currentTest} should return rows of selected table with search and const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); - t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription)); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription, 10)); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -360,17 +359,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'integer'); @@ -434,17 +433,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= console.log('🚀 ~ getTableRowsRO:', getTableRowsRO); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'integer'); @@ -512,15 +511,15 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'integer'); @@ -589,15 +588,15 @@ should return all found rows with pagination page=1 perPage=3`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'integer'); @@ -664,9 +663,9 @@ should return all found rows with sorting ids by DESC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0].id, 42); @@ -674,8 +673,8 @@ should return all found rows with sorting ids by DESC`, t.is(getTableRowsRO.rows[41].id, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -735,9 +734,9 @@ should return all found rows with sorting ids by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0].id, 1); @@ -745,8 +744,8 @@ should return all found rows with sorting ids by ASC`, t.is(getTableRowsRO.rows[41].id, 42); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -807,17 +806,17 @@ should return all found rows with sorting ports by DESC and with pagination page const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0].id, 42); t.is(getTableRowsRO.rows[1].id, 41); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -877,17 +876,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0].id, 1); t.is(getTableRowsRO.rows[1].id, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -947,17 +946,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0].id, 39); t.is(getTableRowsRO.rows[1].id, 38); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1020,9 +1019,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0].id, 38); @@ -1031,8 +1030,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1095,9 +1094,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0].id, 1); @@ -1105,8 +1104,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1169,9 +1168,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0].id, 1); @@ -1180,8 +1179,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1244,9 +1243,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0].id, 38); @@ -1254,8 +1253,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1319,9 +1318,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); @@ -1334,8 +1333,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1405,9 +1404,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); @@ -1420,8 +1419,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1485,9 +1484,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); @@ -1502,8 +1501,8 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1567,9 +1566,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1580,8 +1579,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1648,9 +1647,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1661,8 +1660,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1912,8 +1911,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1950,26 +1949,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 6); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -2109,11 +2108,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2127,9 +2126,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2149,13 +2148,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); console.log('🚀 ~ test.serial ~ getLogsRO:', getLogsRO.logs[1].affected_primary_key); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'id'), true); t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, 43); }); @@ -2202,9 +2201,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2257,9 +2256,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2302,9 +2301,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2358,9 +2357,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2402,11 +2401,11 @@ test.serial(`${currentTest} should update row in table and return result`, async t.is(updateRowInTableResponse.status, 200); const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); // t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); // t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2420,9 +2419,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2778,7 +2777,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2790,9 +2789,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2836,9 +2835,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2884,9 +2883,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2932,9 +2931,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2980,9 +2979,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3027,9 +3026,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3076,9 +3075,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3111,7 +3110,7 @@ test.serial( .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); t.is(deleteRowInTableResponse.status, 500); }, ); @@ -3142,11 +3141,11 @@ test.serial(`${currentTest} found row`, async (t) => { t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3391,7 +3390,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3403,9 +3402,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3472,7 +3471,7 @@ test.serial(`${currentTest} should delete rows in table and return result`, asyn .set('Accept', 'application/json'); t.is(deleteRowInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3484,9 +3483,9 @@ test.serial(`${currentTest} should delete rows in table and return result`, asyn const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(getTableRowsResponse.status, 200); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; diff --git a/backend/test/ava-tests/saas-tests/table-clickhouse-e2e.test.ts b/backend/test/ava-tests/saas-tests/table-clickhouse-e2e.test.ts index 6d79a818..f7509fce 100644 --- a/backend/test/ava-tests/saas-tests/table-clickhouse-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/table-clickhouse-e2e.test.ts @@ -27,14 +27,13 @@ import { getTestData } from '../../utils/get-test-data.js'; import { registerUserAndReturnUserInfo } from '../../utils/register-user-and-return-user-info.js'; import { TestUtils } from '../../utils/test.utils.js'; import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; -import { getRandomTestTableName } from '../../utils/get-random-test-table-name.js'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const testSearchedUserName = 'Vasia'; const testTables: Array = []; let currentTest; @@ -45,7 +44,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication() as any; - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -101,8 +100,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( const testTableIndex = getTablesRO.findIndex((t) => t.table === testTableName); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -207,21 +206,21 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); - t.is(getTableRowsRO.hasOwnProperty('large_dataset'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'large_dataset'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -281,19 +280,19 @@ test.serial(`${currentTest} should return rows of selected table with search and const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); - t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription)); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription, 10)); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -350,17 +349,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'integer'); @@ -425,17 +424,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= console.log('🚀 ~ getTableRowsRO:', getTableRowsRO); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'integer'); @@ -504,15 +503,15 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'integer'); @@ -582,15 +581,15 @@ should return all found rows with pagination page=1 perPage=3`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'integer'); @@ -658,9 +657,9 @@ should return all found rows with sorting ids by DESC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0].id, 42); @@ -668,8 +667,8 @@ should return all found rows with sorting ids by DESC`, t.is(getTableRowsRO.rows[41].id, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -730,9 +729,9 @@ should return all found rows with sorting ids by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0].id, 1); @@ -740,8 +739,8 @@ should return all found rows with sorting ids by ASC`, t.is(getTableRowsRO.rows[41].id, 42); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -803,17 +802,17 @@ should return all found rows with sorting ports by DESC and with pagination page const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0].id, 42); t.is(getTableRowsRO.rows[1].id, 41); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -874,17 +873,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0].id, 1); t.is(getTableRowsRO.rows[1].id, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -945,17 +944,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0].id, 39); t.is(getTableRowsRO.rows[1].id, 38); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1019,9 +1018,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0].id, 38); @@ -1030,8 +1029,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1095,9 +1094,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0].id, 1); @@ -1105,8 +1104,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1170,9 +1169,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0].id, 1); @@ -1181,8 +1180,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1246,9 +1245,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0].id, 38); @@ -1256,8 +1255,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1322,9 +1321,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); @@ -1337,8 +1336,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1409,9 +1408,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); @@ -1424,8 +1423,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1490,9 +1489,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); @@ -1507,8 +1506,8 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1573,9 +1572,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1586,8 +1585,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1655,9 +1654,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1668,8 +1667,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1923,8 +1922,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1963,26 +1962,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 6); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -2132,11 +2131,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2150,9 +2149,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2172,13 +2171,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); console.log('🚀 ~ test.serial ~ getLogsRO:', getLogsRO.logs[1].affected_primary_key); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'id'), true); t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, 43); }); @@ -2227,9 +2226,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2284,9 +2283,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2331,9 +2330,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2389,9 +2388,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2435,11 +2434,11 @@ test.serial(`${currentTest} should update row in table and return result`, async t.is(updateRowInTableResponse.status, 200); const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); // t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); // t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2453,9 +2452,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2828,7 +2827,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2840,9 +2839,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2888,9 +2887,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2938,9 +2937,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2988,9 +2987,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3038,9 +3037,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3087,9 +3086,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3138,9 +3137,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3209,11 +3208,11 @@ test.serial(`${currentTest} found row`, async (t) => { t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3474,7 +3473,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3486,9 +3485,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3557,7 +3556,7 @@ test.serial(`${currentTest} should delete rows in table and return result`, asyn .set('Accept', 'application/json'); t.is(deleteRowInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3569,9 +3568,9 @@ test.serial(`${currentTest} should delete rows in table and return result`, asyn const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(getTableRowsResponse.status, 200); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; diff --git a/backend/test/ava-tests/saas-tests/table-dynamodb-e2e.test.ts b/backend/test/ava-tests/saas-tests/table-dynamodb-e2e.test.ts index ff6bd465..c11898ab 100644 --- a/backend/test/ava-tests/saas-tests/table-dynamodb-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/table-dynamodb-e2e.test.ts @@ -33,7 +33,7 @@ const __dirname = path.dirname(__filename); const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const testSearchedUserName = 'Vasia'; const testTables: Array = []; let currentTest; @@ -44,7 +44,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication() as any; - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -94,8 +94,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( const testTableIndex = getTablesRO.findIndex((t) => t.table === testTableName); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -189,21 +189,21 @@ test.serial(`${currentTest} should return rows of selected table without search t.is(getTableRowsResponse.status, 200); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); - t.is(getTableRowsRO.hasOwnProperty('large_dataset'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'large_dataset'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 11); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); }); test.serial(`${currentTest} should return rows of selected table with search and without pagination`, async (t) => { @@ -259,19 +259,19 @@ test.serial(`${currentTest} should return rows of selected table with search and t.is(getTableRowsResponse.status, 200); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 11); t.is(getTableRowsRO.rows[0].id, searchedDescription); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); }); test.serial(`${currentTest} should return page of all rows with pagination page=1, perPage=2`, async (t) => { @@ -324,17 +324,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 11); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'number'); @@ -398,17 +398,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 11); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'number'); @@ -477,15 +477,15 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 11); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'number'); @@ -555,15 +555,15 @@ should return all found rows with pagination page=1 perPage=3`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 11); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'number'); @@ -631,9 +631,9 @@ should return all found rows with sorting ids by DESC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 11); // t.is(getTableRowsRO.rows[0].id, 42); @@ -641,8 +641,8 @@ should return all found rows with sorting ids by DESC`, // t.is(getTableRowsRO.rows[41].id, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -707,9 +707,9 @@ should return all found rows with sorting ids by ASC`, const searchedSecondId = 1; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 11); t.is(getTableRowsRO.rows[0].id, searchedFirstId); @@ -717,8 +717,8 @@ should return all found rows with sorting ids by ASC`, t.is(getTableRowsRO.rows[41].id, searchedLastId); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -784,17 +784,17 @@ should return all found rows with sorting ports by DESC and with pagination page const preSearchedLastId = 9; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 11); t.is(getTableRowsRO.rows[0].id, preSearchedLastId); t.is(getTableRowsRO.rows[1].id, searchedLastId); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -859,17 +859,17 @@ test.serial( const preSearchedSecondId = 1; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 11); t.is(getTableRowsRO.rows[0].id, searchedFirstId); t.is(getTableRowsRO.rows[1].id, preSearchedSecondId); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -934,17 +934,17 @@ test.serial( const searchedSecondId = 5; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 11); t.is(getTableRowsRO.rows[0].id, searchedFirstId); t.is(getTableRowsRO.rows[1].id, searchedSecondId); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1012,9 +1012,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const searchedSecondId = 21; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 11); t.is(getTableRowsRO.rows[0].id, searchedFirstId); @@ -1023,8 +1023,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1089,9 +1089,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const searchedFirstId = 0; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 11); t.is(getTableRowsRO.rows[0].id, searchedFirstId); @@ -1099,8 +1099,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1167,9 +1167,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 11); t.is(getTableRowsRO.rows[0].id, searchedFirstId); @@ -1178,8 +1178,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1244,9 +1244,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const searchedFirstId = 37; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 11); t.is(getTableRowsRO.rows[0].id, searchedFirstId); @@ -1254,8 +1254,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1327,9 +1327,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 11); @@ -1341,8 +1341,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1413,9 +1413,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 11); @@ -1429,8 +1429,8 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1503,9 +1503,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 11); @@ -1518,8 +1518,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 3); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1571,10 +1571,10 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC .set('Accept', 'application/json'); t.is(createTableSettingsResponse.status, 201); - const fieldname = 'age'; + const _fieldname = 'age'; const idFieldName = 'id'; const idFieldValue = 21; - const fieldGtvalue = 14; + const _fieldGtvalue = 14; // const fieldLtvalue = 95; const filters = { @@ -1594,9 +1594,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC console.log('🚀 ~ getTableRowsRO:', getTableRowsRO.rows); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 11); @@ -1609,8 +1609,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 3); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1865,8 +1865,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1906,26 +1906,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 11); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -2075,11 +2075,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2093,9 +2093,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2114,13 +2114,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'id'), true); }); test.serial(`${currentTest} should throw an exception when connection id is not passed in request`, async (t) => { @@ -2168,9 +2168,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2225,9 +2225,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2272,9 +2272,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2329,9 +2329,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2376,11 +2376,11 @@ test.serial(`${currentTest} should update row in table and return result`, async t.is(updateRowInTableResponse.status, 200); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2394,9 +2394,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2771,7 +2771,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2783,9 +2783,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2831,9 +2831,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2881,9 +2881,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2931,9 +2931,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2981,9 +2981,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3030,9 +3030,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3086,9 +3086,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3158,11 +3158,11 @@ test.serial(`${currentTest} found row`, async (t) => { t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3389,7 +3389,7 @@ test.serial( .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const findRowResponse = JSON.parse(foundRowInTableResponse.text); + const _findRowResponse = JSON.parse(foundRowInTableResponse.text); t.is(foundRowInTableResponse.status, 500); // t.is(findRowResponse.message, Messages.ROW_PRIMARY_KEY_NOT_FOUND); }, @@ -3444,9 +3444,9 @@ test.serial(`${currentTest} should delete rows in table and return result`, asyn const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; diff --git a/backend/test/ava-tests/saas-tests/table-elasticsearch-e2e.test.ts b/backend/test/ava-tests/saas-tests/table-elasticsearch-e2e.test.ts index d7a331cc..bd307efe 100644 --- a/backend/test/ava-tests/saas-tests/table-elasticsearch-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/table-elasticsearch-e2e.test.ts @@ -33,7 +33,7 @@ const __dirname = path.dirname(__filename); const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const testSearchedUserName = 'Vasia'; const testTables: Array = []; let currentTest; @@ -44,7 +44,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication() as any; - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -99,8 +99,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( const testTableIndex = getTablesRO.findIndex((t) => t.table === testTableName); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -206,21 +206,21 @@ test.serial(`${currentTest} should return rows of selected table without search t.is(getTableRowsResponse.status, 200); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); - t.is(getTableRowsRO.hasOwnProperty('large_dataset'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'large_dataset'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('_id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], '_id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -282,19 +282,19 @@ test.serial(`${currentTest} should return rows of selected table with search and t.is(getTableRowsResponse.status, 200); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0][testTableColumnName], searchedDescription); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -351,17 +351,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('_id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], '_id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, '_id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'string'); @@ -425,17 +425,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('_id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], '_id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, '_id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'string'); @@ -504,15 +504,15 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, '_id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'string'); @@ -582,15 +582,15 @@ should return all found rows with pagination page=1 perPage=3`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, '_id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'string'); @@ -658,9 +658,9 @@ should return all found rows with sorting ids by DESC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); // t.is(getTableRowsRO.rows[0]._id, 42); @@ -668,8 +668,8 @@ should return all found rows with sorting ids by DESC`, // t.is(getTableRowsRO.rows[41]._id, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -730,9 +730,9 @@ should return all found rows with sorting AGE by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); for (let i = 1; i < getTableRowsRO.rows.length; i++) { @@ -740,8 +740,8 @@ should return all found rows with sorting AGE by ASC`, } t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -803,16 +803,16 @@ should return all found rows with sorting age by DESC and with pagination page=1 const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.true(getTableRowsRO.rows[0].age >= getTableRowsRO.rows[1].age); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -873,16 +873,16 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.true(getTableRowsRO.rows[0].age <= getTableRowsRO.rows[1].age); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -943,9 +943,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); for (let i = 1; i < getTableRowsRO.rows.length; i++) { @@ -953,8 +953,8 @@ test.serial( } t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1018,9 +1018,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.pagination.currentPage, 1); @@ -1031,8 +1031,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC } t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1096,9 +1096,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); @@ -1106,8 +1106,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1174,9 +1174,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const searchedSecondId = insertedSearchedIds.find((id) => id.number === 21)._id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0]._id, searchedFirstId); @@ -1185,8 +1185,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1251,9 +1251,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const searchedFirstId = insertedSearchedIds.find((id) => id.number === 37)._id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0]._id, searchedFirstId); @@ -1261,8 +1261,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1333,9 +1333,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1347,8 +1347,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1419,9 +1419,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1435,8 +1435,8 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1509,9 +1509,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1524,8 +1524,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 3); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1780,8 +1780,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1820,26 +1820,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 6); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -1987,11 +1987,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2005,9 +2005,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2025,13 +2025,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('_id'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, '_id'), true); }); test.serial(`${currentTest} should throw an exception when connection id is not passed in request`, async (t) => { @@ -2079,9 +2079,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2136,9 +2136,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2183,9 +2183,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2240,9 +2240,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2286,11 +2286,11 @@ test.serial(`${currentTest} should update row in table and return result`, async t.is(updateRowInTableResponse.status, 200); const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2304,9 +2304,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2681,7 +2681,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2693,9 +2693,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2741,9 +2741,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2791,9 +2791,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2841,9 +2841,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2891,9 +2891,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2940,9 +2940,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2996,9 +2996,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3064,11 +3064,11 @@ test.serial(`${currentTest} found row`, async (t) => { .set('Accept', 'application/json'); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); t.is(foundRowInTableResponse.status, 200); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3339,7 +3339,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3351,9 +3351,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3422,7 +3422,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3434,9 +3434,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(getTableRowsResponse.status, 200); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3642,7 +3642,7 @@ test.serial(`${currentTest} should import csv file with table data`, async (t) = // eslint-disable-next-line security/detect-non-literal-fs-filename const fileContent = fs.readFileSync(filePatch).toString(); const rows = fileContent.split('\n'); - const idColumnIndex = rows[0].split(',').findIndex((column) => column === '_id'); + const idColumnIndex = rows[0].split(',').indexOf('_id'); const newRows = rows.map((row) => { const columns = row.split(','); if (columns.length === 1) { diff --git a/backend/test/ava-tests/saas-tests/table-filters-e2e-test.ts b/backend/test/ava-tests/saas-tests/table-filters-e2e-test.ts index 3ea8e204..ba08a3ad 100644 --- a/backend/test/ava-tests/saas-tests/table-filters-e2e-test.ts +++ b/backend/test/ava-tests/saas-tests/table-filters-e2e-test.ts @@ -28,7 +28,7 @@ const __dirname = path.dirname(__filename); const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const testSearchedUserName = 'Vasia'; const testTables: Array = []; let currentTest; @@ -39,7 +39,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication() as any; - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -101,12 +101,12 @@ test.serial(`${currentTest} create table filters`, async (t) => { const createTableFiltersRO = JSON.parse(createTableFiltersResponse.text); t.is(createTableFiltersResponse.status, 201); - t.is(createTableFiltersRO.hasOwnProperty('id'), true); - t.is(createTableFiltersRO.hasOwnProperty('name'), true); - t.is(createTableFiltersRO.hasOwnProperty('filters'), true); - t.is(createTableFiltersRO.hasOwnProperty('dynamic_column'), true); - t.is(createTableFiltersRO.hasOwnProperty('createdAt'), true); - t.is(createTableFiltersRO.hasOwnProperty('updatedAt'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'id'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'name'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'filters'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'dynamic_column'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'createdAt'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'updatedAt'), true); t.is(createTableFiltersRO.name, filtersDTO.name); t.deepEqual(createTableFiltersRO.filters, filtersDTO.filters); } catch (e) { @@ -153,12 +153,12 @@ test.serial(`${currentTest} should return table filters`, async (t) => { const createTableFiltersRO = JSON.parse(createTableFiltersResponse.text); t.is(createTableFiltersResponse.status, 201); - t.is(createTableFiltersRO.hasOwnProperty('id'), true); - t.is(createTableFiltersRO.hasOwnProperty('name'), true); - t.is(createTableFiltersRO.hasOwnProperty('filters'), true); - t.is(createTableFiltersRO.hasOwnProperty('dynamic_column'), true); - t.is(createTableFiltersRO.hasOwnProperty('createdAt'), true); - t.is(createTableFiltersRO.hasOwnProperty('updatedAt'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'id'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'name'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'filters'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'dynamic_column'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'createdAt'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'updatedAt'), true); t.is(createTableFiltersRO.name, filtersDTO.name); t.deepEqual(createTableFiltersRO.filters, filtersDTO.filters); @@ -172,12 +172,12 @@ test.serial(`${currentTest} should return table filters`, async (t) => { t.is(Array.isArray(getTableFiltersRO), true); t.is(getTableFiltersRO.length, 1); getTableFiltersRO.forEach((el) => { - t.is(el.hasOwnProperty('id'), true); - t.is(el.hasOwnProperty('name'), true); - t.is(el.hasOwnProperty('filters'), true); - t.is(el.hasOwnProperty('dynamic_column'), true); - t.is(el.hasOwnProperty('createdAt'), true); - t.is(el.hasOwnProperty('updatedAt'), true); + t.is(Object.hasOwn(el, 'id'), true); + t.is(Object.hasOwn(el, 'name'), true); + t.is(Object.hasOwn(el, 'filters'), true); + t.is(Object.hasOwn(el, 'dynamic_column'), true); + t.is(Object.hasOwn(el, 'createdAt'), true); + t.is(Object.hasOwn(el, 'updatedAt'), true); t.is(el.name, filtersDTO.name); t.deepEqual(el.filters, filtersDTO.filters); }); @@ -241,12 +241,12 @@ test.serial(`${currentTest} should return updated table filters`, async (t) => { const createTableFiltersRO = JSON.parse(createTableFiltersResponse.text); t.is(createTableFiltersResponse.status, 201); - t.is(createTableFiltersRO.hasOwnProperty('id'), true); - t.is(createTableFiltersRO.hasOwnProperty('name'), true); - t.is(createTableFiltersRO.hasOwnProperty('filters'), true); - t.is(createTableFiltersRO.hasOwnProperty('dynamic_column'), true); - t.is(createTableFiltersRO.hasOwnProperty('createdAt'), true); - t.is(createTableFiltersRO.hasOwnProperty('updatedAt'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'id'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'name'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'filters'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'dynamic_column'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'createdAt'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'updatedAt'), true); t.is(createTableFiltersRO.name, filtersDTO.name); t.deepEqual(createTableFiltersRO.filters, filtersDTO.filters); @@ -260,12 +260,12 @@ test.serial(`${currentTest} should return updated table filters`, async (t) => { t.is(Array.isArray(getTableFiltersRO), true); t.is(getTableFiltersRO.length, 1); getTableFiltersRO.forEach((el) => { - t.is(el.hasOwnProperty('id'), true); - t.is(el.hasOwnProperty('name'), true); - t.is(el.hasOwnProperty('filters'), true); - t.is(el.hasOwnProperty('dynamic_column'), true); - t.is(el.hasOwnProperty('createdAt'), true); - t.is(el.hasOwnProperty('updatedAt'), true); + t.is(Object.hasOwn(el, 'id'), true); + t.is(Object.hasOwn(el, 'name'), true); + t.is(Object.hasOwn(el, 'filters'), true); + t.is(Object.hasOwn(el, 'dynamic_column'), true); + t.is(Object.hasOwn(el, 'createdAt'), true); + t.is(Object.hasOwn(el, 'updatedAt'), true); t.is(el.name, filtersDTO.name); t.deepEqual(el.filters, filtersDTO.filters); }); @@ -280,12 +280,12 @@ test.serial(`${currentTest} should return updated table filters`, async (t) => { const updateTableFiltersRO = JSON.parse(updateTableFiltersResponse.text); t.is(updateTableFiltersResponse.status, 200); - t.is(updateTableFiltersRO.hasOwnProperty('id'), true); - t.is(updateTableFiltersRO.hasOwnProperty('name'), true); - t.is(updateTableFiltersRO.hasOwnProperty('filters'), true); - t.is(updateTableFiltersRO.hasOwnProperty('dynamic_column'), true); - t.is(updateTableFiltersRO.hasOwnProperty('createdAt'), true); - t.is(updateTableFiltersRO.hasOwnProperty('updatedAt'), true); + t.is(Object.hasOwn(updateTableFiltersRO, 'id'), true); + t.is(Object.hasOwn(updateTableFiltersRO, 'name'), true); + t.is(Object.hasOwn(updateTableFiltersRO, 'filters'), true); + t.is(Object.hasOwn(updateTableFiltersRO, 'dynamic_column'), true); + t.is(Object.hasOwn(updateTableFiltersRO, 'createdAt'), true); + t.is(Object.hasOwn(updateTableFiltersRO, 'updatedAt'), true); t.is(updateTableFiltersRO.name, updatedFiltersDTO.name); t.is(updateTableFiltersRO.id, createTableFiltersRO.id); t.deepEqual(updateTableFiltersRO.filters, updatedFiltersDTO.filters); @@ -300,12 +300,12 @@ test.serial(`${currentTest} should return updated table filters`, async (t) => { t.is(Array.isArray(getUpdatedTableFiltersRO), true); t.is(getUpdatedTableFiltersRO.length, 1); getUpdatedTableFiltersRO.forEach((el) => { - t.is(el.hasOwnProperty('id'), true); - t.is(el.hasOwnProperty('name'), true); - t.is(el.hasOwnProperty('filters'), true); - t.is(el.hasOwnProperty('dynamic_column'), true); - t.is(el.hasOwnProperty('createdAt'), true); - t.is(el.hasOwnProperty('updatedAt'), true); + t.is(Object.hasOwn(el, 'id'), true); + t.is(Object.hasOwn(el, 'name'), true); + t.is(Object.hasOwn(el, 'filters'), true); + t.is(Object.hasOwn(el, 'dynamic_column'), true); + t.is(Object.hasOwn(el, 'createdAt'), true); + t.is(Object.hasOwn(el, 'updatedAt'), true); t.is(el.name, updatedFiltersDTO.name); t.deepEqual(el.filters, updatedFiltersDTO.filters); }); @@ -357,12 +357,12 @@ test.serial(`${currentTest} should return table filters`, async (t) => { const createTableFiltersRO = JSON.parse(createTableFiltersResponse.text); t.is(createTableFiltersResponse.status, 201); - t.is(createTableFiltersRO.hasOwnProperty('id'), true); - t.is(createTableFiltersRO.hasOwnProperty('name'), true); - t.is(createTableFiltersRO.hasOwnProperty('filters'), true); - t.is(createTableFiltersRO.hasOwnProperty('dynamic_column'), true); - t.is(createTableFiltersRO.hasOwnProperty('createdAt'), true); - t.is(createTableFiltersRO.hasOwnProperty('updatedAt'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'id'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'name'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'filters'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'dynamic_column'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'createdAt'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'updatedAt'), true); t.is(createTableFiltersRO.name, filtersDTO.name); t.deepEqual(createTableFiltersRO.filters, filtersDTO.filters); @@ -373,12 +373,12 @@ test.serial(`${currentTest} should return table filters`, async (t) => { .set('Accept', 'application/json'); const getTableFiltersRO = JSON.parse(getTableFiltersResponse.text); - t.is(getTableFiltersRO.hasOwnProperty('id'), true); - t.is(getTableFiltersRO.hasOwnProperty('name'), true); - t.is(getTableFiltersRO.hasOwnProperty('filters'), true); - t.is(getTableFiltersRO.hasOwnProperty('dynamic_column'), true); - t.is(getTableFiltersRO.hasOwnProperty('createdAt'), true); - t.is(getTableFiltersRO.hasOwnProperty('updatedAt'), true); + t.is(Object.hasOwn(getTableFiltersRO, 'id'), true); + t.is(Object.hasOwn(getTableFiltersRO, 'name'), true); + t.is(Object.hasOwn(getTableFiltersRO, 'filters'), true); + t.is(Object.hasOwn(getTableFiltersRO, 'dynamic_column'), true); + t.is(Object.hasOwn(getTableFiltersRO, 'createdAt'), true); + t.is(Object.hasOwn(getTableFiltersRO, 'updatedAt'), true); t.is(getTableFiltersRO.name, filtersDTO.name); t.deepEqual(getTableFiltersRO.filters, filtersDTO.filters); t.is(getTableFiltersRO.dynamic_column.column_name, filtersDTO.dynamic_column.column_name); @@ -432,12 +432,12 @@ test.serial(`${currentTest} should delete table filters`, async (t) => { const createTableFiltersRO = JSON.parse(createTableFiltersResponse.text); t.is(createTableFiltersResponse.status, 201); - t.is(createTableFiltersRO.hasOwnProperty('id'), true); - t.is(createTableFiltersRO.hasOwnProperty('name'), true); - t.is(createTableFiltersRO.hasOwnProperty('filters'), true); - t.is(createTableFiltersRO.hasOwnProperty('dynamic_column'), true); - t.is(createTableFiltersRO.hasOwnProperty('createdAt'), true); - t.is(createTableFiltersRO.hasOwnProperty('updatedAt'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'id'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'name'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'filters'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'dynamic_column'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'createdAt'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'updatedAt'), true); t.is(createTableFiltersRO.name, filtersDTO.name); t.deepEqual(createTableFiltersRO.filters, filtersDTO.filters); @@ -447,7 +447,7 @@ test.serial(`${currentTest} should delete table filters`, async (t) => { .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const deleteTableFiltersRO = JSON.parse(deleteTableFiltersResponse.text); + const _deleteTableFiltersRO = JSON.parse(deleteTableFiltersResponse.text); t.is(deleteTableFiltersResponse.status, 200); // should return an empty array, when try to get deleted table filters @@ -508,12 +508,12 @@ test.serial(`${currentTest} should delete table filters`, async (t) => { const createTableFiltersRO = JSON.parse(createTableFiltersResponse.text); t.is(createTableFiltersResponse.status, 201); - t.is(createTableFiltersRO.hasOwnProperty('id'), true); - t.is(createTableFiltersRO.hasOwnProperty('name'), true); - t.is(createTableFiltersRO.hasOwnProperty('filters'), true); - t.is(createTableFiltersRO.hasOwnProperty('dynamic_column'), true); - t.is(createTableFiltersRO.hasOwnProperty('createdAt'), true); - t.is(createTableFiltersRO.hasOwnProperty('updatedAt'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'id'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'name'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'filters'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'dynamic_column'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'createdAt'), true); + t.is(Object.hasOwn(createTableFiltersRO, 'updatedAt'), true); t.is(createTableFiltersRO.name, filtersDTO.name); t.deepEqual(createTableFiltersRO.filters, filtersDTO.filters); @@ -523,7 +523,7 @@ test.serial(`${currentTest} should delete table filters`, async (t) => { .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const deleteTableFiltersRO = JSON.parse(deleteTableFiltersResponse.text); + const _deleteTableFiltersRO = JSON.parse(deleteTableFiltersResponse.text); t.is(deleteTableFiltersResponse.status, 200); // should return an empty array, when try to get deleted table filters @@ -642,9 +642,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -657,18 +657,18 @@ test.serial( t.is(getTableRowsRO.pagination.perPage, 200); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); - t.is(getTableRowsRO.hasOwnProperty('saved_filters'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); + t.is(Object.hasOwn(getTableRowsRO, 'saved_filters'), true); t.is(Array.isArray(getTableRowsRO.saved_filters), true); t.is(getTableRowsRO.saved_filters.length, 2); getTableRowsRO.saved_filters.forEach((el) => { - t.is(el.hasOwnProperty('id'), true); - t.is(el.hasOwnProperty('name'), true); - t.is(el.hasOwnProperty('filters'), true); - t.is(el.hasOwnProperty('dynamic_column'), true); - t.is(el.hasOwnProperty('createdAt'), true); - t.is(el.hasOwnProperty('updatedAt'), true); + t.is(Object.hasOwn(el, 'id'), true); + t.is(Object.hasOwn(el, 'name'), true); + t.is(Object.hasOwn(el, 'filters'), true); + t.is(Object.hasOwn(el, 'dynamic_column'), true); + t.is(Object.hasOwn(el, 'createdAt'), true); + t.is(Object.hasOwn(el, 'updatedAt'), true); const foundFilterDTO = filterDTOs.find((filterDTO) => filterDTO.name === el.name); t.is(el.name, foundFilterDTO.name); t.deepEqual(el.filters, foundFilterDTO.filters); diff --git a/backend/test/ava-tests/saas-tests/table-ibmdb2-agent-e2e.test.ts b/backend/test/ava-tests/saas-tests/table-ibmdb2-agent-e2e.test.ts index c3780b91..ab2a118c 100644 --- a/backend/test/ava-tests/saas-tests/table-ibmdb2-agent-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/table-ibmdb2-agent-e2e.test.ts @@ -16,7 +16,6 @@ import { DatabaseModule } from '../../../src/shared/database/database.module.js' import { DatabaseService } from '../../../src/shared/database/database.service.js'; import { MockFactory } from '../../mock.factory.js'; import { createTestTable } from '../../utils/create-test-table.js'; -import { dropTestTables } from '../../utils/drop-test-tables.js'; import { getTestData } from '../../utils/get-test-data.js'; import { registerUserAndReturnUserInfo } from '../../utils/register-user-and-return-user-info.js'; import { TestUtils } from '../../utils/test.utils.js'; @@ -36,7 +35,7 @@ const mockFactory = new MockFactory(); let app: INestApplication; let testUtils: TestUtils; const testSearchedUserName = 'Vasia'; -const testTables: Array = []; +const _testTables: Array = []; let currentTest; let connectionToTestDB: any; let firstUserToken: string; @@ -67,7 +66,7 @@ test.before(async () => { firstUserToken = (await registerUserAndReturnUserInfo(app)).token; connectionToTestDB = getTestData(mockFactory).connectionToAgentIbmDB2; - const createConnectionResponse = await request(app.getHttpServer()) + const _createConnectionResponse = await request(app.getHttpServer()) .post('/connection') .send(connectionToTestDB) .set('Cookie', firstUserToken) @@ -129,8 +128,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( const testTableIndex = getTablesRO.findIndex((t) => t.table === testTableName); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -217,20 +216,20 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('ID'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('CREATED_AT'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('UPDATED_AT'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'ID'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'CREATED_AT'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'UPDATED_AT'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -285,19 +284,19 @@ test.serial(`${currentTest} should return rows of selected table with search and t.is(getTableRowsResponse.status, 200); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); - t.is(getTableRowsRO.rows[0].ID, parseInt(searchedDescription)); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('CREATED_AT'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('UPDATED_AT'), true); + t.is(getTableRowsRO.rows[0].ID, parseInt(searchedDescription, 10)); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'CREATED_AT'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'UPDATED_AT'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -348,17 +347,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('ID'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'ID'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'ID'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'INTEGER'); @@ -416,17 +415,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('ID'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'ID'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'ID'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'INTEGER'); @@ -489,15 +488,15 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'ID'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'INTEGER'); @@ -562,15 +561,15 @@ should return all found rows with pagination page=1 perPage=3`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'ID'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'INTEGER'); @@ -634,9 +633,9 @@ should return all found rows with sorting ids by DESC`, t.is(getTableRowsResponse.status, 200); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].ID, 42); @@ -644,8 +643,8 @@ should return all found rows with sorting ids by DESC`, t.is(getTableRowsRO.rows[41].ID, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -700,9 +699,9 @@ should return all found rows with sorting ids by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].ID, 1); @@ -710,8 +709,8 @@ should return all found rows with sorting ids by ASC`, t.is(getTableRowsRO.rows[41].ID, 42); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -767,17 +766,17 @@ should return all found rows with sorting ports by DESC and with pagination page const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].ID, 42); t.is(getTableRowsRO.rows[1].ID, 41); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -832,17 +831,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].ID, 1); t.is(getTableRowsRO.rows[1].ID, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -897,17 +896,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].ID, 39); t.is(getTableRowsRO.rows[1].ID, 38); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -965,9 +964,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].ID, 38); @@ -976,8 +975,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1035,9 +1034,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].ID, 1); @@ -1045,8 +1044,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1104,9 +1103,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].ID, 1); @@ -1115,8 +1114,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1174,9 +1173,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].ID, 38); @@ -1184,8 +1183,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1245,9 +1244,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1260,8 +1259,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1320,9 +1319,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1337,8 +1336,8 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1397,9 +1396,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1410,8 +1409,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1473,9 +1472,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1486,8 +1485,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1718,8 +1717,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1751,26 +1750,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 5); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -1884,11 +1883,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t console.log('🚀 ~ test ~ addRowInTableRO:', addRowInTableRO); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -1902,9 +1901,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -1923,13 +1922,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('ID'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'ID'), true); t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.ID, 43); }); @@ -1970,9 +1969,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2019,9 +2018,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2059,9 +2058,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2108,9 +2107,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2147,11 +2146,11 @@ test.serial(`${currentTest} should update row in table and return result`, async const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); t.is(updateRowInTableResponse.status, 200); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2165,9 +2164,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2421,7 +2420,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2433,9 +2432,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2474,9 +2473,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2517,9 +2516,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2560,9 +2559,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2603,9 +2602,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2645,9 +2644,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2689,9 +2688,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2746,11 +2745,11 @@ test.serial(`${currentTest} found row`, async (t) => { t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -2954,7 +2953,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2966,9 +2965,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3167,7 +3166,7 @@ test.serial(`${currentTest} should import csv file with table data`, async (t) = // eslint-disable-next-line security/detect-non-literal-fs-filename const fileContent = fs.readFileSync(filePatch).toString(); const rows = fileContent.split('\n'); - const idColumnIndex = rows[0].split(',').findIndex((column) => column === 'ID'); + const idColumnIndex = rows[0].split(',').indexOf('ID'); const newRows = rows.map((row) => { const columns = row.split(','); if (columns.length === 1) { diff --git a/backend/test/ava-tests/saas-tests/table-ibmdb2-e2e.test.ts b/backend/test/ava-tests/saas-tests/table-ibmdb2-e2e.test.ts index 11f686d9..2731d630 100644 --- a/backend/test/ava-tests/saas-tests/table-ibmdb2-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/table-ibmdb2-e2e.test.ts @@ -16,7 +16,6 @@ import { DatabaseModule } from '../../../src/shared/database/database.module.js' import { DatabaseService } from '../../../src/shared/database/database.service.js'; import { MockFactory } from '../../mock.factory.js'; import { createTestTable } from '../../utils/create-test-table.js'; -import { dropTestTables } from '../../utils/drop-test-tables.js'; import { getTestData } from '../../utils/get-test-data.js'; import { registerUserAndReturnUserInfo } from '../../utils/register-user-and-return-user-info.js'; import { TestUtils } from '../../utils/test.utils.js'; @@ -34,7 +33,7 @@ const __dirname = path.dirname(__filename); const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const testSearchedUserName = 'Vasia'; const testTables: Array = []; let currentTest; @@ -45,7 +44,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -101,8 +100,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( const testTableIndex = getTablesRO.findIndex((t) => t.table === testTableName); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -207,20 +206,20 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('ID'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('CREATED_AT'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('UPDATED_AT'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'ID'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'CREATED_AT'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'UPDATED_AT'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -281,19 +280,19 @@ test.serial(`${currentTest} should return rows of selected table with search and t.is(getTableRowsResponse.status, 200); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); - t.is(getTableRowsRO.rows[0].ID, parseInt(searchedDescription)); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('CREATED_AT'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('UPDATED_AT'), true); + t.is(getTableRowsRO.rows[0].ID, parseInt(searchedDescription, 10)); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'CREATED_AT'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'UPDATED_AT'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -350,17 +349,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('ID'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'ID'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'ID'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'INTEGER'); @@ -424,17 +423,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('ID'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'ID'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'ID'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'INTEGER'); @@ -503,15 +502,15 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'ID'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'INTEGER'); @@ -582,15 +581,15 @@ should return all found rows with pagination page=1 perPage=3`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'ID'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'INTEGER'); @@ -660,9 +659,9 @@ should return all found rows with sorting ids by DESC`, t.is(getTableRowsResponse.status, 200); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].ID, 42); @@ -670,8 +669,8 @@ should return all found rows with sorting ids by DESC`, t.is(getTableRowsRO.rows[41].ID, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -732,9 +731,9 @@ should return all found rows with sorting ids by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].ID, 1); @@ -742,8 +741,8 @@ should return all found rows with sorting ids by ASC`, t.is(getTableRowsRO.rows[41].ID, 42); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -805,17 +804,17 @@ should return all found rows with sorting ports by DESC and with pagination page const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].ID, 42); t.is(getTableRowsRO.rows[1].ID, 41); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -876,17 +875,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].ID, 1); t.is(getTableRowsRO.rows[1].ID, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -947,17 +946,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].ID, 39); t.is(getTableRowsRO.rows[1].ID, 38); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1021,9 +1020,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].ID, 38); @@ -1032,8 +1031,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1097,9 +1096,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].ID, 1); @@ -1107,8 +1106,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1172,9 +1171,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].ID, 1); @@ -1183,8 +1182,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1248,9 +1247,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].ID, 38); @@ -1258,8 +1257,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1325,9 +1324,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1340,8 +1339,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1406,9 +1405,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1423,8 +1422,8 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1489,9 +1488,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1502,8 +1501,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1571,9 +1570,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1584,8 +1583,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1840,8 +1839,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1880,26 +1879,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 5); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -2047,11 +2046,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2065,9 +2064,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2086,13 +2085,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('ID'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'ID'), true); t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.ID, 43); }); @@ -2140,9 +2139,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2196,9 +2195,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2243,9 +2242,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2299,9 +2298,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2345,11 +2344,11 @@ test.serial(`${currentTest} should update row in table and return result`, async const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); t.is(updateRowInTableResponse.status, 200); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2363,9 +2362,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2738,7 +2737,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2750,9 +2749,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2798,9 +2797,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2848,9 +2847,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2898,9 +2897,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2948,9 +2947,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2997,9 +2996,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3048,9 +3047,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3119,11 +3118,11 @@ test.serial(`${currentTest} found row`, async (t) => { t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3383,7 +3382,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3395,9 +3394,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3616,7 +3615,7 @@ test.serial(`${currentTest} should import csv file with table data`, async (t) = // eslint-disable-next-line security/detect-non-literal-fs-filename const fileContent = fs.readFileSync(filePatch).toString(); const rows = fileContent.split('\n'); - const idColumnIndex = rows[0].split(',').findIndex((column) => column === 'ID'); + const idColumnIndex = rows[0].split(',').indexOf('ID'); const newRows = rows.map((row) => { const columns = row.split(','); if (columns.length === 1) { diff --git a/backend/test/ava-tests/saas-tests/table-logs-e2e.test.ts b/backend/test/ava-tests/saas-tests/table-logs-e2e.test.ts index 87cb6490..57e9d9c3 100644 --- a/backend/test/ava-tests/saas-tests/table-logs-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/table-logs-e2e.test.ts @@ -27,7 +27,7 @@ const __dirname = path.dirname(__filename); let app: INestApplication; let currentTest: string; // eslint-disable-next-line @typescript-eslint/no-unused-vars -let testUtils: TestUtils; +let _testUtils: TestUtils; const mockFactory = new MockFactory(); @@ -37,7 +37,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -92,15 +92,15 @@ test.serial(`${currentTest} should return all found logs in connection`, async ( const getRowInTableRO = JSON.parse(getTableLogs.text); t.is(getRowInTableRO.logs.length, 1); - t.is(getRowInTableRO.logs[0].hasOwnProperty('table_name'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('received_data'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('old_data'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('cognitoUserName'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('email'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('operationType'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('operationStatusResult'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('createdAt'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('connection_id'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'table_name'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'received_data'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'old_data'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'cognitoUserName'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'email'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'operationType'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'operationStatusResult'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'createdAt'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'connection_id'), true); } catch (error) { console.error(error); throw error; @@ -139,7 +139,7 @@ test.serial( const getLogsInTableRO = JSON.parse(getTableLogs.text); t.is(getLogsInTableRO.logs.length, 1); - t.is(getLogsInTableRO.logs[0].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsInTableRO.logs[0], 'affected_primary_key'), true); const searchedAffectedPrimaryKey = JSON.stringify(getLogsInTableRO.logs[0].affected_primary_key); let additionalRowAddResponse = await request(app.getHttpServer()) diff --git a/backend/test/ava-tests/saas-tests/table-mongodb-agent-e2e.test.ts b/backend/test/ava-tests/saas-tests/table-mongodb-agent-e2e.test.ts index d4b2a409..82e06d84 100644 --- a/backend/test/ava-tests/saas-tests/table-mongodb-agent-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/table-mongodb-agent-e2e.test.ts @@ -66,7 +66,7 @@ test.before(async () => { firstUserToken = (await registerUserAndReturnUserInfo(app)).token; connectionToTestDB = getTestData(mockFactory).mongoDbAgentConnection; - const createConnectionResponse = await request(app.getHttpServer()) + const _createConnectionResponse = await request(app.getHttpServer()) .post('/connection') .send(connectionToTestDB) .set('Cookie', firstUserToken) @@ -119,8 +119,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( const testTableIndex = getTablesRO.findIndex((t) => t.table === testTableName); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -208,21 +208,21 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); - t.is(getTableRowsRO.hasOwnProperty('large_dataset'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'large_dataset'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('_id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], '_id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -276,19 +276,19 @@ test.serial(`${currentTest} should return rows of selected table with search and const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(getTableRowsResponse.status, 201); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0]._id, searchedDescription); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -339,17 +339,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('_id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], '_id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, '_id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'string'); @@ -407,17 +407,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('_id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], '_id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, '_id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'string'); @@ -480,15 +480,15 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, '_id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'string'); @@ -552,15 +552,15 @@ should return all found rows with pagination page=1 perPage=3`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, '_id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'string'); @@ -622,9 +622,9 @@ should return all found rows with sorting ids by DESC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); // t.is(getTableRowsRO.rows[0]._id, 42); @@ -632,8 +632,8 @@ should return all found rows with sorting ids by DESC`, // t.is(getTableRowsRO.rows[41]._id, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -692,9 +692,9 @@ should return all found rows with sorting ids by ASC`, const searchedSecondId = insertedSearchedIds.find((id) => id.number === 1)._id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0]._id, searchedFirstId); @@ -702,8 +702,8 @@ should return all found rows with sorting ids by ASC`, t.is(getTableRowsRO.rows[41]._id, searchedLastId); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -763,17 +763,17 @@ should return all found rows with sorting ports by DESC and with pagination page const preSearchedLastId = insertedSearchedIds.find((id) => id.number === 0)._id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0]._id, preSearchedLastId); t.is(getTableRowsRO.rows[1]._id, searchedLastId); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -832,17 +832,17 @@ test.serial( const preSearchedSecondId = insertedSearchedIds.find((id) => id.number === 1)._id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0]._id, searchedFirstId); t.is(getTableRowsRO.rows[1]._id, preSearchedSecondId); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -901,17 +901,17 @@ test.serial( const searchedSecondId = insertedSearchedIds.find((id) => id.number === 4)._id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0]._id, searchedFirstId); t.is(getTableRowsRO.rows[1]._id, searchedSecondId); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -973,9 +973,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const searchedSecondId = insertedSearchedIds.find((id) => id.number === 21)._id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0]._id, searchedFirstId); @@ -984,8 +984,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1044,9 +1044,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const searchedFirstId = insertedSearchedIds.find((id) => id.number === 37)._id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0]._id, searchedFirstId); @@ -1054,8 +1054,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1116,9 +1116,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0]._id, searchedFirstId); @@ -1127,8 +1127,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1187,9 +1187,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const searchedFirstId = insertedSearchedIds.find((id) => id.number === 37)._id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0]._id, searchedFirstId); @@ -1197,8 +1197,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1263,9 +1263,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1277,8 +1277,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1343,9 +1343,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1359,8 +1359,8 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1427,9 +1427,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1442,8 +1442,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 3); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1674,8 +1674,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1707,26 +1707,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 6); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -1839,11 +1839,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -1857,9 +1857,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -1877,13 +1877,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('_id'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, '_id'), true); }); test.serial(`${currentTest} should throw an exception when connection id is not passed in request`, async (t) => { @@ -1924,9 +1924,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -1974,9 +1974,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2014,9 +2014,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2064,9 +2064,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2103,11 +2103,11 @@ test.serial(`${currentTest} should update row in table and return result`, async t.is(updateRowInTableResponse.status, 200); const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2121,9 +2121,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2435,7 +2435,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2447,9 +2447,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2488,9 +2488,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2531,9 +2531,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2574,9 +2574,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2617,9 +2617,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2659,9 +2659,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2703,9 +2703,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2760,11 +2760,11 @@ test.serial(`${currentTest} found row`, async (t) => { t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -2969,7 +2969,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2981,9 +2981,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3045,7 +3045,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3057,9 +3057,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(getTableRowsResponse.status, 200); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3239,7 +3239,7 @@ test.serial(`${currentTest} should import csv file with table data`, async (t) = // eslint-disable-next-line security/detect-non-literal-fs-filename const fileContent = fs.readFileSync(filePatch).toString(); const rows = fileContent.split('\n'); - const idColumnIndex = rows[0].split(',').findIndex((column) => column === '_id'); + const idColumnIndex = rows[0].split(',').indexOf('_id'); const newRows = rows.map((row) => { const columns = row.split(','); if (columns.length === 1) { diff --git a/backend/test/ava-tests/saas-tests/table-mongodb-e2e.test.ts b/backend/test/ava-tests/saas-tests/table-mongodb-e2e.test.ts index 4d753f98..77c91744 100644 --- a/backend/test/ava-tests/saas-tests/table-mongodb-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/table-mongodb-e2e.test.ts @@ -33,7 +33,7 @@ const __dirname = path.dirname(__filename); const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const testSearchedUserName = 'Vasia'; const testTables: Array = []; let currentTest; @@ -44,7 +44,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication() as any; - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -99,8 +99,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( const testTableIndex = getTablesRO.findIndex((t) => t.table === testTableName); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -205,21 +205,21 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); - t.is(getTableRowsRO.hasOwnProperty('large_dataset'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'large_dataset'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('_id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], '_id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -280,19 +280,19 @@ test.serial(`${currentTest} should return rows of selected table with search and const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0]._id, searchedDescription); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -349,17 +349,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('_id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], '_id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, '_id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'string'); @@ -423,17 +423,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('_id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], '_id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, '_id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'string'); @@ -502,15 +502,15 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, '_id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'string'); @@ -580,15 +580,15 @@ should return all found rows with pagination page=1 perPage=3`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, '_id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'string'); @@ -656,9 +656,9 @@ should return all found rows with sorting ids by DESC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); // t.is(getTableRowsRO.rows[0]._id, 42); @@ -666,8 +666,8 @@ should return all found rows with sorting ids by DESC`, // t.is(getTableRowsRO.rows[41]._id, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -732,9 +732,9 @@ should return all found rows with sorting ids by ASC`, const searchedSecondId = insertedSearchedIds.find((id) => id.number === 1)._id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0]._id, searchedFirstId); @@ -742,8 +742,8 @@ should return all found rows with sorting ids by ASC`, t.is(getTableRowsRO.rows[41]._id, searchedLastId); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -809,17 +809,17 @@ should return all found rows with sorting ports by DESC and with pagination page const preSearchedLastId = insertedSearchedIds.find((id) => id.number === 0)._id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0]._id, preSearchedLastId); t.is(getTableRowsRO.rows[1]._id, searchedLastId); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -884,17 +884,17 @@ test.serial( const preSearchedSecondId = insertedSearchedIds.find((id) => id.number === 1)._id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0]._id, searchedFirstId); t.is(getTableRowsRO.rows[1]._id, preSearchedSecondId); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -959,17 +959,17 @@ test.serial( const searchedSecondId = insertedSearchedIds.find((id) => id.number === 4)._id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0]._id, searchedFirstId); t.is(getTableRowsRO.rows[1]._id, searchedSecondId); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1037,9 +1037,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const searchedSecondId = insertedSearchedIds.find((id) => id.number === 21)._id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0]._id, searchedFirstId); @@ -1048,8 +1048,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1114,9 +1114,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const searchedFirstId = insertedSearchedIds.find((id) => id.number === 37)._id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0]._id, searchedFirstId); @@ -1124,8 +1124,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1192,9 +1192,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0]._id, searchedFirstId); @@ -1203,8 +1203,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1269,9 +1269,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const searchedFirstId = insertedSearchedIds.find((id) => id.number === 37)._id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0]._id, searchedFirstId); @@ -1279,8 +1279,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1351,9 +1351,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1365,8 +1365,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1437,9 +1437,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1453,8 +1453,8 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1527,9 +1527,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1542,8 +1542,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 3); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1798,8 +1798,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1838,26 +1838,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 6); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -2005,11 +2005,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2023,9 +2023,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2043,13 +2043,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('_id'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, '_id'), true); }); test.serial(`${currentTest} should throw an exception when connection id is not passed in request`, async (t) => { @@ -2097,9 +2097,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2154,9 +2154,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2201,9 +2201,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2258,9 +2258,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2304,11 +2304,11 @@ test.serial(`${currentTest} should update row in table and return result`, async t.is(updateRowInTableResponse.status, 200); const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2322,9 +2322,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2699,7 +2699,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2711,9 +2711,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2759,9 +2759,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2809,9 +2809,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2859,9 +2859,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2909,9 +2909,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2958,9 +2958,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3014,9 +3014,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3085,11 +3085,11 @@ test.serial(`${currentTest} found row`, async (t) => { t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3360,7 +3360,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3372,9 +3372,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3443,7 +3443,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3455,9 +3455,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(getTableRowsResponse.status, 200); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3663,7 +3663,7 @@ test.serial(`${currentTest} should import csv file with table data`, async (t) = // eslint-disable-next-line security/detect-non-literal-fs-filename const fileContent = fs.readFileSync(filePatch).toString(); const rows = fileContent.split('\n'); - const idColumnIndex = rows[0].split(',').findIndex((column) => column === '_id'); + const idColumnIndex = rows[0].split(',').indexOf('_id'); const newRows = rows.map((row) => { const columns = row.split(','); if (columns.length === 1) { diff --git a/backend/test/ava-tests/saas-tests/table-mssql-agent-e2e.test.ts b/backend/test/ava-tests/saas-tests/table-mssql-agent-e2e.test.ts index aa9c87b4..e2f6053f 100644 --- a/backend/test/ava-tests/saas-tests/table-mssql-agent-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/table-mssql-agent-e2e.test.ts @@ -19,9 +19,8 @@ import { getTestData } from '../../utils/get-test-data.js'; import { registerUserAndReturnUserInfo } from '../../utils/register-user-and-return-user-info.js'; import { TestUtils } from '../../utils/test.utils.js'; import knex from 'knex'; -import { getRandomConstraintName, getRandomTestTableName } from '../../utils/get-random-test-table-name.js'; +import { getRandomTestTableName } from '../../utils/get-random-test-table-name.js'; import { ERROR_MESSAGES } from '@rocketadmin/shared-code/dist/src/helpers/errors/error-messages.js'; -import { ErrorsMessages } from '../../../src/exceptions/custom-exceptions/messages/custom-errors-messages.js'; import { ValidationException } from '../../../src/exceptions/custom-exceptions/validation-exception.js'; import { ValidationError } from 'class-validator'; import fs from 'fs'; @@ -47,7 +46,7 @@ let connectionToTestDB: any; let testTableName = getRandomTestTableName(); let testTableColumnName = `${faker.lorem.words(1)}_${faker.lorem.words(1)}`; let testTableSecondColumnName = `${faker.lorem.words(1)}_${faker.lorem.words(1)}`; -const pColumnName = 'id'; +const _pColumnName = 'id'; test.before(async () => { const moduleFixture = await Test.createTestingModule({ @@ -69,7 +68,7 @@ test.before(async () => { app.getHttpServer().listen(0); firstUserToken = (await registerUserAndReturnUserInfo(app)).token; connectionToTestDB = getTestData(mockFactory).mssqlAgentConnection; - const createConnectionResponse = await request(app.getHttpServer()) + const _createConnectionResponse = await request(app.getHttpServer()) .post('/connection') .send(connectionToTestDB) .set('Cookie', firstUserToken) @@ -93,7 +92,7 @@ test('should run', (t) => { t.pass(); }); -test.beforeEach('restDatabase', async (t) => { +test.beforeEach('restDatabase', async (_t) => { const host = 'mssql-e2e-testing'; const port = 1433; const Knex = knex({ @@ -108,7 +107,7 @@ test.beforeEach('restDatabase', async (t) => { }); await Knex.schema.dropTableIfExists(testTableName); - await Knex.schema.createTable(testTableName, function (table) { + await Knex.schema.createTable(testTableName, (table) => { table.increments(); table.string(testTableColumnName); table.string(testTableSecondColumnName); @@ -168,8 +167,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( return t.table === testTableName; }); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -256,19 +255,19 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -323,18 +322,18 @@ test.serial(`${currentTest} should return rows of selected table with search and const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); - t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription)); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription, 10)); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -386,16 +385,16 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -454,16 +453,16 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -527,14 +526,14 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -598,14 +597,14 @@ should return all found rows with pagination page=1 perPage=3`, t.is(getTableRowsResponse.status, 200); const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -668,9 +667,9 @@ should return all found rows with sorting ids by DESC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); @@ -678,7 +677,7 @@ should return all found rows with sorting ids by DESC`, t.is(getTableRowsRO.rows[41].id, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -734,9 +733,9 @@ should return all found rows with sorting ids by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -744,7 +743,7 @@ should return all found rows with sorting ids by ASC`, t.is(getTableRowsRO.rows[41].id, 42); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -801,16 +800,16 @@ should return all found rows with sorting ports by DESC and with pagination page const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); t.is(getTableRowsRO.rows[1].id, 41); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -866,16 +865,16 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); t.is(getTableRowsRO.rows[1].id, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -931,16 +930,16 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 39); t.is(getTableRowsRO.rows[1].id, 38); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -999,9 +998,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1010,7 +1009,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1069,9 +1068,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1079,7 +1078,7 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1138,9 +1137,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1149,7 +1148,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1208,9 +1207,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1218,7 +1217,7 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1279,9 +1278,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1294,7 +1293,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1354,9 +1353,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1371,7 +1370,7 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1431,9 +1430,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1444,7 +1443,7 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1507,9 +1506,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1520,7 +1519,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1752,8 +1751,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1787,26 +1786,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 5); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); // t.is(element.hasOwnProperty('data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -1929,11 +1928,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -1947,9 +1946,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -1968,13 +1967,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'id'), true); t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, 43); }); @@ -2017,9 +2016,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2068,9 +2067,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2110,9 +2109,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2161,9 +2160,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2202,11 +2201,11 @@ test.serial(`${currentTest} should update row in table and return result`, async t.is(updateRowInTableResponse.status, 200); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2220,9 +2219,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2547,7 +2546,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); t.is(deleteRowInTableResponse.status, 200); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2559,9 +2558,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2602,9 +2601,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2647,9 +2646,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2692,9 +2691,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2737,9 +2736,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2781,9 +2780,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2827,9 +2826,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2889,11 +2888,11 @@ test.serial(`${currentTest} found row`, async (t) => { t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3114,7 +3113,7 @@ test.serial(`${currentTest} should delete rows in table and return result`, asyn .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3126,9 +3125,9 @@ test.serial(`${currentTest} should delete rows in table and return result`, asyn const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; diff --git a/backend/test/ava-tests/saas-tests/table-mssql-e2e.test.ts b/backend/test/ava-tests/saas-tests/table-mssql-e2e.test.ts index 5b863f31..678b7ff6 100644 --- a/backend/test/ava-tests/saas-tests/table-mssql-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/table-mssql-e2e.test.ts @@ -34,7 +34,7 @@ const __dirname = path.dirname(__filename); const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const testSearchedUserName = 'Vasia'; const testTables: Array = []; let currentTest; @@ -45,7 +45,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -103,8 +103,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( const testTableIndex = getTablesRO.findIndex((t) => t.table === testTableName); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -210,20 +210,20 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -284,19 +284,19 @@ test.serial(`${currentTest} should return rows of selected table with search and const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); - t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription)); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription, 10)); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -353,17 +353,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -427,17 +427,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -506,15 +506,15 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -584,15 +584,15 @@ should return all found rows with pagination page=1 perPage=3`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -660,9 +660,9 @@ should return all found rows with sorting ids by DESC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); @@ -670,8 +670,8 @@ should return all found rows with sorting ids by DESC`, t.is(getTableRowsRO.rows[41].id, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -732,9 +732,9 @@ should return all found rows with sorting ids by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -742,8 +742,8 @@ should return all found rows with sorting ids by ASC`, t.is(getTableRowsRO.rows[41].id, 42); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -805,17 +805,17 @@ should return all found rows with sorting ports by DESC and with pagination page const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); t.is(getTableRowsRO.rows[1].id, 41); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -876,17 +876,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); t.is(getTableRowsRO.rows[1].id, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -947,17 +947,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 39); t.is(getTableRowsRO.rows[1].id, 38); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1021,9 +1021,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1032,8 +1032,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1097,9 +1097,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1107,8 +1107,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1172,9 +1172,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1183,8 +1183,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1248,9 +1248,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1258,8 +1258,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1325,9 +1325,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1340,8 +1340,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1406,9 +1406,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1423,8 +1423,8 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1489,9 +1489,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1502,8 +1502,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1571,9 +1571,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1584,8 +1584,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1840,8 +1840,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1880,26 +1880,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 5); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -2047,11 +2047,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2065,9 +2065,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2086,13 +2086,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'id'), true); t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, 43); }); @@ -2141,9 +2141,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2198,9 +2198,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2245,9 +2245,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2302,9 +2302,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2348,11 +2348,11 @@ test.serial(`${currentTest} should update row in table and return result`, async t.is(updateRowInTableResponse.status, 200); const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2366,9 +2366,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2741,7 +2741,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2753,9 +2753,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2801,9 +2801,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2851,9 +2851,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2901,9 +2901,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2951,9 +2951,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3000,9 +3000,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3051,9 +3051,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3122,11 +3122,11 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3386,7 +3386,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3398,9 +3398,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; diff --git a/backend/test/ava-tests/saas-tests/table-mssql-schema-e2e.test.ts b/backend/test/ava-tests/saas-tests/table-mssql-schema-e2e.test.ts index 1338c7dd..4bc89f40 100644 --- a/backend/test/ava-tests/saas-tests/table-mssql-schema-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/table-mssql-schema-e2e.test.ts @@ -26,7 +26,7 @@ import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const testSearchedUserName = 'Vasia'; const testTables: Array = []; let currentTest; @@ -37,7 +37,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -58,7 +58,7 @@ test.after('Drop test tables', async () => { await dropTestTables(testTables, connectionToTestMSSQL); await Cacher.clearAllCache(); await app.close(); - } catch (e) {} + } catch (_e) {} }); currentTest = 'GET /connection/tables/:slug'; @@ -94,8 +94,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( const testTableIndex = getTablesRO.findIndex((t) => t.table === testTableName); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -201,20 +201,20 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -275,19 +275,19 @@ test.serial(`${currentTest} should return rows of selected table with search and const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); - t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription)); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription, 10)); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -344,17 +344,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -418,17 +418,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -497,15 +497,15 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -575,15 +575,15 @@ should return all found rows with pagination page=1 perPage=3`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -651,9 +651,9 @@ should return all found rows with sorting ids by DESC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); @@ -661,8 +661,8 @@ should return all found rows with sorting ids by DESC`, t.is(getTableRowsRO.rows[41].id, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -723,9 +723,9 @@ should return all found rows with sorting ids by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -733,8 +733,8 @@ should return all found rows with sorting ids by ASC`, t.is(getTableRowsRO.rows[41].id, 42); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -796,17 +796,17 @@ should return all found rows with sorting ports by DESC and with pagination page const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); t.is(getTableRowsRO.rows[1].id, 41); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -867,17 +867,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); t.is(getTableRowsRO.rows[1].id, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -938,17 +938,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 39); t.is(getTableRowsRO.rows[1].id, 38); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1012,9 +1012,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1023,8 +1023,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1088,9 +1088,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1098,8 +1098,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1163,9 +1163,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1174,8 +1174,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1239,9 +1239,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1249,8 +1249,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1316,9 +1316,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1331,8 +1331,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1397,9 +1397,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1414,8 +1414,8 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1480,9 +1480,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1493,8 +1493,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1562,9 +1562,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1575,8 +1575,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1831,8 +1831,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1871,26 +1871,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 5); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -2038,11 +2038,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2056,9 +2056,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2077,13 +2077,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'id'), true); t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, 43); }); @@ -2132,9 +2132,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2189,9 +2189,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2236,9 +2236,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2293,9 +2293,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2339,11 +2339,11 @@ test.serial(`${currentTest} should update row in table and return result`, async t.is(updateRowInTableResponse.status, 200); const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2357,9 +2357,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2732,7 +2732,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2744,9 +2744,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2792,9 +2792,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2842,9 +2842,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2892,9 +2892,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2942,9 +2942,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2991,9 +2991,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3042,9 +3042,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3113,11 +3113,11 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3377,7 +3377,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3389,9 +3389,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; diff --git a/backend/test/ava-tests/saas-tests/table-mysql-agent-e2e.test.ts b/backend/test/ava-tests/saas-tests/table-mysql-agent-e2e.test.ts index 570adf30..c5592868 100644 --- a/backend/test/ava-tests/saas-tests/table-mysql-agent-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/table-mysql-agent-e2e.test.ts @@ -21,7 +21,6 @@ import { TestUtils } from '../../utils/test.utils.js'; import knex from 'knex'; import { getRandomConstraintName, getRandomTestTableName } from '../../utils/get-random-test-table-name.js'; import { ERROR_MESSAGES } from '@rocketadmin/shared-code/dist/src/helpers/errors/error-messages.js'; -import { ErrorsMessages } from '../../../src/exceptions/custom-exceptions/messages/custom-errors-messages.js'; import { ValidationException } from '../../../src/exceptions/custom-exceptions/validation-exception.js'; import { ValidationError } from 'class-validator'; import fs from 'fs'; @@ -69,7 +68,7 @@ test.before(async () => { app.getHttpServer().listen(0); firstUserToken = (await registerUserAndReturnUserInfo(app)).token; connectionToTestDB = getTestData(mockFactory).mysqlAgentConnection; - const createConnectionResponse = await request(app.getHttpServer()) + const _createConnectionResponse = await request(app.getHttpServer()) .post('/connection') .send(connectionToTestDB) .set('Cookie', firstUserToken) @@ -89,7 +88,7 @@ test.after(async () => { currentTest = 'GET /connection/tables/:slug'; -test.beforeEach('restDatabase', async (t) => { +test.beforeEach('restDatabase', async (_t) => { const host = 'testMySQL-e2e-testing'; const port = 3306; const Knex = knex({ @@ -104,14 +103,14 @@ test.beforeEach('restDatabase', async (t) => { }); await Knex.schema.dropTableIfExists(testTableName); - await Knex.schema.createTable(testTableName, function (table) { + await Knex.schema.createTable(testTableName, (table) => { table.integer(pColumnName); table.string(testTableColumnName); table.string(testTableSecondColumnName); table.timestamps(); }); const primaryKeyConstraintName = getRandomConstraintName(); - await Knex.schema.alterTable(testTableName, function (t) { + await Knex.schema.alterTable(testTableName, (t) => { t.primary([pColumnName], primaryKeyConstraintName); }); let counter = 0; @@ -164,8 +163,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( return t.table === testTableName; }); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -252,19 +251,19 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -319,18 +318,18 @@ test.serial(`${currentTest} should return rows of selected table with search and const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); - t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription)); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription, 10)); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -382,16 +381,16 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -450,16 +449,16 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -523,14 +522,14 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -594,14 +593,14 @@ should return all found rows with pagination page=1 perPage=3`, t.is(getTableRowsResponse.status, 200); const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -664,9 +663,9 @@ should return all found rows with sorting ids by DESC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); @@ -674,7 +673,7 @@ should return all found rows with sorting ids by DESC`, t.is(getTableRowsRO.rows[41].id, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -730,9 +729,9 @@ should return all found rows with sorting ids by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -740,7 +739,7 @@ should return all found rows with sorting ids by ASC`, t.is(getTableRowsRO.rows[41].id, 42); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -797,16 +796,16 @@ should return all found rows with sorting ports by DESC and with pagination page const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); t.is(getTableRowsRO.rows[1].id, 41); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -862,16 +861,16 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); t.is(getTableRowsRO.rows[1].id, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -927,16 +926,16 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 39); t.is(getTableRowsRO.rows[1].id, 38); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -995,9 +994,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1006,7 +1005,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1065,9 +1064,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1075,7 +1074,7 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1134,9 +1133,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1145,7 +1144,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1204,9 +1203,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1214,7 +1213,7 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1275,9 +1274,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1290,7 +1289,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1350,9 +1349,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1367,7 +1366,7 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1427,9 +1426,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1440,7 +1439,7 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1503,9 +1502,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1516,7 +1515,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1748,8 +1747,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1783,26 +1782,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 5); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); // t.is(element.hasOwnProperty('data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -1926,11 +1925,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -1944,9 +1943,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -1965,13 +1964,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'id'), true); t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, 43); }); @@ -2015,9 +2014,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2067,9 +2066,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2109,9 +2108,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2161,9 +2160,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2202,11 +2201,11 @@ test.serial(`${currentTest} should update row in table and return result`, async t.is(updateRowInTableResponse.status, 200); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2220,9 +2219,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2548,7 +2547,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); t.is(deleteRowInTableResponse.status, 200); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2560,9 +2559,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2603,9 +2602,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2648,9 +2647,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2693,9 +2692,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2738,9 +2737,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2782,9 +2781,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2828,9 +2827,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2890,11 +2889,11 @@ test.serial(`${currentTest} found row`, async (t) => { t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3116,7 +3115,7 @@ test.serial(`${currentTest} should delete rows in table and return result`, asyn .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3128,9 +3127,9 @@ test.serial(`${currentTest} should delete rows in table and return result`, asyn const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3292,7 +3291,7 @@ test.serial(`${currentTest} should import csv file with table data`, async (t) = .set('Cookie', firstUserToken) .set('Accept', 'application/json'); - const importCsvResponseRO = JSON.parse(importCsvResponse.text); + const _importCsvResponseRO = JSON.parse(importCsvResponse.text); t.is(importCsvResponse.status, 201); //checking that the lines was added diff --git a/backend/test/ava-tests/saas-tests/table-mysql-e2e.test.ts b/backend/test/ava-tests/saas-tests/table-mysql-e2e.test.ts index 224748cc..3a995f99 100644 --- a/backend/test/ava-tests/saas-tests/table-mysql-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/table-mysql-e2e.test.ts @@ -34,7 +34,7 @@ const __dirname = path.dirname(__filename); const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const testSearchedUserName = 'Vasia'; const testTables: Array = []; let currentTest; @@ -45,7 +45,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -103,8 +103,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( const testTableIndex = getTablesRO.findIndex((t) => t.table === testTableName); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -209,20 +209,20 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -282,19 +282,19 @@ test.serial(`${currentTest} should return rows of selected table with search and const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); - t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription)); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription, 10)); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -351,17 +351,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -425,17 +425,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -504,15 +504,15 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -582,15 +582,15 @@ should return all found rows with pagination page=1 perPage=3`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -658,9 +658,9 @@ should return all found rows with sorting ids by DESC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); @@ -668,8 +668,8 @@ should return all found rows with sorting ids by DESC`, t.is(getTableRowsRO.rows[41].id, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -730,9 +730,9 @@ should return all found rows with sorting ids by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -740,8 +740,8 @@ should return all found rows with sorting ids by ASC`, t.is(getTableRowsRO.rows[41].id, 42); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -803,17 +803,17 @@ should return all found rows with sorting ports by DESC and with pagination page const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); t.is(getTableRowsRO.rows[1].id, 41); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -874,17 +874,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); t.is(getTableRowsRO.rows[1].id, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -945,17 +945,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 39); t.is(getTableRowsRO.rows[1].id, 38); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1019,9 +1019,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1030,8 +1030,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1095,9 +1095,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1105,8 +1105,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1170,9 +1170,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1181,8 +1181,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1246,9 +1246,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1256,8 +1256,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1323,9 +1323,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1338,8 +1338,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1404,9 +1404,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1421,8 +1421,8 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1487,9 +1487,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1500,8 +1500,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1569,9 +1569,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1582,8 +1582,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1838,8 +1838,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1878,26 +1878,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 5); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -2046,11 +2046,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2064,9 +2064,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2085,13 +2085,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'id'), true); t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, 43); }); @@ -2140,9 +2140,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2197,9 +2197,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2244,9 +2244,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2301,9 +2301,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2347,11 +2347,11 @@ test.serial(`${currentTest} should update row in table and return result`, async t.is(updateRowInTableResponse.status, 200); const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2365,9 +2365,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2740,7 +2740,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2752,9 +2752,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2800,9 +2800,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2850,9 +2850,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2900,9 +2900,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2950,9 +2950,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2999,9 +2999,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3050,9 +3050,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3121,11 +3121,11 @@ test.serial(`${currentTest} found row`, async (t) => { t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3385,7 +3385,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3397,9 +3397,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3642,7 +3642,7 @@ test.serial(`${currentTest} should import csv file with table data`, async (t) = .set('Cookie', firstUserToken) .set('Accept', 'application/json'); - const importCsvResponseRO = JSON.parse(importCsvResponse.text); + const _importCsvResponseRO = JSON.parse(importCsvResponse.text); t.is(importCsvResponse.status, 201); //checking that the lines was added diff --git a/backend/test/ava-tests/saas-tests/table-oracle-agent-e2e.test.ts b/backend/test/ava-tests/saas-tests/table-oracle-agent-e2e.test.ts index bf8f1dcb..78d2fd7b 100644 --- a/backend/test/ava-tests/saas-tests/table-oracle-agent-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/table-oracle-agent-e2e.test.ts @@ -21,7 +21,6 @@ import { TestUtils } from '../../utils/test.utils.js'; import knex from 'knex'; import { getRandomConstraintName, getRandomTestTableName } from '../../utils/get-random-test-table-name.js'; import { ERROR_MESSAGES } from '@rocketadmin/shared-code/dist/src/helpers/errors/error-messages.js'; -import { ErrorsMessages } from '../../../src/exceptions/custom-exceptions/messages/custom-errors-messages.js'; import { ValidationException } from '../../../src/exceptions/custom-exceptions/validation-exception.js'; import { ValidationError } from 'class-validator'; import fs from 'fs'; @@ -69,7 +68,7 @@ test.before(async () => { app.getHttpServer().listen(0); firstUserToken = (await registerUserAndReturnUserInfo(app)).token; connectionToTestDB = getTestData(mockFactory).oracleAgentConnection; - const createConnectionResponse = await request(app.getHttpServer()) + const _createConnectionResponse = await request(app.getHttpServer()) .post('/connection') .send(connectionToTestDB) .set('Cookie', firstUserToken) @@ -89,7 +88,7 @@ test.after(async () => { currentTest = 'GET /connection/tables/:slug'; -test.beforeEach('restDatabase', async (t) => { +test.beforeEach('restDatabase', async (_t) => { const host = 'test-oracle-e2e-testing'; const port = 1521; const sid = 'XE'; @@ -104,14 +103,14 @@ test.beforeEach('restDatabase', async (t) => { }); await Knex.schema.dropTableIfExists(testTableName); - await Knex.schema.createTable(testTableName, function (table) { + await Knex.schema.createTable(testTableName, (table) => { table.integer(pColumnName); table.string(testTableColumnName); table.string(testTableSecondColumnName); table.timestamps(); }); const primaryKeyConstraintName = getRandomConstraintName(); - await Knex.schema.alterTable(testTableName, function (t) { + await Knex.schema.alterTable(testTableName, (t) => { t.primary([pColumnName], primaryKeyConstraintName); }); let counter = 0; @@ -164,8 +163,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( return t.table === testTableName; }); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -252,19 +251,19 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -319,18 +318,18 @@ test.serial(`${currentTest} should return rows of selected table with search and const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); - t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription)); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription, 10)); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -382,16 +381,16 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -450,16 +449,16 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -523,14 +522,14 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -594,14 +593,14 @@ should return all found rows with pagination page=1 perPage=3`, t.is(getTableRowsResponse.status, 200); const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -664,9 +663,9 @@ should return all found rows with sorting ids by DESC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); @@ -674,7 +673,7 @@ should return all found rows with sorting ids by DESC`, t.is(getTableRowsRO.rows[41].id, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -730,9 +729,9 @@ should return all found rows with sorting ids by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -740,7 +739,7 @@ should return all found rows with sorting ids by ASC`, t.is(getTableRowsRO.rows[41].id, 42); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -797,16 +796,16 @@ should return all found rows with sorting ports by DESC and with pagination page const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); t.is(getTableRowsRO.rows[1].id, 41); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -862,16 +861,16 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); t.is(getTableRowsRO.rows[1].id, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -927,16 +926,16 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 39); t.is(getTableRowsRO.rows[1].id, 38); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -995,9 +994,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1006,7 +1005,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1065,9 +1064,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1075,7 +1074,7 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1134,9 +1133,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1145,7 +1144,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1204,9 +1203,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1214,7 +1213,7 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1275,9 +1274,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1290,7 +1289,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1350,9 +1349,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1367,7 +1366,7 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1427,9 +1426,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1440,7 +1439,7 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1503,9 +1502,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1516,7 +1515,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1748,8 +1747,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1783,26 +1782,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 5); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); // t.is(element.hasOwnProperty('data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -1926,11 +1925,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -1944,9 +1943,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -1965,13 +1964,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'id'), true); t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, String(43)); }); @@ -2015,9 +2014,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2067,9 +2066,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2109,9 +2108,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2161,9 +2160,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2202,11 +2201,11 @@ test.serial(`${currentTest} should update row in table and return result`, async t.is(updateRowInTableResponse.status, 200); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2220,9 +2219,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2548,7 +2547,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); t.is(deleteRowInTableResponse.status, 200); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2560,9 +2559,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2603,9 +2602,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2648,9 +2647,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2693,9 +2692,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2738,9 +2737,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2782,9 +2781,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2828,9 +2827,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2890,11 +2889,11 @@ test.serial(`${currentTest} found row`, async (t) => { t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3116,7 +3115,7 @@ test.serial(`${currentTest} should delete rows in table and return result`, asyn .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3128,9 +3127,9 @@ test.serial(`${currentTest} should delete rows in table and return result`, asyn const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; diff --git a/backend/test/ava-tests/saas-tests/table-oracledb-e2e.test.ts b/backend/test/ava-tests/saas-tests/table-oracledb-e2e.test.ts index eef53c5c..70983077 100644 --- a/backend/test/ava-tests/saas-tests/table-oracledb-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/table-oracledb-e2e.test.ts @@ -33,7 +33,7 @@ const __dirname = path.dirname(__filename); const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const testSearchedUserName = 'Vasia'; const testTables: Array = []; let currentTest; @@ -44,7 +44,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -103,8 +103,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( return t.table === testTableName; }); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -210,19 +210,19 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -271,7 +271,7 @@ test.serial(`${currentTest} should return rows of selected table with search and .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const createTableSettingsRO = JSON.parse(createTableSettingsResponse.text); + const _createTableSettingsRO = JSON.parse(createTableSettingsResponse.text); t.is(createTableSettingsResponse.status, 201); const searchedDescription = '25'; @@ -286,18 +286,18 @@ test.serial(`${currentTest} should return rows of selected table with search and t.is(getTableRowsResponse.status, 200); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); - t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription)); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription, 10)); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -355,16 +355,16 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -429,16 +429,16 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -508,14 +508,14 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -585,14 +585,14 @@ should return all found rows with pagination page=1 perPage=3`, t.is(getTableRowsResponse.status, 200); const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -661,9 +661,9 @@ should return all found rows with sorting ids by DESC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); @@ -671,7 +671,7 @@ should return all found rows with sorting ids by DESC`, t.is(getTableRowsRO.rows[41].id, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -733,9 +733,9 @@ should return all found rows with sorting ids by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -743,7 +743,7 @@ should return all found rows with sorting ids by ASC`, t.is(getTableRowsRO.rows[41].id, 42); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -806,16 +806,16 @@ should return all found rows with sorting ports by DESC and with pagination page const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); t.is(getTableRowsRO.rows[1].id, 41); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -877,16 +877,16 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); t.is(getTableRowsRO.rows[1].id, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -948,16 +948,16 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 39); t.is(getTableRowsRO.rows[1].id, 38); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1022,9 +1022,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1033,7 +1033,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1098,9 +1098,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1108,7 +1108,7 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1173,9 +1173,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1184,7 +1184,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1249,9 +1249,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1259,7 +1259,7 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1326,9 +1326,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1340,7 +1340,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.currentPage, 1); t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { @@ -1370,7 +1370,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const createConnectionRO = JSON.parse(createConnectionResponse.text); t.is(createConnectionResponse.status, 201); - const createTableSettingsDTO = mockFactory.generateTableSettings( + const _createTableSettingsDTO = mockFactory.generateTableSettings( createConnectionRO.id, testTableName, [testTableColumnName], @@ -1387,7 +1387,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC ); const firstFieldName = 'created_at'; - const secondFieldName = 'updated_at'; + const _secondFieldName = 'updated_at'; const firstFieldValue = '2011-11-03'; const filters = { @@ -1404,9 +1404,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(getTableRowsResponse.status, 201); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1418,7 +1418,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.currentPage, 1); t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { @@ -1485,9 +1485,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1502,7 +1502,7 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1568,9 +1568,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1581,7 +1581,7 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1650,9 +1650,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1663,7 +1663,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1919,8 +1919,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1959,26 +1959,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 5); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); // t.is(element.hasOwnProperty('data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -2127,11 +2127,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2145,9 +2145,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2166,13 +2166,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'id'), true); // t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, 43); }); @@ -2213,11 +2213,11 @@ test.serial(`${currentTest} should add row in table with date column and return const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2231,9 +2231,9 @@ test.serial(`${currentTest} should add row in table with date column and return const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2252,13 +2252,13 @@ test.serial(`${currentTest} should add row in table with date column and return t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'id'), true); // t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, 44); }); @@ -2279,8 +2279,8 @@ test.serial(`${currentTest} should add row in table with with different data`, a const createConnectionRO = JSON.parse(createConnectionResponse.text); t.is(createConnectionResponse.status, 201); - const fakeName = faker.person.firstName(); - const fakeMail = faker.internet.email(); + const _fakeName = faker.person.firstName(); + const _fakeMail = faker.internet.email(); const row = { first_name: 'sdfdf', @@ -2305,11 +2305,11 @@ test.serial(`${currentTest} should add row in table with with different data`, a console.log('🚀 ~ addRowInTableRO:', addRowInTableRO); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); }); test.serial(`${currentTest} should throw an exception when connection id is not passed in request`, async (t) => { @@ -2357,9 +2357,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2414,9 +2414,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2461,9 +2461,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2518,9 +2518,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2564,11 +2564,11 @@ test.serial(`${currentTest} should update row in table and return result`, async t.is(updateRowInTableResponse.status, 200); const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2582,9 +2582,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2957,7 +2957,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2969,9 +2969,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3017,9 +3017,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3067,9 +3067,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3117,9 +3117,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3167,9 +3167,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3216,9 +3216,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3267,9 +3267,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3338,11 +3338,11 @@ test.serial(`${currentTest} found row`, async (t) => { const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); t.is(foundRowInTableResponse.status, 200); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3602,7 +3602,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3614,9 +3614,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; diff --git a/backend/test/ava-tests/saas-tests/table-oracledb-schema-e2e.test.ts b/backend/test/ava-tests/saas-tests/table-oracledb-schema-e2e.test.ts index 83d6ebd8..c7a23d6a 100644 --- a/backend/test/ava-tests/saas-tests/table-oracledb-schema-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/table-oracledb-schema-e2e.test.ts @@ -26,7 +26,7 @@ import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const testSearchedUserName = 'Vasia'; const testTables: Array = []; let currentTest; @@ -37,7 +37,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication() as any; - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -97,8 +97,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( return t.table === testTableName; }); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -204,19 +204,19 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -278,18 +278,18 @@ test.serial(`${currentTest} should return rows of selected table with search and const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); - t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription)); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription, 10)); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -347,16 +347,16 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -421,16 +421,16 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -500,14 +500,14 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -577,14 +577,14 @@ should return all found rows with pagination page=1 perPage=3`, t.is(getTableRowsResponse.status, 200); const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -653,9 +653,9 @@ should return all found rows with sorting ids by DESC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); @@ -663,7 +663,7 @@ should return all found rows with sorting ids by DESC`, t.is(getTableRowsRO.rows[41].id, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -725,9 +725,9 @@ should return all found rows with sorting ids by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -735,7 +735,7 @@ should return all found rows with sorting ids by ASC`, t.is(getTableRowsRO.rows[41].id, 42); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -798,16 +798,16 @@ should return all found rows with sorting ports by DESC and with pagination page const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); t.is(getTableRowsRO.rows[1].id, 41); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -869,16 +869,16 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); t.is(getTableRowsRO.rows[1].id, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -940,16 +940,16 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 39); t.is(getTableRowsRO.rows[1].id, 38); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1014,9 +1014,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1025,7 +1025,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1090,9 +1090,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1100,7 +1100,7 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1165,9 +1165,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1176,7 +1176,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1241,9 +1241,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1251,7 +1251,7 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1318,9 +1318,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1333,7 +1333,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1399,9 +1399,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1416,7 +1416,7 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1482,9 +1482,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1495,7 +1495,7 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1564,9 +1564,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1577,7 +1577,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1833,8 +1833,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1873,26 +1873,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 5); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); // t.is(element.hasOwnProperty('data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -2041,11 +2041,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2059,9 +2059,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2080,13 +2080,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'id'), true); t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, String(43)); }); @@ -2135,9 +2135,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2192,9 +2192,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2239,9 +2239,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2296,9 +2296,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2342,11 +2342,11 @@ test.serial(`${currentTest} should update row in table and return result`, async t.is(updateRowInTableResponse.status, 200); const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2360,9 +2360,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2735,7 +2735,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2747,9 +2747,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2795,9 +2795,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2845,9 +2845,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2895,9 +2895,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2945,9 +2945,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2994,9 +2994,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3045,9 +3045,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3116,11 +3116,11 @@ test.serial(`${currentTest} found row`, async (t) => { t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3380,7 +3380,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3392,9 +3392,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; diff --git a/backend/test/ava-tests/saas-tests/table-postgres-agent-e2e.test.ts b/backend/test/ava-tests/saas-tests/table-postgres-agent-e2e.test.ts index d564d1ab..44a5cb38 100644 --- a/backend/test/ava-tests/saas-tests/table-postgres-agent-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/table-postgres-agent-e2e.test.ts @@ -21,7 +21,6 @@ import { TestUtils } from '../../utils/test.utils.js'; import knex from 'knex'; import { getRandomConstraintName, getRandomTestTableName } from '../../utils/get-random-test-table-name.js'; import { ERROR_MESSAGES } from '@rocketadmin/shared-code/dist/src/helpers/errors/error-messages.js'; -import { ErrorsMessages } from '../../../src/exceptions/custom-exceptions/messages/custom-errors-messages.js'; import { ValidationException } from '../../../src/exceptions/custom-exceptions/validation-exception.js'; import { ValidationError } from 'class-validator'; import fs from 'fs'; @@ -69,7 +68,7 @@ test.before(async () => { app.getHttpServer().listen(0); firstUserToken = (await registerUserAndReturnUserInfo(app)).token; connectionToTestDB = getTestData(mockFactory).postgresAgentConnection; - const createConnectionResponse = await request(app.getHttpServer()) + const _createConnectionResponse = await request(app.getHttpServer()) .post('/connection') .send(connectionToTestDB) .set('Cookie', firstUserToken) @@ -89,7 +88,7 @@ test.after(async () => { currentTest = 'GET /connection/tables/:slug'; -test.beforeEach('restDatabase', async (t) => { +test.beforeEach('restDatabase', async (_t) => { const host = 'testPg-e2e-testing'; const port = 5432; const Knex = knex({ @@ -104,14 +103,14 @@ test.beforeEach('restDatabase', async (t) => { }); await Knex.schema.dropTableIfExists(testTableName); - await Knex.schema.createTable(testTableName, function (table) { + await Knex.schema.createTable(testTableName, (table) => { table.integer(pColumnName); table.string(testTableColumnName); table.string(testTableSecondColumnName); table.timestamps(); }); const primaryKeyConstraintName = getRandomConstraintName(); - await Knex.schema.alterTable(testTableName, function (t) { + await Knex.schema.alterTable(testTableName, (t) => { t.primary([pColumnName], primaryKeyConstraintName); }); let counter = 0; @@ -164,8 +163,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( return t.table === testTableName; }); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -252,19 +251,19 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -319,18 +318,18 @@ test.serial(`${currentTest} should return rows of selected table with search and const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); - t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription)); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription, 10)); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -382,16 +381,16 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -450,16 +449,16 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -523,14 +522,14 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -594,14 +593,14 @@ should return all found rows with pagination page=1 perPage=3`, t.is(getTableRowsResponse.status, 200); const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); // t.is(getTableRowsRO.primaryColumns[0].data_type, 'int'); @@ -664,9 +663,9 @@ should return all found rows with sorting ids by DESC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); @@ -674,7 +673,7 @@ should return all found rows with sorting ids by DESC`, t.is(getTableRowsRO.rows[41].id, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -730,9 +729,9 @@ should return all found rows with sorting ids by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -740,7 +739,7 @@ should return all found rows with sorting ids by ASC`, t.is(getTableRowsRO.rows[41].id, 42); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -797,16 +796,16 @@ should return all found rows with sorting ports by DESC and with pagination page const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); t.is(getTableRowsRO.rows[1].id, 41); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -862,16 +861,16 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); t.is(getTableRowsRO.rows[1].id, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -927,16 +926,16 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 39); t.is(getTableRowsRO.rows[1].id, 38); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -995,9 +994,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1006,7 +1005,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1065,9 +1064,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1075,7 +1074,7 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1134,9 +1133,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1145,7 +1144,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1204,9 +1203,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1214,7 +1213,7 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1275,9 +1274,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1290,7 +1289,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1350,9 +1349,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1367,7 +1366,7 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1427,9 +1426,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1440,7 +1439,7 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1503,9 +1502,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1516,7 +1515,7 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); // t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); } catch (e) { console.error(e); @@ -1748,8 +1747,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1783,26 +1782,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 5); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); // t.is(element.hasOwnProperty('data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -1926,11 +1925,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -1944,9 +1943,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -1965,13 +1964,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'id'), true); t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, 43); }); @@ -2015,9 +2014,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2067,9 +2066,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2109,9 +2108,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2161,9 +2160,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2202,11 +2201,11 @@ test.serial(`${currentTest} should update row in table and return result`, async t.is(updateRowInTableResponse.status, 200); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2220,9 +2219,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2548,7 +2547,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); t.is(deleteRowInTableResponse.status, 200); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2560,9 +2559,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2603,9 +2602,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2648,9 +2647,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2693,9 +2692,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2738,9 +2737,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2782,9 +2781,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2828,9 +2827,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2890,11 +2889,11 @@ test.serial(`${currentTest} found row`, async (t) => { t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3115,7 +3114,7 @@ test.serial(`${currentTest} should delete rows in table and return result`, asyn .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3127,9 +3126,9 @@ test.serial(`${currentTest} should delete rows in table and return result`, asyn const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; diff --git a/backend/test/ava-tests/saas-tests/table-postgres-e2e.test.ts b/backend/test/ava-tests/saas-tests/table-postgres-e2e.test.ts index 0b5aae61..3bd83e40 100644 --- a/backend/test/ava-tests/saas-tests/table-postgres-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/table-postgres-e2e.test.ts @@ -35,7 +35,7 @@ const __dirname = path.dirname(__filename); const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const testSearchedUserName = 'Vasia'; const testTables: Array = []; let currentTest; @@ -46,7 +46,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication() as any; - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -101,8 +101,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( const testTableIndex = getTablesRO.findIndex((t) => t.table === testTableName); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -207,21 +207,21 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); - t.is(getTableRowsRO.hasOwnProperty('large_dataset'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'large_dataset'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -268,10 +268,10 @@ test.serial(`${currentTest} should return rows of selected table with generated console.log('🚀 ~ getTableRowsRO:', getTableRowsRO); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); - t.is(getTableRowsRO.hasOwnProperty('large_dataset'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'large_dataset'), true); } catch (e) { console.error(e); throw e; @@ -331,19 +331,19 @@ test.serial(`${currentTest} should return rows of selected table with search and const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); - t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription)); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription, 10)); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -400,17 +400,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'integer'); @@ -474,17 +474,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'integer'); @@ -553,15 +553,15 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'integer'); @@ -631,15 +631,15 @@ should return all found rows with pagination page=1 perPage=3`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'integer'); @@ -707,9 +707,9 @@ should return all found rows with sorting ids by DESC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); @@ -717,8 +717,8 @@ should return all found rows with sorting ids by DESC`, t.is(getTableRowsRO.rows[41].id, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -779,9 +779,9 @@ should return all found rows with sorting ids by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -789,8 +789,8 @@ should return all found rows with sorting ids by ASC`, t.is(getTableRowsRO.rows[41].id, 42); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -852,17 +852,17 @@ should return all found rows with sorting ports by DESC and with pagination page const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); t.is(getTableRowsRO.rows[1].id, 41); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -923,17 +923,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); t.is(getTableRowsRO.rows[1].id, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -994,17 +994,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 39); t.is(getTableRowsRO.rows[1].id, 38); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1068,9 +1068,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1079,8 +1079,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1144,9 +1144,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1154,8 +1154,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1219,9 +1219,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1230,8 +1230,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1295,9 +1295,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1305,8 +1305,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1371,9 +1371,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1386,8 +1386,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1458,9 +1458,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1473,8 +1473,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1539,9 +1539,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1556,8 +1556,8 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1622,9 +1622,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1635,8 +1635,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1704,9 +1704,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1717,8 +1717,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1972,8 +1972,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -2012,26 +2012,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 5); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -2180,11 +2180,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2198,9 +2198,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2220,13 +2220,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); console.log('🚀 ~ test.serial ~ getLogsRO:', getLogsRO.logs[1].affected_primary_key); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'id'), true); t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, 43); }); @@ -2275,9 +2275,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2332,9 +2332,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2379,9 +2379,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2437,9 +2437,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2483,11 +2483,11 @@ test.serial(`${currentTest} should update row in table and return result`, async t.is(updateRowInTableResponse.status, 200); const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2501,9 +2501,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2536,7 +2536,7 @@ test.serial(`${currentTest} should update row in table and return result, when t const row = { [testTableColumnName]: fakeName, [testTableSecondColumnName]: fakeMail, - ['json_field']: [ + "json_field": [ { id: 'PgSAwanAwptE', url: 'www.example.com', @@ -2549,7 +2549,7 @@ test.serial(`${currentTest} should update row in table and return result, when t description: 'some test field', }, ], - ['jsonb_field']: [ + "jsonb_field": [ { id: 'PgSAwanAwptE', url: 'www.example.com', @@ -2573,11 +2573,11 @@ test.serial(`${currentTest} should update row in table and return result, when t const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); t.is(updateRowInTableResponse.status, 200); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2591,9 +2591,9 @@ test.serial(`${currentTest} should update row in table and return result, when t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2606,7 +2606,7 @@ test.serial(`${currentTest} should update row in table and return result, when t const newRow = { [testTableColumnName]: faker.person.firstName(), [testTableSecondColumnName]: faker.internet.email(), - ['json_field']: { + "json_field": { id: 'newRowId', url: 'www.newrow.com', name: 'new row', @@ -2627,15 +2627,15 @@ test.serial(`${currentTest} should update row in table and return result, when t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(typeof addRowInTableRO.row['json_field'], 'object'); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(typeof addRowInTableRO.row.json_field, 'object'); // update the added row const updatedNewRow = { [testTableColumnName]: faker.person.firstName(), [testTableSecondColumnName]: faker.internet.email(), - ['json_field']: [ + "json_field": [ { id: 'updatedNewRowId', url: 'www.updatednewrow.com', @@ -2659,16 +2659,16 @@ test.serial(`${currentTest} should update row in table and return result, when t const updateNewRowInTableRO = JSON.parse(updateNewRowInTableResponse.text); t.is(updateNewRowInTableResponse.status, 200); - t.is(updateNewRowInTableRO.hasOwnProperty('row'), true); - t.is(updateNewRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateNewRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateNewRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateNewRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateNewRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateNewRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateNewRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateNewRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateNewRowInTableRO, 'readonly_fields'), true); t.is(updateNewRowInTableRO.row[testTableColumnName], updatedNewRow[testTableColumnName]); t.is(updateNewRowInTableRO.row[testTableSecondColumnName], updatedNewRow[testTableSecondColumnName]); - t.is(typeof updateNewRowInTableRO.row['json_field'], 'object'); - t.is(Array.isArray(updateNewRowInTableRO.row['json_field']), true); - t.is(updateNewRowInTableRO.row['json_field'][0].id, 'updatedNewRowId'); + t.is(typeof updateNewRowInTableRO.row.json_field, 'object'); + t.is(Array.isArray(updateNewRowInTableRO.row.json_field), true); + t.is(updateNewRowInTableRO.row.json_field[0].id, 'updatedNewRowId'); }); test.serial(`${currentTest} should throw an exception when connection id not passed in request`, async (t) => { @@ -3034,7 +3034,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3046,9 +3046,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3094,9 +3094,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3144,9 +3144,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3194,9 +3194,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3244,9 +3244,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3293,9 +3293,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3344,9 +3344,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3415,11 +3415,11 @@ test.serial(`${currentTest} found row`, async (t) => { t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3680,7 +3680,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3692,9 +3692,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3763,7 +3763,7 @@ test.serial(`${currentTest} should delete rows in table and return result`, asyn .set('Accept', 'application/json'); t.is(deleteRowInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3775,9 +3775,9 @@ test.serial(`${currentTest} should delete rows in table and return result`, asyn const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(getTableRowsResponse.status, 200); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; diff --git a/backend/test/ava-tests/saas-tests/table-postgres-encrypted-e2e.test.ts b/backend/test/ava-tests/saas-tests/table-postgres-encrypted-e2e.test.ts index d99c7965..3fcb981f 100644 --- a/backend/test/ava-tests/saas-tests/table-postgres-encrypted-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/table-postgres-encrypted-e2e.test.ts @@ -26,7 +26,7 @@ import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const testSearchedUserName = 'Vasia'; const testTables: Array = []; let currentTest; @@ -38,7 +38,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -98,8 +98,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( const testTableIndex = getTablesRO.findIndex((t) => t.table === testTableName); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -245,20 +245,20 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -321,19 +321,19 @@ test.serial(`${currentTest} should return rows of selected table with search and const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); - t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription)); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription, 10)); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -393,17 +393,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'integer'); @@ -470,17 +470,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'integer'); @@ -552,15 +552,15 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'integer'); @@ -633,15 +633,15 @@ should return all found rows with pagination page=1 perPage=3`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'integer'); @@ -712,9 +712,9 @@ should return all found rows with sorting ids by DESC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); @@ -722,8 +722,8 @@ should return all found rows with sorting ids by DESC`, t.is(getTableRowsRO.rows[41].id, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -787,9 +787,9 @@ should return all found rows with sorting ids by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -797,8 +797,8 @@ should return all found rows with sorting ids by ASC`, t.is(getTableRowsRO.rows[41].id, 42); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -863,17 +863,17 @@ should return all found rows with sorting ports by DESC and with pagination page const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); t.is(getTableRowsRO.rows[1].id, 41); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -937,17 +937,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); t.is(getTableRowsRO.rows[1].id, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1011,17 +1011,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 39); t.is(getTableRowsRO.rows[1].id, 38); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1088,9 +1088,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1099,8 +1099,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1167,9 +1167,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1177,8 +1177,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1245,9 +1245,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1256,8 +1256,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1324,9 +1324,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1334,8 +1334,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1404,9 +1404,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1419,8 +1419,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1488,9 +1488,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1505,8 +1505,8 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1574,9 +1574,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1587,8 +1587,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1659,9 +1659,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1672,8 +1672,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1941,8 +1941,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1983,26 +1983,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 5); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -2160,11 +2160,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2179,9 +2179,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2200,13 +2200,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'id'), true); t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, 43); }); @@ -2258,9 +2258,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2318,9 +2318,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2368,9 +2368,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2429,9 +2429,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2477,11 +2477,11 @@ test.serial(`${currentTest} should update row in table and return result`, async t.is(updateRowInTableResponse.status, 200); const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2496,9 +2496,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2821,7 +2821,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2834,9 +2834,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2885,9 +2885,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2938,9 +2938,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2992,9 +2992,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3047,9 +3047,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3099,9 +3099,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3153,9 +3153,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3228,11 +3228,11 @@ test.serial(`${currentTest} found row`, async (t) => { t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); diff --git a/backend/test/ava-tests/saas-tests/table-postgres-schema-e2e.test.ts b/backend/test/ava-tests/saas-tests/table-postgres-schema-e2e.test.ts index 61f88820..d8670d3d 100644 --- a/backend/test/ava-tests/saas-tests/table-postgres-schema-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/table-postgres-schema-e2e.test.ts @@ -26,7 +26,7 @@ import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const testSearchedUserName = 'Vasia'; const testTables: Array = []; let currentTest; @@ -37,7 +37,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -95,8 +95,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( const testTableIndex = getTablesRO.findIndex((t) => t.table === testTableName); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -202,20 +202,20 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -276,19 +276,19 @@ test.serial(`${currentTest} should return rows of selected table with search and const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); - t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription)); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(getTableRowsRO.rows[0].id, parseInt(searchedDescription, 10)); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -345,17 +345,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'integer'); @@ -419,17 +419,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); - t.is(getTableRowsRO.rows[0].hasOwnProperty('id'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'id'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'integer'); @@ -498,15 +498,15 @@ should return all found rows with pagination page=1 perPage=2`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'integer'); @@ -576,15 +576,15 @@ should return all found rows with pagination page=1 perPage=3`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'integer'); @@ -652,9 +652,9 @@ should return all found rows with sorting ids by DESC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); @@ -662,8 +662,8 @@ should return all found rows with sorting ids by DESC`, t.is(getTableRowsRO.rows[41].id, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -724,9 +724,9 @@ should return all found rows with sorting ids by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -734,8 +734,8 @@ should return all found rows with sorting ids by ASC`, t.is(getTableRowsRO.rows[41].id, 42); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -797,17 +797,17 @@ should return all found rows with sorting ports by DESC and with pagination page const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 42); t.is(getTableRowsRO.rows[1].id, 41); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -868,17 +868,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); t.is(getTableRowsRO.rows[1].id, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -939,17 +939,17 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 39); t.is(getTableRowsRO.rows[1].id, 38); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1013,9 +1013,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1024,8 +1024,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1089,9 +1089,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1099,8 +1099,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1164,9 +1164,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 1); @@ -1175,8 +1175,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1240,9 +1240,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); t.is(getTableRowsRO.rows[0].id, 38); @@ -1250,8 +1250,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1317,9 +1317,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1332,8 +1332,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1398,9 +1398,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 5); @@ -1415,8 +1415,8 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1481,9 +1481,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1494,8 +1494,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1563,9 +1563,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 5); @@ -1576,8 +1576,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1832,8 +1832,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1872,26 +1872,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 5); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -2039,11 +2039,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2057,9 +2057,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2078,13 +2078,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'id'), true); t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, 43); }); @@ -2133,9 +2133,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2190,9 +2190,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2237,9 +2237,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2294,9 +2294,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2340,11 +2340,11 @@ test.serial(`${currentTest} should update row in table and return result`, async t.is(updateRowInTableResponse.status, 200); const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2358,9 +2358,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2667,7 +2667,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2679,9 +2679,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2727,9 +2727,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2777,9 +2777,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2827,9 +2827,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2877,9 +2877,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2926,9 +2926,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2977,9 +2977,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3048,11 +3048,11 @@ test.serial(`${currentTest} found row`, async (t) => { t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3312,7 +3312,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3324,9 +3324,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; diff --git a/backend/test/ava-tests/saas-tests/table-redis-agent-e2e.test.ts b/backend/test/ava-tests/saas-tests/table-redis-agent-e2e.test.ts index 2b5d1637..ab97fa8c 100644 --- a/backend/test/ava-tests/saas-tests/table-redis-agent-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/table-redis-agent-e2e.test.ts @@ -32,9 +32,9 @@ const __dirname = path.dirname(__filename); const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const testSearchedUserName = 'Vasia'; -const testTables: Array = []; +const _testTables: Array = []; let currentTest; test.before(async () => { @@ -43,7 +43,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication() as any; - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -109,8 +109,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( const testTableIndex = getTablesRO.findIndex((t) => t.table === testTableName); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -203,21 +203,21 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); - t.is(getTableRowsRO.hasOwnProperty('large_dataset'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'large_dataset'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('key'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'key'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -273,19 +273,19 @@ test.serial(`${currentTest} should return rows of selected table with search and const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0].key, searchedDescription); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -338,17 +338,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('key'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'key'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'key'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'string'); @@ -408,17 +408,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('key'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'key'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'key'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'string'); @@ -484,15 +484,15 @@ should return all found rows with pagination page=1 perPage=2`, t.is(getTableRowsResponse.status, 200); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'key'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'string'); @@ -558,15 +558,15 @@ should return all found rows with pagination page=1 perPage=3`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'key'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'string'); @@ -630,9 +630,9 @@ should return all found rows with sorting ids by DESC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); // t.is(getTableRowsRO.rows[0].key, 42); @@ -640,8 +640,8 @@ should return all found rows with sorting ids by DESC`, // t.is(getTableRowsRO.rows[41].id, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -698,9 +698,9 @@ should return all found rows with sorting age by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that rows are sorted by age in ASC order for (let i = 1; i < getTableRowsRO.rows.length; i++) { @@ -769,17 +769,17 @@ should return all found rows with sorting ages by DESC and with pagination page= const preSearchedLastId = insertedSearchedIds.find((id) => id.number === 21).id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[1].key, preSearchedLastId); t.is(getTableRowsRO.rows[0].key, searchedLastId); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -836,15 +836,15 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); // check that returned rows are sorted } catch (e) { @@ -905,17 +905,17 @@ test.skip(`${currentTest} should return all found rows with sorting ages by DESC const searchedSecondId = insertedSearchedIds.find((id) => id.number === 21).id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0].key, searchedFirstId); t.is(getTableRowsRO.rows[1].key, searchedSecondId); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -978,9 +978,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const searchedSecondId = insertedSearchedIds.find((id) => id.number === 21).id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0].key, searchedFirstId); @@ -989,8 +989,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1052,9 +1052,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const searchedFirstId = insertedSearchedIds.find((id) => id.number === 0).id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0].key, searchedFirstId); @@ -1062,8 +1062,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1126,9 +1126,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0].key, searchedFirstId); @@ -1137,8 +1137,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1199,9 +1199,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const searchedFirstId = insertedSearchedIds.find((id) => id.number === 37).id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0].key, searchedFirstId); @@ -1209,8 +1209,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1277,9 +1277,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1291,8 +1291,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1359,9 +1359,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1375,8 +1375,8 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1445,9 +1445,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1460,8 +1460,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 3); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1700,8 +1700,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1735,26 +1735,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 6); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -1878,11 +1878,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -1896,9 +1896,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -1918,13 +1918,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'key'), true); }); test.serial(`${currentTest} should throw an exception when connection id is not passed in request`, async (t) => { @@ -1967,9 +1967,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2019,9 +2019,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2061,9 +2061,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2113,9 +2113,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2155,11 +2155,11 @@ test.serial(`${currentTest} should update row in table and return result`, async t.is(updateRowInTableResponse.status, 200); const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2173,9 +2173,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2505,7 +2505,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2517,9 +2517,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2560,9 +2560,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2605,9 +2605,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2650,9 +2650,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2695,9 +2695,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2739,9 +2739,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2785,9 +2785,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2846,11 +2846,11 @@ test.serial(`${currentTest} found row`, async (t) => { t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3072,7 +3072,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3084,9 +3084,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3150,7 +3150,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3162,9 +3162,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(getTableRowsResponse.status, 200); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3338,7 +3338,7 @@ test.serial(`${currentTest} should import csv file with table data`, async (t) = // eslint-disable-next-line security/detect-non-literal-fs-filename const fileContent = fs.readFileSync(filePatch).toString(); const rows = fileContent.split('\n'); - const idColumnIndex = rows[0].split(',').findIndex((column) => column === 'key'); + const idColumnIndex = rows[0].split(',').indexOf('key'); const newRows = rows.map((row) => { const columns = row.split(','); if (columns.length === 1) { diff --git a/backend/test/ava-tests/saas-tests/table-redis-e2e.test.ts b/backend/test/ava-tests/saas-tests/table-redis-e2e.test.ts index f5b3877c..d34a4e81 100644 --- a/backend/test/ava-tests/saas-tests/table-redis-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/table-redis-e2e.test.ts @@ -32,7 +32,7 @@ const __dirname = path.dirname(__filename); const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; const testSearchedUserName = 'Vasia'; const testTables: Array = []; let currentTest; @@ -43,7 +43,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication() as any; - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -98,8 +98,8 @@ test.serial(`${currentTest} should return list of tables in connection`, async ( const testTableIndex = getTablesRO.findIndex((t) => t.table === testTableName); - t.is(getTablesRO[testTableIndex].hasOwnProperty('table'), true); - t.is(getTablesRO[testTableIndex].hasOwnProperty('permissions'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'table'), true); + t.is(Object.hasOwn(getTablesRO[testTableIndex], 'permissions'), true); t.is(typeof getTablesRO[testTableIndex].permissions, 'object'); t.is(Object.keys(getTablesRO[testTableIndex].permissions).length, 5); t.is(getTablesRO[testTableIndex].table, testTableName); @@ -204,21 +204,21 @@ test.serial(`${currentTest} should return rows of selected table without search const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); - t.is(getTableRowsRO.hasOwnProperty('large_dataset'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'large_dataset'), true); t.is(getTableRowsRO.rows.length, Constants.DEFAULT_PAGINATION.perPage); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('key'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[10].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[15].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[19].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'key'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[10], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[15], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[19], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -281,19 +281,19 @@ test.serial(`${currentTest} should return rows of selected table with search and console.log('🚀 ~ getTableRowsRO:', getTableRowsRO); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0].key, searchedDescription); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty(testTableSecondColumnName), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('created_at'), true); - t.is(getTableRowsRO.rows[0].hasOwnProperty('updated_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], testTableSecondColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'created_at'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'updated_at'), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -350,17 +350,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('key'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'key'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'key'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'string'); @@ -424,17 +424,17 @@ test.serial(`${currentTest} should return page of all rows with pagination page= const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); - t.is(getTableRowsRO.rows[0].hasOwnProperty('key'), true); - t.is(getTableRowsRO.rows[1].hasOwnProperty(testTableColumnName), true); + t.is(Object.hasOwn(getTableRowsRO.rows[0], 'key'), true); + t.is(Object.hasOwn(getTableRowsRO.rows[1], testTableColumnName), true); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'key'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'string'); @@ -505,15 +505,15 @@ should return all found rows with pagination page=1 perPage=2`, t.is(getTableRowsResponse.status, 200); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'key'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'string'); @@ -583,15 +583,15 @@ should return all found rows with pagination page=1 perPage=3`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0][testTableColumnName], testSearchedUserName); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'key'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'string'); @@ -659,9 +659,9 @@ should return all found rows with sorting ids by DESC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); // t.is(getTableRowsRO.rows[0].key, 42); @@ -669,8 +669,8 @@ should return all found rows with sorting ids by DESC`, // t.is(getTableRowsRO.rows[41].id, 1); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -731,9 +731,9 @@ should return all found rows with sorting age by ASC`, const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that rows are sorted by age in ASC order for (let i = 1; i < getTableRowsRO.rows.length; i++) { @@ -806,17 +806,17 @@ should return all found rows with sorting ages by DESC and with pagination page= const preSearchedLastId = insertedSearchedIds.find((id) => id.number === 21).id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[1].key, preSearchedLastId); t.is(getTableRowsRO.rows[0].key, searchedLastId); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -877,15 +877,15 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); // check that returned rows are sorted } catch (e) { @@ -952,17 +952,17 @@ test.skip(`${currentTest} should return all found rows with sorting ages by DESC const searchedSecondId = insertedSearchedIds.find((id) => id.number === 21).id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 3); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0].key, searchedFirstId); t.is(getTableRowsRO.rows[1].key, searchedSecondId); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1031,9 +1031,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const searchedSecondId = insertedSearchedIds.find((id) => id.number === 21).id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[1]).length, 6); t.is(getTableRowsRO.rows[0].key, searchedFirstId); @@ -1042,8 +1042,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1109,9 +1109,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC const searchedFirstId = insertedSearchedIds.find((id) => id.number === 0).id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0].key, searchedFirstId); @@ -1119,8 +1119,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1187,9 +1187,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 2); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0].key, searchedFirstId); @@ -1198,8 +1198,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1264,9 +1264,9 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC const searchedFirstId = insertedSearchedIds.find((id) => id.number === 37).id; t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); t.is(getTableRowsRO.rows[0].key, searchedFirstId); @@ -1274,8 +1274,8 @@ should return all found rows with search, pagination: page=2, perPage=2 and ASC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1346,9 +1346,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1360,8 +1360,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 2); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1432,9 +1432,9 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1448,8 +1448,8 @@ should return all found rows with search, pagination: page=1, perPage=10 and DES t.is(getTableRowsRO.pagination.perPage, 10); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1523,9 +1523,9 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC console.log('🚀 ~ getTableRowsRO:', getTableRowsRO); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 1); t.is(Object.keys(getTableRowsRO.rows[0]).length, 6); @@ -1538,8 +1538,8 @@ should return all found rows with search, pagination: page=1, perPage=2 and DESC t.is(getTableRowsRO.pagination.perPage, 3); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); } catch (e) { console.error(e); throw e; @@ -1794,8 +1794,8 @@ test.serial( t.is(getTablesRO.rows.length, 2); t.is(getTablesRO.rows[0][testTableColumnName], testSearchedUserName); t.is(getTablesRO.rows[1][testTableColumnName], testSearchedUserName); - t.is(getTablesRO.hasOwnProperty('primaryColumns'), true); - t.is(getTablesRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTablesRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTablesRO, 'pagination'), true); } catch (e) { console.error(e); throw e; @@ -1834,26 +1834,26 @@ test.serial(`${currentTest} should return table structure`, async (t) => { t.is(getTableStructureRO.structure.length, 6); for (const element of getTableStructureRO.structure) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('column_default'), true); - t.is(element.hasOwnProperty('data_type'), true); - t.is(element.hasOwnProperty('isExcluded'), true); - t.is(element.hasOwnProperty('isSearched'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'column_default'), true); + t.is(Object.hasOwn(element, 'data_type'), true); + t.is(Object.hasOwn(element, 'isExcluded'), true); + t.is(Object.hasOwn(element, 'isSearched'), true); } - t.is(getTableStructureRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); for (const element of getTableStructureRO.primaryColumns) { - t.is(element.hasOwnProperty('column_name'), true); - t.is(element.hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(element, 'column_name'), true); + t.is(Object.hasOwn(element, 'data_type'), true); } for (const element of getTableStructureRO.foreignKeys) { - t.is(element.hasOwnProperty('referenced_column_name'), true); - t.is(element.hasOwnProperty('referenced_table_name'), true); - t.is(element.hasOwnProperty('constraint_name'), true); - t.is(element.hasOwnProperty('column_name'), true); + t.is(Object.hasOwn(element, 'referenced_column_name'), true); + t.is(Object.hasOwn(element, 'referenced_table_name'), true); + t.is(Object.hasOwn(element, 'constraint_name'), true); + t.is(Object.hasOwn(element, 'column_name'), true); } }); @@ -2002,11 +2002,11 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const addRowInTableRO = JSON.parse(addRowInTableResponse.text); t.is(addRowInTableResponse.status, 201); - t.is(addRowInTableRO.hasOwnProperty('row'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO, 'row'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); t.is(addRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(addRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2020,9 +2020,9 @@ test.serial(`${currentTest} should add row in table and return result`, async (t const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; console.log('🚀 ~ rows:', rows); @@ -2043,13 +2043,13 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsResponse.status, 200); const getLogsRO = JSON.parse(getLogsResponse.text); - t.is(getLogsRO.hasOwnProperty('logs'), true); - t.is(getLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getLogsRO, 'logs'), true); + t.is(Object.hasOwn(getLogsRO, 'pagination'), true); t.is(getLogsRO.logs.length > 0, true); const addRowLogIndex = getLogsRO.logs.findIndex((log) => log.operationType === 'addRow'); - t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex], 'affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('key'), true); + t.is(Object.hasOwn(getLogsRO.logs[addRowLogIndex].affected_primary_key, 'key'), true); }); test.serial(`${currentTest} should throw an exception when connection id is not passed in request`, async (t) => { @@ -2097,9 +2097,9 @@ test.serial(`${currentTest} should throw an exception when connection id is not const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2154,9 +2154,9 @@ test.serial(`${currentTest} should throw an exception when table name is not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2201,9 +2201,9 @@ test.serial(`${currentTest} should throw an exception when row is not passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2258,9 +2258,9 @@ test.serial(`${currentTest} should throw an exception when table name passed in const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2306,11 +2306,11 @@ test.serial(`${currentTest} should update row in table and return result`, async const updateRowInTableRO = JSON.parse(updateRowInTableResponse.text); console.log('🚀 ~ updateRowInTableRO:', updateRowInTableRO); - t.is(updateRowInTableRO.hasOwnProperty('row'), true); - t.is(updateRowInTableRO.hasOwnProperty('structure'), true); - t.is(updateRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(updateRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(updateRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'row'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(updateRowInTableRO, 'readonly_fields'), true); t.is(updateRowInTableRO.row[testTableColumnName], row[testTableColumnName]); t.is(updateRowInTableRO.row[testTableSecondColumnName], row[testTableSecondColumnName]); @@ -2324,9 +2324,9 @@ test.serial(`${currentTest} should update row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2700,7 +2700,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async t.is(deleteRowInTableResponse.status, 200); const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); - t.is(deleteRowInTableRO.hasOwnProperty('row'), true); + t.is(Object.hasOwn(deleteRowInTableRO, 'row'), true); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -2712,9 +2712,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2760,9 +2760,9 @@ test.serial(`${currentTest} should throw an exception when connection id not pas const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2810,9 +2810,9 @@ test.serial(`${currentTest} should throw an exception when connection id passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2860,9 +2860,9 @@ test.serial(`${currentTest} should throw an exception when tableName not passed const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2910,9 +2910,9 @@ test.serial(`${currentTest} should throw an exception when tableName passed in r const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -2959,9 +2959,9 @@ test.serial(`${currentTest} should throw an exception when primary key not passe const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3015,9 +3015,9 @@ test.serial( const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3087,11 +3087,11 @@ test.serial(`${currentTest} found row`, async (t) => { t.is(foundRowInTableResponse.status, 200); const foundRowInTableRO = JSON.parse(foundRowInTableResponse.text); - t.is(foundRowInTableRO.hasOwnProperty('row'), true); - t.is(foundRowInTableRO.hasOwnProperty('structure'), true); - t.is(foundRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(foundRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(foundRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'row'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(foundRowInTableRO, 'readonly_fields'), true); t.is(typeof foundRowInTableRO.row, 'object'); t.is(typeof foundRowInTableRO.structure, 'object'); t.is(typeof foundRowInTableRO.primaryColumns, 'object'); @@ -3361,7 +3361,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowsInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowsInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3373,9 +3373,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); // check that lines was deleted const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3444,7 +3444,7 @@ test.serial(`${currentTest} should delete row in table and return result`, async .set('Accept', 'application/json'); t.is(deleteRowInTableResponse.status, 200); - const deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); + const _deleteRowInTableRO = JSON.parse(deleteRowInTableResponse.text); //checking that the line was deleted const getTableRowsResponse = await request(app.getHttpServer()) @@ -3456,9 +3456,9 @@ test.serial(`${currentTest} should delete row in table and return result`, async const getTableRowsRO = JSON.parse(getTableRowsResponse.text); t.is(getTableRowsResponse.status, 200); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); const { rows, primaryColumns, pagination } = getTableRowsRO; @@ -3665,7 +3665,7 @@ test.serial(`${currentTest} should import csv file with table data`, async (t) = // eslint-disable-next-line security/detect-non-literal-fs-filename const fileContent = fs.readFileSync(filePatch).toString(); const rows = fileContent.split('\n'); - const idColumnIndex = rows[0].split(',').findIndex((column) => column === 'key'); + const idColumnIndex = rows[0].split(',').indexOf('key'); const newRows = rows.map((row) => { const columns = row.split(','); if (columns.length === 1) { diff --git a/backend/test/ava-tests/saas-tests/table-settings-e2e.test.ts b/backend/test/ava-tests/saas-tests/table-settings-e2e.test.ts index 94eacd99..fbcbf9f2 100644 --- a/backend/test/ava-tests/saas-tests/table-settings-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/table-settings-e2e.test.ts @@ -22,7 +22,7 @@ import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; let currentTest; test.before(async () => { @@ -31,7 +31,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -90,7 +90,7 @@ test.serial(`${currentTest} should throw an exception when connectionId is missi const newConnection = getTestData(mockFactory).newConnectionToTestDB; const { token } = await registerUserAndReturnUserInfo(app); - const createdConnection = await request(app.getHttpServer()) + const _createdConnection = await request(app.getHttpServer()) .post('/connection') .send(newConnection) .set('Cookie', token) @@ -191,7 +191,7 @@ test.serial(`${currentTest} should return connection settings object`, async (t) .set('Accept', 'application/json'); const findSettingsRO = JSON.parse(findSettingsResponce.text); - t.is(findSettingsRO.hasOwnProperty('id'), true); + t.is(Object.hasOwn(findSettingsRO, 'id'), true); t.is(findSettingsRO.table_name, 'connection'); t.is(findSettingsRO.display_name, createTableSettingsDTO.display_name); t.deepEqual(findSettingsRO.search_fields, ['title']); @@ -257,7 +257,7 @@ test.serial(`${currentTest} should return created table settings`, async (t) => .set('Accept', 'application/json'); const findSettingsRO = JSON.parse(findSettingsResponce.text); - t.is(findSettingsRO.hasOwnProperty('id'), true); + t.is(Object.hasOwn(findSettingsRO, 'id'), true); t.is(findSettingsRO.table_name, 'connection'); t.is(findSettingsRO.display_name, createTableSettingsDTO.display_name); t.deepEqual(findSettingsRO.search_fields, ['title']); @@ -325,7 +325,7 @@ test.serial(`${currentTest} should throw exception when connectionId is missing` const newConnection = getTestData(mockFactory).newConnectionToTestDB; const { token } = await registerUserAndReturnUserInfo(app); - const createdConnection = await request(app.getHttpServer()) + const _createdConnection = await request(app.getHttpServer()) .post('/connection') .send(newConnection) .set('Cookie', token) diff --git a/backend/test/ava-tests/saas-tests/table-widgets-e2e.test.ts b/backend/test/ava-tests/saas-tests/table-widgets-e2e.test.ts index e96bb041..20fa82b3 100644 --- a/backend/test/ava-tests/saas-tests/table-widgets-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/table-widgets-e2e.test.ts @@ -32,12 +32,12 @@ import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; const mockFactory = new MockFactory(); let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; let currentTest; const tableNameForWidgets = 'connection'; -const uuidRegex: RegExp = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i; +const _uuidRegex: RegExp = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i; test.before(async () => { const moduleFixture = await Test.createTestingModule({ @@ -45,7 +45,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -130,7 +130,7 @@ test.serial( .set('Content-Type', 'application/json') .set('Accept', 'application/json'); t.is(foundRows.status, 200); - const foundRowsRO = JSON.parse(foundRows.text); + const _foundRowsRO = JSON.parse(foundRows.text); const getTableWidgetsRO = JSON.parse(getTableWidgets.text); t.is(typeof getTableWidgetsRO, 'object'); @@ -205,7 +205,7 @@ test.serial(`${currentTest} should return array of table widgets for table`, asy .set('Accept', 'application/json'); t.is(getTableStructureResponse.status, 200); const getTableStructureRO = JSON.parse(getTableStructureResponse.text); - t.is(getTableStructureRO.hasOwnProperty('table_widgets'), true); + t.is(Object.hasOwn(getTableStructureRO, 'table_widgets'), true); t.is(getTableStructureRO.table_widgets.length, 2); t.is(getTableStructureRO.table_widgets[0].field_name, newTableWidgets[0].field_name); t.is(getTableStructureRO.table_widgets[1].widget_type, newTableWidgets[1].widget_type); @@ -408,7 +408,7 @@ test.serial(`${currentTest} should return created table widgets`, async (t) => { .set('Cookie', token) .set('masterpwd', 'ahalaimahalai') .set('Accept', 'application/json'); - const createTableWidgetRO = JSON.parse(createTableWidgetResponse.text); + const _createTableWidgetRO = JSON.parse(createTableWidgetResponse.text); t.is(createTableWidgetResponse.status, 201); const getTableWidgets = await request(app.getHttpServer()) @@ -446,7 +446,7 @@ test.serial(`${currentTest} hould return updated table widgets`, async (t) => { .set('Cookie', token) .set('masterpwd', 'ahalaimahalai') .set('Accept', 'application/json'); - const createTableWidgetRO = JSON.parse(createTableWidgetResponse.text); + const _createTableWidgetRO = JSON.parse(createTableWidgetResponse.text); t.is(createTableWidgetResponse.status, 201); const updatedTableWidgets = mockFactory.generateUpdateWidgetDTOsArrayForConnectionTable(); const updateTableWidgetResponse = await request(app.getHttpServer()) @@ -456,7 +456,7 @@ test.serial(`${currentTest} hould return updated table widgets`, async (t) => { .set('Cookie', token) .set('masterpwd', 'ahalaimahalai') .set('Accept', 'application/json'); - const updateTableWidgetRO = JSON.parse(updateTableWidgetResponse.text); + const _updateTableWidgetRO = JSON.parse(updateTableWidgetResponse.text); t.is(updateTableWidgetResponse.status, 201); @@ -495,7 +495,7 @@ test.serial(`${currentTest} should return updated table widgets when old widget .set('Cookie', token) .set('masterpwd', 'ahalaimahalai') .set('Accept', 'application/json'); - const createTableWidgetRO = JSON.parse(createTableWidgetResponse.text); + const _createTableWidgetRO = JSON.parse(createTableWidgetResponse.text); t.is(createTableWidgetResponse.status, 201); const updatedTableWidgets = mockFactory.generateUpdateWidgetDTOsArrayForConnectionTable(); const updateTableWidgetResponse = await request(app.getHttpServer()) @@ -505,7 +505,7 @@ test.serial(`${currentTest} should return updated table widgets when old widget .set('Cookie', token) .set('masterpwd', 'ahalaimahalai') .set('Accept', 'application/json'); - const updateTableWidgetRO = JSON.parse(updateTableWidgetResponse.text); + const _updateTableWidgetRO = JSON.parse(updateTableWidgetResponse.text); t.is(updateTableWidgetResponse.status, 201); @@ -545,7 +545,7 @@ test.serial(`${currentTest} should return table widgets without deleted widget`, .set('Cookie', token) .set('masterpwd', 'ahalaimahalai') .set('Accept', 'application/json'); - const createTableWidgetRO = JSON.parse(createTableWidgetResponse.text); + const _createTableWidgetRO = JSON.parse(createTableWidgetResponse.text); t.is(createTableWidgetResponse.status, 201); const copyWidgets = [...newTableWidgets]; @@ -643,7 +643,7 @@ test.serial(`${currentTest} should throw exception when connection id not passed .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const connectionId = JSON.parse(createdConnection.text).id; + const _connectionId = JSON.parse(createdConnection.text).id; const newTableWidgets = mockFactory.generateCreateWidgetDTOsArrayForConnectionTable(); const emptyId = ''; const createTableWidgetResponse = await request(app.getHttpServer()) @@ -667,7 +667,7 @@ test.serial(`${currentTest} should throw exception when connection id passed in .set('Content-Type', 'application/json') .set('Accept', 'application/json'); const newTableWidgets = mockFactory.generateCreateWidgetDTOsArrayForConnectionTable(); - const connectionId = JSON.parse(createdConnection.text).id; + const _connectionId = JSON.parse(createdConnection.text).id; const fakeConnectionId = faker.string.uuid(); const createTableWidgetResponse = await request(app.getHttpServer()) .post(`/widget/${fakeConnectionId}?tableName=${tableNameForWidgets}`) @@ -753,7 +753,7 @@ test.serial( const referencedTableTableName = `referenced_table_${faker.string.uuid()}`; const referencedColumnName = 'referenced_on_id'; const secondColumnInReferencedTable = faker.lorem.words(1); - await Knex.schema.createTable(referencedTableTableName, function (table) { + await Knex.schema.createTable(referencedTableTableName, (table) => { table.increments(); table.integer(referencedColumnName); table.string(secondColumnInReferencedTable); @@ -803,7 +803,7 @@ test.serial( .set('Content-Type', 'application/json') .set('Cookie', token) .set('Accept', 'application/json'); - const createTableWidgetRO = JSON.parse(createTableWidgetResponse.text); + const _createTableWidgetRO = JSON.parse(createTableWidgetResponse.text); t.is(createTableWidgetResponse.status, 201); const getTableWidgets = await request(app.getHttpServer()) @@ -826,11 +826,11 @@ test.serial( const getTableStructureRO = JSON.parse(getTableStructureResponse.text); t.is(getTableStructureResponse.status, 200); - t.is(getTableStructureRO.hasOwnProperty('table_widgets'), true); + t.is(Object.hasOwn(getTableStructureRO, 'table_widgets'), true); t.is(getTableStructureRO.table_widgets.length, 1); t.is(getTableStructureRO.table_widgets[0].field_name, foreignKeyWidgetsDTO.widgets[0].field_name); t.is(getTableStructureRO.table_widgets[0].widget_type, foreignKeyWidgetsDTO.widgets[0].widget_type); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); t.is(getTableStructureRO.foreignKeys.length, 1); t.is(getTableStructureRO.foreignKeys[0].column_name, foreignKeyWidgetsDTO.widgets[0].field_name); t.is(getTableStructureRO.foreignKeys[0].referenced_table_name, firstTableData.testTableName); @@ -839,7 +839,7 @@ test.serial( t.is(widgetParams.referenced_column_name, 'id'); t.is(widgetParams.constraint_name, 'manually_created_constraint'); t.is(widgetParams.column_name, referencedColumnName); - t.is(getTableStructureRO.foreignKeys[0].hasOwnProperty('autocomplete_columns'), true); + t.is(Object.hasOwn(getTableStructureRO.foreignKeys[0], 'autocomplete_columns'), true); t.is(getTableStructureRO.foreignKeys[0].autocomplete_columns.length, 5); // check table rows received with foreign keys from widget @@ -853,9 +853,9 @@ test.serial( const getRowsRO = JSON.parse(getRowsResponse.text); t.is(typeof getRowsRO.rows[0], 'object'); for (const row of getRowsRO.rows) { - t.is(row.hasOwnProperty('id'), true); - t.is(row.hasOwnProperty(referencedColumnName), true); - t.is(row[referencedColumnName].hasOwnProperty('id'), true); + t.is(Object.hasOwn(row, 'id'), true); + t.is(Object.hasOwn(row, referencedColumnName), true); + t.is(Object.hasOwn(row[referencedColumnName], 'id'), true); } }, ); @@ -877,7 +877,7 @@ test.serial( const referencedTableTableName = `referenced_table_${faker.string.uuid()}`; const referencedColumnName = 'referenced_on_id'; const secondColumnInReferencedTable = faker.lorem.words(1); - await Knex.schema.createTable(referencedTableTableName, function (table) { + await Knex.schema.createTable(referencedTableTableName, (table) => { table.increments(); table.integer(referencedColumnName); table.string(secondColumnInReferencedTable); @@ -927,7 +927,7 @@ test.serial( .set('Content-Type', 'application/json') .set('Cookie', token) .set('Accept', 'application/json'); - const createTableWidgetRO = JSON.parse(createTableWidgetResponse.text); + const _createTableWidgetRO = JSON.parse(createTableWidgetResponse.text); t.is(createTableWidgetResponse.status, 201); const getTableWidgets = await request(app.getHttpServer()) @@ -950,11 +950,11 @@ test.serial( const getTableStructureRO = JSON.parse(getTableStructureResponse.text); t.is(getTableStructureResponse.status, 200); - t.is(getTableStructureRO.hasOwnProperty('table_widgets'), true); + t.is(Object.hasOwn(getTableStructureRO, 'table_widgets'), true); t.is(getTableStructureRO.table_widgets.length, 1); t.is(getTableStructureRO.table_widgets[0].field_name, foreignKeyWidgetsDTO.widgets[0].field_name); t.is(getTableStructureRO.table_widgets[0].widget_type, foreignKeyWidgetsDTO.widgets[0].widget_type); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); t.is(getTableStructureRO.foreignKeys.length, 1); t.is(getTableStructureRO.foreignKeys[0].column_name, foreignKeyWidgetsDTO.widgets[0].field_name); t.is(getTableStructureRO.foreignKeys[0].referenced_table_name, firstTableData.testTableName); @@ -963,7 +963,7 @@ test.serial( t.is(widgetParams.referenced_column_name, 'id'); t.is(widgetParams.constraint_name, 'manually_created_constraint'); t.is(widgetParams.column_name, referencedColumnName); - t.is(getTableStructureRO.foreignKeys[0].hasOwnProperty('autocomplete_columns'), true); + t.is(Object.hasOwn(getTableStructureRO.foreignKeys[0], 'autocomplete_columns'), true); t.is(getTableStructureRO.foreignKeys[0].autocomplete_columns.length, 5); // check table rows received with foreign keys from widget @@ -977,7 +977,7 @@ test.serial( const getRowsRO = JSON.parse(getRowsResponse.text); t.is(typeof getRowsRO.rows[0], 'object'); for (const row of getRowsRO.rows) { - t.is(row.hasOwnProperty('id'), true); + t.is(Object.hasOwn(row, 'id'), true); } }, ); @@ -999,7 +999,7 @@ test.serial( const referencedTableTableName = `referenced_table_${faker.string.uuid()}`; const referencedColumnName = 'referenced_on_id'; const secondColumnInReferencedTable = faker.lorem.words(1); - await Knex.schema.createTable(referencedTableTableName, function (table) { + await Knex.schema.createTable(referencedTableTableName, (table) => { table.increments(); table.integer(referencedColumnName); table.string(secondColumnInReferencedTable); @@ -1049,7 +1049,7 @@ test.serial( .set('Content-Type', 'application/json') .set('Cookie', token) .set('Accept', 'application/json'); - const createTableWidgetRO = JSON.parse(createTableWidgetResponse.text); + const _createTableWidgetRO = JSON.parse(createTableWidgetResponse.text); t.is(createTableWidgetResponse.status, 201); const getTableWidgets = await request(app.getHttpServer()) @@ -1072,11 +1072,11 @@ test.serial( const getTableStructureRO = JSON.parse(getTableStructureResponse.text); t.is(getTableStructureResponse.status, 200); - t.is(getTableStructureRO.hasOwnProperty('table_widgets'), true); + t.is(Object.hasOwn(getTableStructureRO, 'table_widgets'), true); t.is(getTableStructureRO.table_widgets.length, 1); t.is(getTableStructureRO.table_widgets[0].field_name, foreignKeyWidgetsDTO.widgets[0].field_name); t.is(getTableStructureRO.table_widgets[0].widget_type, foreignKeyWidgetsDTO.widgets[0].widget_type); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); t.is(getTableStructureRO.foreignKeys.length, 1); t.is(getTableStructureRO.foreignKeys[0].column_name, foreignKeyWidgetsDTO.widgets[0].field_name); t.is(getTableStructureRO.foreignKeys[0].referenced_table_name, firstTableData.testTableName); @@ -1085,7 +1085,7 @@ test.serial( t.is(widgetParams.referenced_column_name, 'id'); t.is(widgetParams.constraint_name, 'manually_created_constraint'); t.is(widgetParams.column_name, referencedColumnName); - t.is(getTableStructureRO.foreignKeys[0].hasOwnProperty('autocomplete_columns'), true); + t.is(Object.hasOwn(getTableStructureRO.foreignKeys[0], 'autocomplete_columns'), true); t.is(getTableStructureRO.foreignKeys[0].autocomplete_columns.length, 5); // check table rows received with foreign keys from widget @@ -1099,7 +1099,7 @@ test.serial( const getRowsRO = JSON.parse(getRowsResponse.text); t.is(typeof getRowsRO.rows[0], 'object'); for (const row of getRowsRO.rows) { - t.is(row.hasOwnProperty('id'), true); + t.is(Object.hasOwn(row, 'id'), true); } }, ); @@ -1121,7 +1121,7 @@ test.serial( const referencedTableTableName = `referenced_table_${faker.string.uuid()}`; const referencedColumnName = 'referenced_on_id'; const secondColumnInReferencedTable = faker.lorem.words(1); - await Knex.schema.createTable(referencedTableTableName, function (table) { + await Knex.schema.createTable(referencedTableTableName, (table) => { table.increments(); table.integer(referencedColumnName); table.string(secondColumnInReferencedTable); @@ -1171,7 +1171,7 @@ test.serial( .set('Content-Type', 'application/json') .set('Cookie', token) .set('Accept', 'application/json'); - const createTableWidgetRO = JSON.parse(createTableWidgetResponse.text); + const _createTableWidgetRO = JSON.parse(createTableWidgetResponse.text); t.is(createTableWidgetResponse.status, 201); const getTableWidgets = await request(app.getHttpServer()) @@ -1194,11 +1194,11 @@ test.serial( const getTableStructureRO = JSON.parse(getTableStructureResponse.text); t.is(getTableStructureResponse.status, 200); - t.is(getTableStructureRO.hasOwnProperty('table_widgets'), true); + t.is(Object.hasOwn(getTableStructureRO, 'table_widgets'), true); t.is(getTableStructureRO.table_widgets.length, 1); t.is(getTableStructureRO.table_widgets[0].field_name, foreignKeyWidgetsDTO.widgets[0].field_name); t.is(getTableStructureRO.table_widgets[0].widget_type, foreignKeyWidgetsDTO.widgets[0].widget_type); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); t.is(getTableStructureRO.foreignKeys.length, 1); t.is(getTableStructureRO.foreignKeys[0].column_name, foreignKeyWidgetsDTO.widgets[0].field_name); t.is(getTableStructureRO.foreignKeys[0].referenced_table_name, firstTableData.testTableName); @@ -1207,7 +1207,7 @@ test.serial( t.is(widgetParams.referenced_column_name, 'id'); t.is(widgetParams.constraint_name, 'manually_created_constraint'); t.is(widgetParams.column_name, referencedColumnName); - t.is(getTableStructureRO.foreignKeys[0].hasOwnProperty('autocomplete_columns'), true); + t.is(Object.hasOwn(getTableStructureRO.foreignKeys[0], 'autocomplete_columns'), true); t.is(getTableStructureRO.foreignKeys[0].autocomplete_columns.length, 5); // check table rows received with foreign keys from widget @@ -1221,7 +1221,7 @@ test.serial( const getRowsRO = JSON.parse(getRowsResponse.text); t.is(typeof getRowsRO.rows[0], 'object'); for (const row of getRowsRO.rows) { - t.is(row.hasOwnProperty('id'), true); + t.is(Object.hasOwn(row, 'id'), true); } }, ); @@ -1325,7 +1325,7 @@ test.serial( .set('Content-Type', 'application/json') .set('Cookie', token) .set('Accept', 'application/json'); - const findTablesRO = JSON.parse(findTablesResponse.text); + const _findTablesRO = JSON.parse(findTablesResponse.text); t.is(findTablesResponse.status, 200); const createTableWidgetResponse = await request(app.getHttpServer()) @@ -1335,7 +1335,7 @@ test.serial( .set('Cookie', token) .set('Accept', 'application/json'); - const createTableWidgetRO = JSON.parse(createTableWidgetResponse.text); + const _createTableWidgetRO = JSON.parse(createTableWidgetResponse.text); t.is(createTableWidgetResponse.status, 201); const getTableWidgets = await request(app.getHttpServer()) @@ -1358,11 +1358,11 @@ test.serial( const getTableStructureRO = JSON.parse(getTableStructureResponse.text); t.is(getTableStructureResponse.status, 200); - t.is(getTableStructureRO.hasOwnProperty('table_widgets'), true); + t.is(Object.hasOwn(getTableStructureRO, 'table_widgets'), true); t.is(getTableStructureRO.table_widgets.length, 1); t.is(getTableStructureRO.table_widgets[0].field_name, foreignKeyWidgetsDTO.widgets[0].field_name); t.is(getTableStructureRO.table_widgets[0].widget_type, foreignKeyWidgetsDTO.widgets[0].widget_type); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); t.is(getTableStructureRO.foreignKeys.length, 1); t.is(getTableStructureRO.foreignKeys[0].column_name, foreignKeyWidgetsDTO.widgets[0].field_name); t.is(getTableStructureRO.foreignKeys[0].referenced_table_name, firstTableData.testTableName); @@ -1371,7 +1371,7 @@ test.serial( t.is(widgetParams.referenced_column_name, 'ID'); t.is(widgetParams.constraint_name, 'manually_created_constraint'); t.is(widgetParams.column_name, referencedColumnName); - t.is(getTableStructureRO.foreignKeys[0].hasOwnProperty('autocomplete_columns'), true); + t.is(Object.hasOwn(getTableStructureRO.foreignKeys[0], 'autocomplete_columns'), true); t.is(getTableStructureRO.foreignKeys[0].autocomplete_columns.length, 5); // check table rows received with foreign keys from widget @@ -1386,9 +1386,9 @@ test.serial( t.is(typeof getRowsRO.rows[0], 'object'); for (const row of getRowsRO.rows) { - t.is(row.hasOwnProperty('ID'), true); - t.is(row.hasOwnProperty(referencedColumnName), true); - t.is(row[referencedColumnName].hasOwnProperty('ID'), true); + t.is(Object.hasOwn(row, 'ID'), true); + t.is(Object.hasOwn(row, referencedColumnName), true); + t.is(Object.hasOwn(row[referencedColumnName], 'ID'), true); } }, ); @@ -1476,7 +1476,7 @@ test.serial( .set('Content-Type', 'application/json') .set('Cookie', token) .set('Accept', 'application/json'); - const createTableWidgetRO = JSON.parse(createTableWidgetResponse.text); + const _createTableWidgetRO = JSON.parse(createTableWidgetResponse.text); t.is(createTableWidgetResponse.status, 201); const getTableWidgets = await request(app.getHttpServer()) @@ -1500,11 +1500,11 @@ test.serial( const getTableStructureRO = JSON.parse(getTableStructureResponse.text); t.is(getTableStructureResponse.status, 200); - t.is(getTableStructureRO.hasOwnProperty('table_widgets'), true); + t.is(Object.hasOwn(getTableStructureRO, 'table_widgets'), true); t.is(getTableStructureRO.table_widgets.length, 1); t.is(getTableStructureRO.table_widgets[0].field_name, foreignKeyWidgetsDTO.widgets[0].field_name); t.is(getTableStructureRO.table_widgets[0].widget_type, foreignKeyWidgetsDTO.widgets[0].widget_type); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); t.is(getTableStructureRO.foreignKeys.length, 1); t.is(getTableStructureRO.foreignKeys[0].column_name, foreignKeyWidgetsDTO.widgets[0].field_name); t.is(getTableStructureRO.foreignKeys[0].referenced_table_name, referencedOnTableTableName); @@ -1520,8 +1520,8 @@ test.serial( const getRowsRO = JSON.parse(getRowsResponse.text); t.is(typeof getRowsRO.rows[0], 'object'); for (const row of getRowsRO.rows) { - t.is(row.hasOwnProperty(referencedByColumnName), true); - t.is(row[referencedByColumnName].hasOwnProperty('_id'), true); + t.is(Object.hasOwn(row, referencedByColumnName), true); + t.is(Object.hasOwn(row[referencedByColumnName], '_id'), true); } }, ); @@ -1651,7 +1651,7 @@ test.serial( .set('Content-Type', 'application/json') .set('Cookie', token) .set('Accept', 'application/json'); - const createTableWidgetRO = JSON.parse(createTableWidgetResponse.text); + const _createTableWidgetRO = JSON.parse(createTableWidgetResponse.text); t.is(createTableWidgetResponse.status, 201); const getTableWidgets = await request(app.getHttpServer()) @@ -1675,11 +1675,11 @@ test.serial( const getTableStructureRO = JSON.parse(getTableStructureResponse.text); t.is(getTableStructureResponse.status, 200); - t.is(getTableStructureRO.hasOwnProperty('table_widgets'), true); + t.is(Object.hasOwn(getTableStructureRO, 'table_widgets'), true); t.is(getTableStructureRO.table_widgets.length, 1); t.is(getTableStructureRO.table_widgets[0].field_name, foreignKeyWidgetsDTO.widgets[0].field_name); t.is(getTableStructureRO.table_widgets[0].widget_type, foreignKeyWidgetsDTO.widgets[0].widget_type); - t.is(getTableStructureRO.hasOwnProperty('foreignKeys'), true); + t.is(Object.hasOwn(getTableStructureRO, 'foreignKeys'), true); t.is(getTableStructureRO.foreignKeys.length, 1); t.is(getTableStructureRO.foreignKeys[0].column_name, foreignKeyWidgetsDTO.widgets[0].field_name); t.is(getTableStructureRO.foreignKeys[0].referenced_table_name, referencedOnTableTableName); @@ -1697,8 +1697,8 @@ test.serial( t.is(typeof getRowsRO.rows[0], 'object'); for (const row of getRowsRO.rows) { - t.is(row.hasOwnProperty(referencedByColumnName), true); - t.is(row[referencedByColumnName].hasOwnProperty('id'), true); + t.is(Object.hasOwn(row, referencedByColumnName), true); + t.is(Object.hasOwn(row[referencedByColumnName], 'id'), true); } }, ); diff --git a/backend/test/ava-tests/saas-tests/user-admin-permissions-e2e.test.ts b/backend/test/ava-tests/saas-tests/user-admin-permissions-e2e.test.ts index 375821f8..a58bac39 100644 --- a/backend/test/ava-tests/saas-tests/user-admin-permissions-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/user-admin-permissions-e2e.test.ts @@ -21,11 +21,10 @@ import { createConnectionsAndInviteNewUserInAdminGroupOfFirstConnection } from ' import { inviteUserInCompanyAndAcceptInvitation } from '../../utils/register-user-and-return-user-info.js'; import { ValidationException } from '../../../src/exceptions/custom-exceptions/validation-exception.js'; import { ValidationError } from 'class-validator'; -import { ErrorsMessages } from '../../../src/exceptions/custom-exceptions/messages/custom-errors-messages.js'; import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; let currentTest: string; const mockFactory = new MockFactory(); @@ -37,7 +36,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -77,23 +76,23 @@ test.serial(`${currentTest} should return connections, where second user have ac const result = findAll.body.connections; t.is(result.length, 5); - t.is(result[0].hasOwnProperty('connection'), true); - t.is(result[0].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(result[0], 'connection'), true); + t.is(Object.hasOwn(result[0], 'accessLevel'), true); t.is(result[0].accessLevel, AccessLevelEnum.edit); - t.is(result[0].hasOwnProperty('accessLevel'), true); - t.is(result[0].connection.hasOwnProperty('host'), true); - t.is(result[0].connection.hasOwnProperty('host'), true); + t.is(Object.hasOwn(result[0], 'accessLevel'), true); + t.is(Object.hasOwn(result[0].connection, 'host'), true); + t.is(Object.hasOwn(result[0].connection, 'host'), true); t.is(typeof result[0].connection.port, 'number'); - t.is(result[0].connection.hasOwnProperty('port'), true); - t.is(result[0].connection.hasOwnProperty('username'), true); - t.is(result[0].connection.hasOwnProperty('database'), true); - t.is(result[0].connection.hasOwnProperty('sid'), true); - t.is(result[0].connection.hasOwnProperty('createdAt'), true); - t.is(result[0].connection.hasOwnProperty('updatedAt'), true); - t.is(result[0].connection.hasOwnProperty('password'), false); - t.is(result[0].connection.hasOwnProperty('groups'), false); - t.is(result[0].connection.hasOwnProperty('author'), false); + t.is(Object.hasOwn(result[0].connection, 'port'), true); + t.is(Object.hasOwn(result[0].connection, 'username'), true); + t.is(Object.hasOwn(result[0].connection, 'database'), true); + t.is(Object.hasOwn(result[0].connection, 'sid'), true); + t.is(Object.hasOwn(result[0].connection, 'createdAt'), true); + t.is(Object.hasOwn(result[0].connection, 'updatedAt'), true); + t.is(Object.hasOwn(result[0].connection, 'password'), false); + t.is(Object.hasOwn(result[0].connection, 'groups'), false); + t.is(Object.hasOwn(result[0].connection, 'author'), false); const testConnectionsCount = result.filter((el: any) => el.connection.isTestConnection).length; t.is(testConnectionsCount, 4); } catch (error) { @@ -125,11 +124,11 @@ test.serial(`${currentTest} should return a found connection`, async (t) => { t.is(result.username, 'postgres'); t.is(result.database, newConnectionToPostgres.database); t.is(result.sid, null); - t.is(result.hasOwnProperty('createdAt'), true); - t.is(result.hasOwnProperty('updatedAt'), true); - t.is(result.hasOwnProperty('password'), false); - t.is(result.hasOwnProperty('groups'), false); - t.is(result.hasOwnProperty('author'), false); + t.is(Object.hasOwn(result, 'createdAt'), true); + t.is(Object.hasOwn(result, 'updatedAt'), true); + t.is(Object.hasOwn(result, 'password'), false); + t.is(Object.hasOwn(result, 'groups'), false); + t.is(Object.hasOwn(result, 'author'), false); } catch (error) { console.error(error); throw error; @@ -184,10 +183,10 @@ test.serial(`${currentTest} should return updated connection`, async (t) => { t.is(result.username, 'admin'); t.is(result.database, 'testing_nestjs'); t.is(result.sid, null); - t.is(result.hasOwnProperty('createdAt'), true); - t.is(result.hasOwnProperty('updatedAt'), true); - t.is(result.hasOwnProperty('password'), false); - t.is(result.hasOwnProperty('groups'), false); + t.is(Object.hasOwn(result, 'createdAt'), true); + t.is(Object.hasOwn(result, 'updatedAt'), true); + t.is(Object.hasOwn(result, 'password'), false); + t.is(Object.hasOwn(result, 'groups'), false); } catch (error) { console.error(error); throw error; @@ -243,7 +242,7 @@ test.serial(`${currentTest} should return delete result`, async (t) => { t.is(response.status, 200); - t.is(result.hasOwnProperty('id'), false); + t.is(Object.hasOwn(result, 'id'), false); t.is(result.title, newConnectionToPostgres.title); t.is(result.type, 'postgres'); t.is(result.host, newConnectionToPostgres.host); @@ -252,11 +251,11 @@ test.serial(`${currentTest} should return delete result`, async (t) => { t.is(result.username, 'postgres'); t.is(result.database, newConnectionToPostgres.database); t.is(result.sid, null); - t.is(result.hasOwnProperty('createdAt'), true); - t.is(result.hasOwnProperty('updatedAt'), true); - t.is(result.hasOwnProperty('password'), false); - t.is(result.hasOwnProperty('groups'), false); - t.is(result.hasOwnProperty('author'), false); + t.is(Object.hasOwn(result, 'createdAt'), true); + t.is(Object.hasOwn(result, 'updatedAt'), true); + t.is(Object.hasOwn(result, 'password'), false); + t.is(Object.hasOwn(result, 'groups'), false); + t.is(Object.hasOwn(result, 'author'), false); } catch (error) { console.error(error); throw error; @@ -309,7 +308,7 @@ test.serial(`${currentTest} should return a created group`, async (t) => { const result = JSON.parse(createGroupResponse.text); t.is(result.title, newGroup1.title); - t.is(result.hasOwnProperty('users'), true); + t.is(Object.hasOwn(result, 'users'), true); t.is(typeof result.users, 'object'); t.is(result.users.length, 1); t.is(result.users[0].email, testData.users.simpleUserEmail.toLowerCase()); @@ -361,7 +360,7 @@ test.serial(`${currentTest} should return connection without deleted group resul t.is(createGroupResponse.status, 201); - t.is(result.hasOwnProperty('id'), true); + t.is(Object.hasOwn(result, 'id'), true); t.is(result.title, newGroup1.title); const createGroupRO = JSON.parse(createGroupResponse.text); @@ -376,7 +375,7 @@ test.serial(`${currentTest} should return connection without deleted group resul //after deleting group result = response.body; t.is(response.status, 200); - t.is(result.hasOwnProperty('title'), true); + t.is(Object.hasOwn(result, 'title'), true); t.is(result.title, createGroupRO.title); t.is(result.isMain, false); // check that group was deleted @@ -390,9 +389,9 @@ test.serial(`${currentTest} should return connection without deleted group resul t.is(response.status, 200); result = JSON.parse(response.text); t.is(result.length, 1); - const groupId = result[0].group.id; + const _groupId = result[0].group.id; - t.is(result[0].group.hasOwnProperty('title'), true); + t.is(Object.hasOwn(result[0].group, 'title'), true); t.is(result[0].accessLevel, AccessLevelEnum.edit); const index = result.findIndex((el: any) => { @@ -424,7 +423,7 @@ test.serial( t.is(createGroupResponse.status, 201); - t.is(result.hasOwnProperty('id'), true); + t.is(Object.hasOwn(result, 'id'), true); t.is(result.title, newGroup1.title); const createGroupRO = JSON.parse(createGroupResponse.text); @@ -469,9 +468,9 @@ test.serial(`${currentTest} return should groups in connection`, async (t) => { t.is(response.status, 200); const result = JSON.parse(response.text); - const groupId = result[0].group.id; + const _groupId = result[0].group.id; - t.is(result[1].group.hasOwnProperty('title'), true); + t.is(Object.hasOwn(result[1].group, 'title'), true); t.is(result[0].accessLevel, AccessLevelEnum.edit); const index = result.findIndex((el: any) => el.group.title === 'Admin'); @@ -538,9 +537,9 @@ test.serial(`${currentTest} should return permissions object for current group i const result = JSON.parse(response.text); t.is(response.status, 200); - t.is(result.hasOwnProperty('connection'), true); - t.is(result.hasOwnProperty('group'), true); - t.is(result.hasOwnProperty('tables'), true); + t.is(Object.hasOwn(result, 'connection'), true); + t.is(Object.hasOwn(result, 'group'), true); + t.is(Object.hasOwn(result, 'tables'), true); t.is(typeof result.connection, 'object'); t.is(typeof result.group, 'object'); t.is(result.connection.connectionId, testData.connections.firstId); @@ -553,7 +552,7 @@ test.serial(`${currentTest} should return permissions object for current group i const tableIndex = tables.findIndex((table) => table.tableName === testData.firstTableInfo.testTableName); t.is(tables.length > 0, true); t.is(typeof tables[0], 'object'); - t.is(tables[tableIndex].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(tables[tableIndex], 'accessLevel'), true); t.is(tables[tableIndex].accessLevel.visibility, false); t.is(tables[tableIndex].accessLevel.readonly, false); t.is(tables[tableIndex].accessLevel.add, false); @@ -594,9 +593,9 @@ test.serial(`${currentTest} should return permissions object for current group i t.is(response.status, 200); const result = JSON.parse(response.text); - t.is(result.hasOwnProperty('connection'), true); - t.is(result.hasOwnProperty('group'), true); - t.is(result.hasOwnProperty('tables'), true); + t.is(Object.hasOwn(result, 'connection'), true); + t.is(Object.hasOwn(result, 'group'), true); + t.is(Object.hasOwn(result, 'tables'), true); t.is(typeof result.connection, 'object'); t.is(typeof result.group, 'object'); t.is(result.connection.connectionId, testData.connections.firstId); @@ -609,7 +608,7 @@ test.serial(`${currentTest} should return permissions object for current group i const tableIndex = tables.findIndex((table) => table.tableName === testData.firstTableInfo.testTableName); t.is(tables.length > 0, true); t.is(typeof tables[0], 'object'); - t.is(tables[tableIndex].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(tables[tableIndex], 'accessLevel'), true); t.is(tables[tableIndex].accessLevel.visibility, true); t.is(tables[tableIndex].accessLevel.readonly, false); t.is(tables[tableIndex].accessLevel.add, true); @@ -651,9 +650,9 @@ test.serial( t.is(response.status, 200); const result = JSON.parse(response.text); - t.is(result.hasOwnProperty('connection'), true); - t.is(result.hasOwnProperty('group'), true); - t.is(result.hasOwnProperty('tables'), true); + t.is(Object.hasOwn(result, 'connection'), true); + t.is(Object.hasOwn(result, 'group'), true); + t.is(Object.hasOwn(result, 'tables'), true); t.is(typeof result.connection, 'object'); t.is(typeof result.group, 'object'); t.is(result.connection.connectionId, testData.connections.secondId); @@ -666,7 +665,7 @@ test.serial( const tableIndex = tables.findIndex((table) => table.tableName === testData.secondTableInfo.testTableName); t.is(tables.length > 0, true); t.is(typeof tables[0], 'object'); - t.is(tables[tableIndex].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(tables[tableIndex], 'accessLevel'), true); t.is(tables[tableIndex].accessLevel.visibility, false); t.is(tables[tableIndex].accessLevel.readonly, false); t.is(tables[tableIndex].accessLevel.add, false); @@ -697,11 +696,11 @@ test.serial(`${currentTest} should return found groups with current user`, async const { groups, groupsCount } = getGroupsRO; t.is(groupsCount, 1); t.is(groups.length, 1); - t.is(groups[0].hasOwnProperty('group'), true); - t.is(groups[0].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(groups[0], 'group'), true); + t.is(Object.hasOwn(groups[0], 'accessLevel'), true); - t.is(groups[0].group.hasOwnProperty('title'), true); - t.is(groups[0].group.hasOwnProperty('isMain'), true); + t.is(Object.hasOwn(groups[0].group, 'title'), true); + t.is(Object.hasOwn(groups[0].group, 'isMain'), true); } catch (error) { console.error(error); throw error; @@ -732,10 +731,10 @@ test.serial(`${currentTest} it should return users in group`, async (t) => { const getUsersRO = JSON.parse(response.text); t.is(getUsersRO.length, 2); t.is(getUsersRO[0].id === getUsersRO[1].id, false); - t.is(getUsersRO[0].hasOwnProperty('createdAt'), true); - t.is(getUsersRO[0].hasOwnProperty('password'), false); - t.is(getUsersRO[0].hasOwnProperty('isActive'), true); - t.is(getUsersRO[0].hasOwnProperty('email'), true); + t.is(Object.hasOwn(getUsersRO[0], 'createdAt'), true); + t.is(Object.hasOwn(getUsersRO[0], 'password'), false); + t.is(Object.hasOwn(getUsersRO[0], 'isActive'), true); + t.is(Object.hasOwn(getUsersRO[0], 'email'), true); } catch (error) { console.error(error); throw error; @@ -806,9 +805,9 @@ test.serial(`${currentTest} should return group with added user`, async (t) => { const addUserInGroupRO = JSON.parse(addUserInGroupResponse.text).group; - t.is(addUserInGroupRO.hasOwnProperty('title'), true); - t.is(addUserInGroupRO.hasOwnProperty('isMain'), true); - t.is(addUserInGroupRO.hasOwnProperty('users'), true); + t.is(Object.hasOwn(addUserInGroupRO, 'title'), true); + t.is(Object.hasOwn(addUserInGroupRO, 'isMain'), true); + t.is(Object.hasOwn(addUserInGroupRO, 'users'), true); const { users } = addUserInGroupRO; t.is(users.length, 3); t.is(users[0].id === users[1].id, false); @@ -839,7 +838,7 @@ test.serial(`${currentTest} should throw exception, when user email not passed i .send({ groupId }) .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const addUserInGroupRO = JSON.parse(addUserInGroupResponse.text); + const _addUserInGroupRO = JSON.parse(addUserInGroupResponse.text); t.is(addUserInGroupResponse.status, 400); // t.is(addUserInGroupRO.message, ErrorsMessages.VALIDATION_FAILED); } catch (error) { @@ -860,7 +859,7 @@ test.serial(`${currentTest} should throw exception, when group id not passed in t.is(getGroupsResponse.status, 200); const getGroupsRO = JSON.parse(getGroupsResponse.text); - const groupId = getGroupsRO[0].group.id; + const _groupId = getGroupsRO[0].group.id; const email = faker.internet.email(); const addUserInGroupResponse = await request(app.getHttpServer()) .put('/group/user') @@ -888,7 +887,7 @@ test.serial(`${currentTest} should throw exception, when group id passed in requ .set('Accept', 'application/json'); t.is(getGroupsResponse.status, 200); - const getGroupsRO = JSON.parse(getGroupsResponse.text); + const _getGroupsRO = JSON.parse(getGroupsResponse.text); const email = faker.internet.email(); const groupId = faker.string.uuid(); @@ -982,7 +981,7 @@ test.serial(`${currentTest} should throw an exception when group id not passed i .set('Accept', 'application/json'); t.is(getGroupsResponse.status, 200); - const getGroupsRO = JSON.parse(getGroupsResponse.text); + const _getGroupsRO = JSON.parse(getGroupsResponse.text); const deleteGroupResponse = await request(app.getHttpServer()) .delete(`/group/`) @@ -1064,9 +1063,9 @@ test.serial(`${currentTest} should return group without deleted user`, async (t) .set('Accept', 'application/json'); const deleteUserInGroupRO = JSON.parse(deleteUserInGroupResponse.text); - t.is(deleteUserInGroupRO.hasOwnProperty('title'), true); - t.is(deleteUserInGroupRO.hasOwnProperty('isMain'), true); - t.is(deleteUserInGroupRO.hasOwnProperty('users'), true); + t.is(Object.hasOwn(deleteUserInGroupRO, 'title'), true); + t.is(Object.hasOwn(deleteUserInGroupRO, 'isMain'), true); + t.is(Object.hasOwn(deleteUserInGroupRO, 'users'), true); const { users } = deleteUserInGroupRO; t.is(users.length, 2); t.is(users[0].id === users[1].id, false); @@ -1097,7 +1096,7 @@ test.serial(`${currentTest} should throw exception, when user email not passed i undefined, ); - const email = thirdTestUser.email; + const _email = thirdTestUser.email; const deleteUserInGroupResponse = await request(app.getHttpServer()) .put('/group/user/delete') @@ -1105,7 +1104,7 @@ test.serial(`${currentTest} should throw exception, when user email not passed i .send({ groupId }) .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const deleteUserInGroupRO = JSON.parse(deleteUserInGroupResponse.text); + const _deleteUserInGroupRO = JSON.parse(deleteUserInGroupResponse.text); // t.is(deleteUserInGroupRO.message, ErrorsMessages.VALIDATION_FAILED); } catch (error) { console.error(error); @@ -1125,7 +1124,7 @@ test.serial(`${currentTest} should throw exception, when group id not passed in t.is(getGroupsResponse.status, 200); const getGroupsRO = JSON.parse(getGroupsResponse.text); - const groupId = getGroupsRO[0].group.id; + const _groupId = getGroupsRO[0].group.id; const thirdTestUser = await inviteUserInCompanyAndAcceptInvitation( testData.users.adminUserToken, @@ -2203,15 +2202,15 @@ test.serial(`${currentTest} should return added row`, async (t) => { .set('Accept', 'application/json'); const addRowInTableRO = JSON.parse(addRowInTable.text); t.is(addRowInTable.status, 201); - t.is(addRowInTableRO.row.hasOwnProperty('id'), true); + t.is(Object.hasOwn(addRowInTableRO.row, 'id'), true); t.is(addRowInTableRO.row[testData.firstTableInfo.testTableColumnName], randomName); t.is(addRowInTableRO.row[testData.firstTableInfo.testTableSecondColumnName], randomEmail); - t.is(addRowInTableRO.row.hasOwnProperty('created_at'), true); - t.is(addRowInTableRO.row.hasOwnProperty('updated_at'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO.row, 'created_at'), true); + t.is(Object.hasOwn(addRowInTableRO.row, 'updated_at'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); } catch (error) { console.error(error); throw error; @@ -2427,15 +2426,15 @@ test.serial(`${currentTest} should return updated row`, async (t) => { .set('Accept', 'application/json'); const addRowInTableRO = JSON.parse(updateRowInTable.text); t.is(updateRowInTable.status, 200); - t.is(addRowInTableRO.row.hasOwnProperty('id'), true); + t.is(Object.hasOwn(addRowInTableRO.row, 'id'), true); t.is(addRowInTableRO.row[testData.firstTableInfo.testTableColumnName], randomName); t.is(addRowInTableRO.row[testData.firstTableInfo.testTableSecondColumnName], randomEmail); - t.is(addRowInTableRO.row.hasOwnProperty('created_at'), true); - t.is(addRowInTableRO.row.hasOwnProperty('updated_at'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO.row, 'created_at'), true); + t.is(Object.hasOwn(addRowInTableRO.row, 'updated_at'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); } catch (error) { console.error(error); throw error; @@ -2820,12 +2819,12 @@ test.serial(`${currentTest} `, async (t) => { const getRowInTableRO = JSON.parse(getRowInTable.text); t.is(getRowInTable.status, 200); t.is(getRowInTableRO.row.id, 5); - t.is(getRowInTableRO.row.hasOwnProperty('created_at'), true); - t.is(getRowInTableRO.row.hasOwnProperty('updated_at'), true); - t.is(getRowInTableRO.hasOwnProperty('structure'), true); - t.is(getRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(getRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(getRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(getRowInTableRO.row, 'created_at'), true); + t.is(Object.hasOwn(getRowInTableRO.row, 'updated_at'), true); + t.is(Object.hasOwn(getRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(getRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(getRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getRowInTableRO, 'readonly_fields'), true); } catch (error) { console.error(error); throw error; @@ -2988,15 +2987,15 @@ test.serial(`${currentTest} should return all found logs in connection`, async ( const getRowInTableRO = JSON.parse(getTableLogs.text); t.is(getRowInTableRO.logs.length, 1); - t.is(getRowInTableRO.logs[0].hasOwnProperty('table_name'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('received_data'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('old_data'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('cognitoUserName'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('email'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('operationType'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('operationStatusResult'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('createdAt'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('connection_id'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'table_name'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'received_data'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'old_data'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'cognitoUserName'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'email'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'operationType'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'operationStatusResult'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'createdAt'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'connection_id'), true); } catch (error) { console.error(error); throw error; @@ -3129,7 +3128,7 @@ test.serial(`${currentTest} should return table settings when it was created`, a .set('Accept', 'application/json'); const getTableSettingsRO = JSON.parse(getTableSettings.text); t.is(getTableSettings.status, 200); - t.is(getTableSettingsRO.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getTableSettingsRO, 'id'), true); t.is(getTableSettingsRO.table_name, createTableSettingsDTO.table_name); t.is(getTableSettingsRO.display_name, createTableSettingsDTO.display_name); t.is(JSON.stringify(getTableSettingsRO.search_fields), JSON.stringify(createTableSettingsDTO.search_fields)); @@ -3232,7 +3231,7 @@ test.serial(`${currentTest} should return created table settings`, async (t) => t.is(createTableSettingsResponse.status, 201); const createTableSettingsRO = JSON.parse(createTableSettingsResponse.text); - t.is(createTableSettingsRO.hasOwnProperty('id'), true); + t.is(Object.hasOwn(createTableSettingsRO, 'id'), true); t.is(createTableSettingsRO.table_name, createTableSettingsDTO.table_name); t.is(createTableSettingsRO.display_name, createTableSettingsDTO.display_name); t.is(JSON.stringify(createTableSettingsRO.search_fields), JSON.stringify(createTableSettingsDTO.search_fields)); @@ -3348,7 +3347,7 @@ test.serial(`${currentTest} should return updated table settings`, async (t) => const updateTableSettingsRO = JSON.parse(updateTableSettingsResponse.text); t.is(updateTableSettingsResponse.status, 200); - t.is(updateTableSettingsRO.hasOwnProperty('id'), true); + t.is(Object.hasOwn(updateTableSettingsRO, 'id'), true); t.is(updateTableSettingsRO.table_name, updateTableSettingsDTO.table_name); t.is(updateTableSettingsRO.display_name, updateTableSettingsDTO.display_name); t.is(JSON.stringify(updateTableSettingsRO.search_fields), JSON.stringify(updateTableSettingsDTO.search_fields)); @@ -3607,7 +3606,7 @@ test.serial(`${currentTest} should return array of table widgets for table`, asy .set('Accept', 'application/json'); t.is(getTableStructureResponse.status, 200); const getTableStructureRO = JSON.parse(getTableStructureResponse.text); - t.is(getTableStructureRO.hasOwnProperty('table_widgets'), true); + t.is(Object.hasOwn(getTableStructureRO, 'table_widgets'), true); t.is(getTableStructureRO.table_widgets.length, 2); t.is(getTableStructureRO.table_widgets[0].field_name, newTableWidgets[0].field_name); t.is(getTableStructureRO.table_widgets[1].widget_type, newTableWidgets[1].widget_type); diff --git a/backend/test/ava-tests/saas-tests/user-e2e.test.ts b/backend/test/ava-tests/saas-tests/user-e2e.test.ts index 335b4de4..e3242b4a 100644 --- a/backend/test/ava-tests/saas-tests/user-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/user-e2e.test.ts @@ -28,7 +28,7 @@ import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; let app: INestApplication; let currentTest: string; -let testUtils: TestUtils; +let _testUtils: TestUtils; const mockFactory = new MockFactory(); @@ -38,7 +38,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -65,7 +65,6 @@ test.after(async () => { currentTest = 'GET /user'; test.serial(`${currentTest} should user info for this user`, async (t) => { - try { const adminUserRegisterInfo = await registerUserAndReturnUserInfo(app); const { token } = adminUserRegisterInfo; @@ -78,17 +77,13 @@ test.serial(`${currentTest} should user info for this user`, async (t) => { t.is(getUserRO.isActive, false); t.is(getUserRO.email, adminUserRegisterInfo.email.toLowerCase()); - t.is(getUserRO.hasOwnProperty('createdAt'), true); - } catch (err) { - throw err; - } + t.is(Object.hasOwn(getUserRO, 'createdAt'), true); t.pass(); }); currentTest = 'DELETE /user'; test.serial(`${currentTest} should return user deletion result`, async (t) => { - try { const adminUserRegisterInfo = await registerUserAndReturnUserInfo(app); const { token } = adminUserRegisterInfo; @@ -111,15 +106,11 @@ test.serial(`${currentTest} should return user deletion result`, async (t) => { .set('Content-Type', 'application/json') .set('Accept', 'application/json'); t.is(getUserResult.status, 404); - } catch (err) { - throw err; - } t.pass(); }); currentTest = 'POST /user/login'; test.serial(`${currentTest} should return expiration token when user login`, async (t) => { - try { const adminUserRegisterInfo = await registerUserAndReturnUserInfo(app); const { email, password } = adminUserRegisterInfo; @@ -129,15 +120,11 @@ test.serial(`${currentTest} should return expiration token when user login`, asy .set('Content-Type', 'application/json') .set('Accept', 'application/json'); const loginUserRO = JSON.parse(loginUserResult.text); - t.is(loginUserRO.hasOwnProperty('expires'), true); - } catch (err) { - throw err; - } + t.is(Object.hasOwn(loginUserRO, 'expires'), true); t.pass(); }); test.serial(`${currentTest} should return expiration token when user login with company id`, async (t) => { - try { const adminUserRegisterInfo = await registerUserAndReturnUserInfo(app); const { email, password } = adminUserRegisterInfo; @@ -159,20 +146,16 @@ test.serial(`${currentTest} should return expiration token when user login with .set('Content-Type', 'application/json') .set('Accept', 'application/json'); const loginUserRO = JSON.parse(loginUserResult.text); - t.is(loginUserRO.hasOwnProperty('expires'), true); - } catch (err) { - throw err; - } + t.is(Object.hasOwn(loginUserRO, 'expires'), true); t.pass(); }); test.serial( `${currentTest} should return expiration token when user login with company id and have more than one company`, async (t) => { - try { const testEmail = 'test@mail.com'; const testData_1 = await registerUserOnSaasAndReturnUserInfo(testEmail); - const testData_2 = await registerUserOnSaasAndReturnUserInfo(testEmail); + const _testData_2 = await registerUserOnSaasAndReturnUserInfo(testEmail); const foundCompanyInfos = await request(app.getHttpServer()) .get(`/company/my/email/${testEmail}`) @@ -194,10 +177,7 @@ test.serial( .set('Accept', 'application/json'); const loginUserRO = JSON.parse(loginUserResult.text); t.is(loginUserResult.status, 201); - t.is(loginUserRO.hasOwnProperty('expires'), true); - } catch (err) { - throw err; - } + t.is(Object.hasOwn(loginUserRO, 'expires'), true); t.pass(); }, ); @@ -205,12 +185,11 @@ test.serial( test.serial( `${currentTest} should throw an error when user login without company id with more than one company`, async (t) => { - try { const testEmail = 'test@mail.com'; const testData_1 = await registerUserOnSaasAndReturnUserInfo(testEmail); - const testData_2 = await registerUserOnSaasAndReturnUserInfo(testEmail); + const _testData_2 = await registerUserOnSaasAndReturnUserInfo(testEmail); - const foundCompanyInfos = await request(app.getHttpServer()) + const _foundCompanyInfos = await request(app.getHttpServer()) .get(`/company/my/email/${testEmail}`) .set('Content-Type', 'application/json') .set('Accept', 'application/json'); @@ -228,15 +207,11 @@ test.serial( const loginUserRO = JSON.parse(loginUserResult.text); t.is(loginUserResult.status, 400); t.is(loginUserRO.message, Messages.LOGIN_DENIED_SHOULD_CHOOSE_COMPANY); - } catch (err) { - throw err; - } t.pass(); }, ); test.serial(`${currentTest} reject authorization when try to login with wrong password`, async (t) => { - try { const adminUserRegisterInfo = await registerUserAndReturnUserInfo(app); const { email, password } = adminUserRegisterInfo; @@ -256,16 +231,12 @@ test.serial(`${currentTest} reject authorization when try to login with wrong pa .set('Content-Type', 'application/json') .set('Accept', 'application/json'); const loginUserRO = JSON.parse(loginUserResult.text); - t.is(loginUserRO.hasOwnProperty('expires'), true); - } catch (err) { - throw err; - } + t.is(Object.hasOwn(loginUserRO, 'expires'), true); t.pass(); }); currentTest = 'POST /user/settings'; test.serial(`${currentTest} should return created user settings`, async (t) => { - try { const adminUserRegisterInfo = await registerUserAndReturnUserInfo(app); const { token } = adminUserRegisterInfo; @@ -280,17 +251,13 @@ test.serial(`${currentTest} should return created user settings`, async (t) => { t.is(saveUserSettingsResult.status, 201); const saveUserSettingsRO = JSON.parse(saveUserSettingsResult.text); - t.is(saveUserSettingsRO.hasOwnProperty('userSettings'), true); + t.is(Object.hasOwn(saveUserSettingsRO, 'userSettings'), true); t.is(JSON.parse(saveUserSettingsRO.userSettings).test, 'test'); - } catch (err) { - throw err; - } t.pass(); }); currentTest = 'GET /user/settings'; test.serial(`${currentTest} should return empty user settings when it was not created`, async (t) => { - try { const adminUserRegisterInfo = await registerUserAndReturnUserInfo(app); const { token } = adminUserRegisterInfo; @@ -301,16 +268,12 @@ test.serial(`${currentTest} should return empty user settings when it was not cr .set('Accept', 'application/json'); const getUserSettingsRO = JSON.parse(getUserSettingsResult.text); t.is(getUserSettingsResult.status, 200); - t.is(getUserSettingsRO.hasOwnProperty('userSettings'), true); + t.is(Object.hasOwn(getUserSettingsRO, 'userSettings'), true); t.is(getUserSettingsRO.userSettings, null); - } catch (err) { - throw err; - } t.pass(); }); test.serial(`${currentTest} should return user settings when it was created`, async (t) => { - try { const adminUserRegisterInfo = await registerUserAndReturnUserInfo(app); const { token } = adminUserRegisterInfo; @@ -332,17 +295,13 @@ test.serial(`${currentTest} should return user settings when it was created`, as .set('Accept', 'application/json'); const getUserSettingsRO = JSON.parse(getUserSettingsResult.text); t.is(getUserSettingsResult.status, 200); - t.is(getUserSettingsRO.hasOwnProperty('userSettings'), true); + t.is(Object.hasOwn(getUserSettingsRO, 'userSettings'), true); t.is(JSON.parse(getUserSettingsRO.userSettings).test, 'test'); - } catch (err) { - throw err; - } t.pass(); }); currentTest = 'PUT user/test/connections/display/'; test.serial(`${currentTest} should toggle test connections display mode`, async (t) => { - try { const adminUserRegisterInfo = await registerUserAndReturnUserInfo(app); const { token } = adminUserRegisterInfo; @@ -356,7 +315,7 @@ test.serial(`${currentTest} should toggle test connections display mode`, async const getUserConnectionsRO = JSON.parse(getUserConnectionsResult.text); t.is(getUserConnectionsResult.status, 200); - t.is(getUserConnectionsRO.hasOwnProperty('connections'), true); + t.is(Object.hasOwn(getUserConnectionsRO, 'connections'), true); t.is(getUserConnectionsRO.connections.length, 4); const toggleTestConnectionsDisplayModeResult = await request(app.getHttpServer()) @@ -378,18 +337,14 @@ test.serial(`${currentTest} should toggle test connections display mode`, async const getUserConnectionsROAfterToggleMode = JSON.parse(getUserConnectionsResultAfterToggleMode.text); t.is(getUserConnectionsResultAfterToggleMode.status, 200); - t.is(getUserConnectionsROAfterToggleMode.hasOwnProperty('connections'), true); + t.is(Object.hasOwn(getUserConnectionsROAfterToggleMode, 'connections'), true); t.is(getUserConnectionsROAfterToggleMode.connections.length, 0); - } catch (err) { - throw err; - } t.pass(); }); test.serial( `${currentTest} should throw exception when user login with company id from custom domain (domain not added)`, async (t) => { - try { const adminUserRegisterInfo = await registerUserAndReturnUserInfo(app); const { email, password } = adminUserRegisterInfo; @@ -416,15 +371,11 @@ test.serial( t.is(loginUserResult.status, 400); const loginUserRO = JSON.parse(loginUserResult.text); t.is(loginUserRO.message, Messages.INVALID_REQUEST_DOMAIN); - } catch (err) { - throw err; - } t.pass(); }, ); test.skip(`${currentTest} should login user successfully with company id from custom domain (is added)`, async (t) => { - try { const adminUserRegisterInfo = await registerUserAndReturnUserInfo(app); const { email, password, token } = adminUserRegisterInfo; @@ -458,8 +409,8 @@ test.skip(`${currentTest} should login user successfully with company id from cu t.is(registerDomainResponseRO.hostname, customDomain); t.is(registerDomainResponseRO.companyId, companyId); - t.is(registerDomainResponseRO.hasOwnProperty('id'), true); - t.is(registerDomainResponseRO.hasOwnProperty('createdAt'), true); + t.is(Object.hasOwn(registerDomainResponseRO, 'id'), true); + t.is(Object.hasOwn(registerDomainResponseRO, 'createdAt'), true); t.is(Object.keys(registerDomainResponseRO).length, 5); delete loginBodyRequest.companyId; @@ -471,9 +422,6 @@ test.skip(`${currentTest} should login user successfully with company id from cu .set('Host', customDomain); t.is(loginUserResult.status, 201); - } catch (err) { - throw err; - } t.pass(); }); @@ -499,7 +447,7 @@ test.serial(`${currentTest} should register demo user`, async (t) => { .set('Accept', 'application/json'); const getUserConnectionsRO = JSON.parse(getUserConnectionsResult.text); t.is(getUserConnectionsResult.status, 200); - t.is(getUserConnectionsRO.hasOwnProperty('connections'), true); + t.is(Object.hasOwn(getUserConnectionsRO, 'connections'), true); t.is(getUserConnectionsRO.connections.length, 4); //check user can add connection and use it @@ -528,13 +476,13 @@ test.serial(`${currentTest} should register demo user`, async (t) => { t.is(getTableRowsResponse.status, 200); t.is(typeof getTableRowsRO, 'object'); - t.is(getTableRowsRO.hasOwnProperty('rows'), true); - t.is(getTableRowsRO.hasOwnProperty('primaryColumns'), true); - t.is(getTableRowsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(getTableRowsRO, 'rows'), true); + t.is(Object.hasOwn(getTableRowsRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getTableRowsRO, 'pagination'), true); t.is(getTableRowsRO.rows.length, 42); t.is(typeof getTableRowsRO.primaryColumns, 'object'); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('column_name'), true); - t.is(getTableRowsRO.primaryColumns[0].hasOwnProperty('data_type'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'column_name'), true); + t.is(Object.hasOwn(getTableRowsRO.primaryColumns[0], 'data_type'), true); t.is(getTableRowsRO.primaryColumns[0].column_name, 'id'); t.is(getTableRowsRO.primaryColumns[0].data_type, 'integer'); @@ -550,19 +498,19 @@ test.serial(`${currentTest} should register demo user`, async (t) => { t.truthy(getUserCompanyRO); t.is(typeof getUserCompanyRO, 'object'); - t.is(getUserCompanyRO.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getUserCompanyRO, 'id'), true); t.is(typeof getUserCompanyRO.id, 'string'); - t.is(getUserCompanyRO.hasOwnProperty('name'), true); + t.is(Object.hasOwn(getUserCompanyRO, 'name'), true); t.is(typeof getUserCompanyRO.name, 'string'); - t.is(getUserCompanyRO.hasOwnProperty('subscriptionLevel'), true); + t.is(Object.hasOwn(getUserCompanyRO, 'subscriptionLevel'), true); t.is(getUserCompanyRO.subscriptionLevel, 'TEAM_PLAN'); - t.is(getUserCompanyRO.hasOwnProperty('is_payment_method_added'), true); + t.is(Object.hasOwn(getUserCompanyRO, 'is_payment_method_added'), true); t.is(getUserCompanyRO.is_payment_method_added, false); - t.is(getUserCompanyRO.hasOwnProperty('is2faEnabled'), true); + t.is(Object.hasOwn(getUserCompanyRO, 'is2faEnabled'), true); t.is(getUserCompanyRO.is2faEnabled, false); - t.is(getUserCompanyRO.hasOwnProperty('show_test_connections'), true); + t.is(Object.hasOwn(getUserCompanyRO, 'show_test_connections'), true); t.is(getUserCompanyRO.show_test_connections, true); - t.is(getUserCompanyRO.hasOwnProperty('connections'), true); + t.is(Object.hasOwn(getUserCompanyRO, 'connections'), true); t.true(Array.isArray(getUserCompanyRO.connections)); t.is(getUserCompanyRO.connections.length, 5); diff --git a/backend/test/ava-tests/saas-tests/user-group-edit-permissions-e2e.test.ts b/backend/test/ava-tests/saas-tests/user-group-edit-permissions-e2e.test.ts index 72f8c4dd..a04a8320 100644 --- a/backend/test/ava-tests/saas-tests/user-group-edit-permissions-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/user-group-edit-permissions-e2e.test.ts @@ -21,11 +21,10 @@ import { createConnectionsAndInviteNewUserInNewGroupWithGroupPermissions } from import { inviteUserInCompanyAndAcceptInvitation } from '../../utils/register-user-and-return-user-info.js'; import { ValidationException } from '../../../src/exceptions/custom-exceptions/validation-exception.js'; import { ValidationError } from 'class-validator'; -import { ErrorsMessages } from '../../../src/exceptions/custom-exceptions/messages/custom-errors-messages.js'; import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; let currentTest: string; const mockFactory = new MockFactory(); @@ -46,7 +45,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -97,22 +96,22 @@ test.serial(`${currentTest} should return connections, where second user have ac const result = findAll.body.connections; t.is(result.length, 5); - t.is(result[0].hasOwnProperty('connection'), true); - t.is(result[0].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(result[0], 'connection'), true); + t.is(Object.hasOwn(result[0], 'accessLevel'), true); - t.is(result[0].hasOwnProperty('accessLevel'), true); - t.is(result[0].connection.hasOwnProperty('host'), true); - t.is(result[0].connection.hasOwnProperty('host'), true); + t.is(Object.hasOwn(result[0], 'accessLevel'), true); + t.is(Object.hasOwn(result[0].connection, 'host'), true); + t.is(Object.hasOwn(result[0].connection, 'host'), true); t.is(typeof result[0].connection.port, 'number'); - t.is(result[0].connection.hasOwnProperty('port'), true); - t.is(result[0].connection.hasOwnProperty('username'), true); - t.is(result[0].connection.hasOwnProperty('database'), true); - t.is(result[0].connection.hasOwnProperty('sid'), true); - t.is(result[0].connection.hasOwnProperty('createdAt'), true); - t.is(result[0].connection.hasOwnProperty('updatedAt'), true); - t.is(result[0].connection.hasOwnProperty('password'), false); - t.is(result[0].connection.hasOwnProperty('groups'), false); - t.is(result[0].connection.hasOwnProperty('author'), false); + t.is(Object.hasOwn(result[0].connection, 'port'), true); + t.is(Object.hasOwn(result[0].connection, 'username'), true); + t.is(Object.hasOwn(result[0].connection, 'database'), true); + t.is(Object.hasOwn(result[0].connection, 'sid'), true); + t.is(Object.hasOwn(result[0].connection, 'createdAt'), true); + t.is(Object.hasOwn(result[0].connection, 'updatedAt'), true); + t.is(Object.hasOwn(result[0].connection, 'password'), false); + t.is(Object.hasOwn(result[0].connection, 'groups'), false); + t.is(Object.hasOwn(result[0].connection, 'author'), false); const testConnectionsCount = result.filter((el: any) => el.connection.isTestConnection).length; t.is(testConnectionsCount, 4); } catch (e) { @@ -152,11 +151,11 @@ test.serial(`${currentTest} should return a found connection`, async (t) => { t.is(result.username, 'postgres'); t.is(result.database, newConnectionToPostgres.database); t.is(result.sid, null); - t.is(result.hasOwnProperty('createdAt'), true); - t.is(result.hasOwnProperty('updatedAt'), true); - t.is(result.hasOwnProperty('password'), false); - t.is(result.hasOwnProperty('groups'), false); - t.is(result.hasOwnProperty('author'), false); + t.is(Object.hasOwn(result, 'createdAt'), true); + t.is(Object.hasOwn(result, 'updatedAt'), true); + t.is(Object.hasOwn(result, 'password'), false); + t.is(Object.hasOwn(result, 'groups'), false); + t.is(Object.hasOwn(result, 'author'), false); } catch (e) { console.error(e); } @@ -187,7 +186,7 @@ test.serial( // todo add checking connection object properties t.is(findOneResponce.status, 200); const findOneRO = JSON.parse(findOneResponce.text); - t.is(findOneRO.hasOwnProperty('host'), false); + t.is(Object.hasOwn(findOneRO, 'host'), false); } catch (e) { console.error(e); } @@ -404,7 +403,7 @@ test.serial(`${currentTest} should return connection without deleted group resul let result = createGroupResponse.body; t.is(createGroupResponse.status, 201); - t.is(result.hasOwnProperty('id'), true); + t.is(Object.hasOwn(result, 'id'), true); t.is(result.title, newGroup1.title); const createGroupRO = JSON.parse(createGroupResponse.text); @@ -451,7 +450,7 @@ test.serial( t.is(createGroupResponse.status, 201); - t.is(result.hasOwnProperty('id'), true); + t.is(Object.hasOwn(result, 'id'), true); t.is(result.title, newGroup1.title); const createGroupRO = JSON.parse(createGroupResponse.text); @@ -504,9 +503,9 @@ test.serial(`${currentTest} should groups in connection`, async (t) => { t.is(response.status, 200); const result = JSON.parse(response.text); - const groupId = result[0].group.id; + const _groupId = result[0].group.id; - t.is(result[0].group.hasOwnProperty('title'), true); + t.is(Object.hasOwn(result[0].group, 'title'), true); t.is(result[0].accessLevel, AccessLevelEnum.edit); const index = result.findIndex((el: any) => { @@ -586,9 +585,9 @@ test.serial(`${currentTest} should return permissions object for current group i const result = JSON.parse(response.text); t.is(response.status, 200); - t.is(result.hasOwnProperty('connection'), true); - t.is(result.hasOwnProperty('group'), true); - t.is(result.hasOwnProperty('tables'), true); + t.is(Object.hasOwn(result, 'connection'), true); + t.is(Object.hasOwn(result, 'group'), true); + t.is(Object.hasOwn(result, 'tables'), true); t.is(typeof result.connection, 'object'); t.is(typeof result.group, 'object'); t.is(result.connection.connectionId, connections.firstId); @@ -601,7 +600,7 @@ test.serial(`${currentTest} should return permissions object for current group i const tableIndex = tables.findIndex((table: any) => table.tableName === firstTableInfo.testTableName); t.is(tables.length > 0, true); t.is(typeof tables[tableIndex], 'object'); - t.is(tables[tableIndex].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(tables[tableIndex], 'accessLevel'), true); t.is(tables[tableIndex].accessLevel.visibility, tablePermissions.visibility); t.is(tables[tableIndex].accessLevel.readonly, tablePermissions.readonly); t.is(tables[tableIndex].accessLevel.add, tablePermissions.add); @@ -643,9 +642,9 @@ test.serial(`${currentTest} should return permissions object for current group i t.is(response.status, 200); const result = JSON.parse(response.text); - t.is(result.hasOwnProperty('connection'), true); - t.is(result.hasOwnProperty('group'), true); - t.is(result.hasOwnProperty('tables'), true); + t.is(Object.hasOwn(result, 'connection'), true); + t.is(Object.hasOwn(result, 'group'), true); + t.is(Object.hasOwn(result, 'tables'), true); t.is(typeof result.connection, 'object'); t.is(typeof result.group, 'object'); t.is(result.connection.connectionId, connections.firstId); @@ -658,7 +657,7 @@ test.serial(`${currentTest} should return permissions object for current group i const foundTableIndex = tables.findIndex((table) => table.tableName === firstTableInfo.testTableName); t.is(tables.length > 0, true); t.is(typeof tables[foundTableIndex], 'object'); - t.is(tables[foundTableIndex].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(tables[foundTableIndex], 'accessLevel'), true); t.is(tables[foundTableIndex].accessLevel.visibility, tablePermissions.visibility); t.is(tables[foundTableIndex].accessLevel.readonly, tablePermissions.readonly); t.is(tables[foundTableIndex].accessLevel.add, tablePermissions.add); @@ -702,9 +701,9 @@ test.serial( t.is(response.status, 200); const result = JSON.parse(response.text); - t.is(result.hasOwnProperty('connection'), true); - t.is(result.hasOwnProperty('group'), true); - t.is(result.hasOwnProperty('tables'), true); + t.is(Object.hasOwn(result, 'connection'), true); + t.is(Object.hasOwn(result, 'group'), true); + t.is(Object.hasOwn(result, 'tables'), true); t.is(typeof result.connection, 'object'); t.is(typeof result.group, 'object'); t.is(result.connection.connectionId, connections.secondId); @@ -717,7 +716,7 @@ test.serial( const foundTableIndex = tables.findIndex((table) => table.tableName === firstTableInfo.testTableName); t.is(tables.length > 0, true); t.is(typeof tables[0], 'object'); - t.is(tables[foundTableIndex].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(tables[foundTableIndex], 'accessLevel'), true); t.is(tables[foundTableIndex].accessLevel.visibility, false); t.is(tables[foundTableIndex].accessLevel.readonly, false); t.is(tables[foundTableIndex].accessLevel.add, false); @@ -751,11 +750,11 @@ test.serial(`${currentTest} should return found groups with current user`, async const { groups, groupsCount } = getGroupsRO; t.is(groupsCount, 1); t.is(groups.length, 1); - t.is(groups[0].hasOwnProperty('group'), true); - t.is(groups[0].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(groups[0], 'group'), true); + t.is(Object.hasOwn(groups[0], 'accessLevel'), true); - t.is(groups[0].group.hasOwnProperty('title'), true); - t.is(groups[0].group.hasOwnProperty('isMain'), true); + t.is(Object.hasOwn(groups[0].group, 'title'), true); + t.is(Object.hasOwn(groups[0].group, 'isMain'), true); } catch (e) { console.error(e); } @@ -792,10 +791,10 @@ test.serial(`${currentTest} it should return users in group`, async (t) => { const getUsersRO = JSON.parse(response.text); t.is(getUsersRO.length, 2); t.is(getUsersRO[0].id === getUsersRO[1].id, false); - t.is(getUsersRO[0].hasOwnProperty('createdAt'), true); - t.is(getUsersRO[0].hasOwnProperty('password'), false); - t.is(getUsersRO[0].hasOwnProperty('isActive'), true); - t.is(getUsersRO[0].hasOwnProperty('email'), true); + t.is(Object.hasOwn(getUsersRO[0], 'createdAt'), true); + t.is(Object.hasOwn(getUsersRO[0], 'password'), false); + t.is(Object.hasOwn(getUsersRO[0], 'isActive'), true); + t.is(Object.hasOwn(getUsersRO[0], 'email'), true); } catch (e) { console.error(e); } @@ -871,9 +870,9 @@ test.serial(`${currentTest} should return group with added user`, async (t) => { .set('Accept', 'application/json'); const addUserInGroupRO = JSON.parse(addUserInGroupResponse.text).group; - t.is(addUserInGroupRO.hasOwnProperty('title'), true); - t.is(addUserInGroupRO.hasOwnProperty('isMain'), true); - t.is(addUserInGroupRO.hasOwnProperty('users'), true); + t.is(Object.hasOwn(addUserInGroupRO, 'title'), true); + t.is(Object.hasOwn(addUserInGroupRO, 'isMain'), true); + t.is(Object.hasOwn(addUserInGroupRO, 'users'), true); const { users } = addUserInGroupRO; t.is(users.length, 3); t.is(users[0].id === users[1].id, false); @@ -911,7 +910,7 @@ test.serial(`${currentTest} should throw exception, when user email not passed i .send({ groupId }) .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const addUserInGroupRO = JSON.parse(addUserInGroupResponse.text); + const _addUserInGroupRO = JSON.parse(addUserInGroupResponse.text); t.is(addUserInGroupResponse.status, 400); // t.is(addUserInGroupRO.message, ErrorsMessages.VALIDATION_FAILED); } catch (e) { @@ -939,7 +938,7 @@ test.serial(`${currentTest} should throw exception, when group id not passed in t.is(getGroupsResponse.status, 200); const getGroupsRO = JSON.parse(getGroupsResponse.text); - const groupId = getGroupsRO[0].group.id; + const _groupId = getGroupsRO[0].group.id; const email = faker.internet.email(); const addUserInGroupResponse = await request(app.getHttpServer()) .put('/group/user') @@ -973,7 +972,7 @@ test.serial(`${currentTest} should throw exception, when group id passed in requ .set('Accept', 'application/json'); t.is(getGroupsResponse.status, 200); - const getGroupsRO = JSON.parse(getGroupsResponse.text); + const _getGroupsRO = JSON.parse(getGroupsResponse.text); const email = faker.internet.email(); const groupId = faker.string.uuid(); @@ -1080,7 +1079,7 @@ test.serial(`${currentTest} should throw an exception when group id not passed i t.is(getGroupsResponse.status, 200); const getGroupsRO = JSON.parse(getGroupsResponse.text); - const groupId = getGroupsRO[0].group.id; + const _groupId = getGroupsRO[0].group.id; const deleteGroupResponse = await request(app.getHttpServer()) .delete(`/group/`) .set('Cookie', simpleUserToken) @@ -1173,9 +1172,9 @@ test.serial(`${currentTest} should return group without deleted user`, async (t) .set('Accept', 'application/json'); const deleteUserInGroupRO = JSON.parse(deleteUserInGroupResponse.text); - t.is(deleteUserInGroupRO.hasOwnProperty('title'), true); - t.is(deleteUserInGroupRO.hasOwnProperty('isMain'), true); - t.is(deleteUserInGroupRO.hasOwnProperty('users'), true); + t.is(Object.hasOwn(deleteUserInGroupRO, 'title'), true); + t.is(Object.hasOwn(deleteUserInGroupRO, 'isMain'), true); + t.is(Object.hasOwn(deleteUserInGroupRO, 'users'), true); const { users } = deleteUserInGroupRO; t.is(users.length, 2); t.is(users[0].id === users[1].id, false); @@ -1213,7 +1212,7 @@ test.serial(`${currentTest} should throw exception, when user email not passed i undefined, ); - const email = thirdTestUser.email; + const _email = thirdTestUser.email; const deleteUserInGroupResponse = await request(app.getHttpServer()) .put('/group/user/delete') @@ -1221,7 +1220,7 @@ test.serial(`${currentTest} should throw exception, when user email not passed i .send({ groupId }) .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const deleteUserInGroupRO = JSON.parse(deleteUserInGroupResponse.text); + const _deleteUserInGroupRO = JSON.parse(deleteUserInGroupResponse.text); // t.is(deleteUserInGroupRO.message, ErrorsMessages.VALIDATION_FAILED); } catch (e) { console.error(e); @@ -1248,7 +1247,7 @@ test.serial(`${currentTest} should throw exception, when group id not passed in t.is(getGroupsResponse.status, 200); const getGroupsRO = JSON.parse(getGroupsResponse.text); - const groupId = getGroupsRO[0].group.id; + const _groupId = getGroupsRO[0].group.id; const thirdTestUser = await inviteUserInCompanyAndAcceptInvitation( testData.users.adminUserToken, @@ -1432,7 +1431,7 @@ test.serial( .set('Cookie', simpleUserToken) .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const createOrUpdatePermissionRO = JSON.parse(createOrUpdatePermissionResponse.text); + const _createOrUpdatePermissionRO = JSON.parse(createOrUpdatePermissionResponse.text); t.is(createOrUpdatePermissionResponse.status, 403); } catch (e) { console.error(e); @@ -1847,15 +1846,15 @@ test.serial(`${currentTest} should return added row`, async (t) => { .set('Accept', 'application/json'); const addRowInTableRO = JSON.parse(addRowInTable.text); t.is(addRowInTable.status, 201); - t.is(addRowInTableRO.row.hasOwnProperty('id'), true); + t.is(Object.hasOwn(addRowInTableRO.row, 'id'), true); t.is(addRowInTableRO.row[firstTableInfo.testTableColumnName], randomName); t.is(addRowInTableRO.row[firstTableInfo.testTableSecondColumnName], randomEmail); - t.is(addRowInTableRO.row.hasOwnProperty('created_at'), true); - t.is(addRowInTableRO.row.hasOwnProperty('updated_at'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO.row, 'created_at'), true); + t.is(Object.hasOwn(addRowInTableRO.row, 'updated_at'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); } catch (e) { console.error(e); } @@ -2132,12 +2131,12 @@ test.serial(`${currentTest} should return row`, async (t) => { const getRowInTableRO = JSON.parse(getRowInTable.text); t.is(getRowInTable.status, 200); t.is(getRowInTableRO.row.id, 7); - t.is(getRowInTableRO.row.hasOwnProperty('created_at'), true); - t.is(getRowInTableRO.row.hasOwnProperty('updated_at'), true); - t.is(getRowInTableRO.hasOwnProperty('structure'), true); - t.is(getRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(getRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(getRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(getRowInTableRO.row, 'created_at'), true); + t.is(Object.hasOwn(getRowInTableRO.row, 'updated_at'), true); + t.is(Object.hasOwn(getRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(getRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(getRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getRowInTableRO, 'readonly_fields'), true); } catch (e) { console.error(e); } @@ -2231,15 +2230,15 @@ test.serial(`${currentTest} should return all found logs in connection'`, async const getRowInTableRO = JSON.parse(getTableLogs.text); t.is(getRowInTableRO.logs.length, 1); - t.is(getRowInTableRO.logs[0].hasOwnProperty('table_name'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('received_data'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('old_data'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('cognitoUserName'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('email'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('operationType'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('operationStatusResult'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('createdAt'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('connection_id'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'table_name'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'received_data'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'old_data'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'cognitoUserName'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'email'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'operationType'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'operationStatusResult'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'createdAt'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'connection_id'), true); } catch (e) { console.error(e); } @@ -2384,7 +2383,7 @@ test.serial(`${currentTest} 'should return table settings when it was created`, .set('Accept', 'application/json'); const getTableSettingsRO = JSON.parse(getTableSettings.text); t.is(getTableSettings.status, 200); - t.is(getTableSettingsRO.hasOwnProperty('id'), true); + t.is(Object.hasOwn(getTableSettingsRO, 'id'), true); t.is(getTableSettingsRO.table_name, createTableSettingsDTO.table_name); t.is(getTableSettingsRO.display_name, createTableSettingsDTO.display_name); t.is(JSON.stringify(getTableSettingsRO.search_fields), JSON.stringify(createTableSettingsDTO.search_fields)); @@ -2859,7 +2858,7 @@ test.serial(`${currentTest} should return array of table widgets for table`, asy .set('Accept', 'application/json'); t.is(getTableStructureResponse.status, 200); const getTableStructureRO = JSON.parse(getTableStructureResponse.text); - t.is(getTableStructureRO.hasOwnProperty('table_widgets'), true); + t.is(Object.hasOwn(getTableStructureRO, 'table_widgets'), true); t.is(getTableStructureRO.table_widgets.length, 2); t.is(getTableStructureRO.table_widgets[0].field_name, newTableWidgets[0].field_name); t.is(getTableStructureRO.table_widgets[1].widget_type, newTableWidgets[1].widget_type); diff --git a/backend/test/ava-tests/saas-tests/user-sign-in-audit.e2e.test.ts b/backend/test/ava-tests/saas-tests/user-sign-in-audit.e2e.test.ts index 842aede1..bb66190d 100644 --- a/backend/test/ava-tests/saas-tests/user-sign-in-audit.e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/user-sign-in-audit.e2e.test.ts @@ -22,9 +22,9 @@ import { SignInMethodEnum } from '../../../src/entities/user-sign-in-audit/enums let app: INestApplication; let currentTest: string; -let testUtils: TestUtils; +let _testUtils: TestUtils; -const mockFactory = new MockFactory(); +const _mockFactory = new MockFactory(); async function getCompanyIdByToken(app: INestApplication, token: string): Promise { const getCompanyResult = await request(app.getHttpServer()) @@ -42,7 +42,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -94,8 +94,8 @@ test.serial(`${currentTest} should return sign-in audit logs after successful lo t.is(getAuditLogsResult.status, 200); const auditLogsRO = JSON.parse(getAuditLogsResult.text); - t.is(auditLogsRO.hasOwnProperty('logs'), true); - t.is(auditLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(auditLogsRO, 'logs'), true); + t.is(Object.hasOwn(auditLogsRO, 'pagination'), true); t.true(auditLogsRO.logs.length >= 1); // Check that the log entry has expected structure @@ -103,8 +103,8 @@ test.serial(`${currentTest} should return sign-in audit logs after successful lo t.truthy(logEntry); t.is(logEntry.status, SignInStatusEnum.SUCCESS); t.is(logEntry.signInMethod, SignInMethodEnum.EMAIL); - t.is(logEntry.hasOwnProperty('createdAt'), true); - t.is(logEntry.hasOwnProperty('ipAddress'), true); + t.is(Object.hasOwn(logEntry, 'createdAt'), true); + t.is(Object.hasOwn(logEntry, 'ipAddress'), true); } catch (err) { console.error(err); throw err; @@ -138,7 +138,7 @@ test.serial(`${currentTest} should return sign-in audit logs with failed login a t.is(getAuditLogsResult.status, 200); const auditLogsRO = JSON.parse(getAuditLogsResult.text); - t.is(auditLogsRO.hasOwnProperty('logs'), true); + t.is(Object.hasOwn(auditLogsRO, 'logs'), true); t.true(auditLogsRO.logs.length >= 1); // Find the failed login entry @@ -187,7 +187,7 @@ test.serial(`${currentTest} should filter sign-in audit logs by status`, async ( t.is(getFailedLogsResult.status, 200); const failedLogsRO = JSON.parse(getFailedLogsResult.text); - t.is(failedLogsRO.hasOwnProperty('logs'), true); + t.is(Object.hasOwn(failedLogsRO, 'logs'), true); // All returned logs should have failed status failedLogsRO.logs.forEach((log: any) => { t.is(log.status, SignInStatusEnum.FAILED); @@ -203,7 +203,7 @@ test.serial(`${currentTest} should filter sign-in audit logs by status`, async ( t.is(getSuccessLogsResult.status, 200); const successLogsRO = JSON.parse(getSuccessLogsResult.text); - t.is(successLogsRO.hasOwnProperty('logs'), true); + t.is(Object.hasOwn(successLogsRO, 'logs'), true); // All returned logs should have success status successLogsRO.logs.forEach((log: any) => { t.is(log.status, SignInStatusEnum.SUCCESS); @@ -239,7 +239,7 @@ test.serial(`${currentTest} should filter sign-in audit logs by email`, async (t t.is(getAuditLogsResult.status, 200); const auditLogsRO = JSON.parse(getAuditLogsResult.text); - t.is(auditLogsRO.hasOwnProperty('logs'), true); + t.is(Object.hasOwn(auditLogsRO, 'logs'), true); // All returned logs should have the searched email auditLogsRO.logs.forEach((log: any) => { t.is(log.email, email.toLowerCase()); @@ -275,7 +275,7 @@ test.serial(`${currentTest} should filter sign-in audit logs by sign-in method`, t.is(getAuditLogsResult.status, 200); const auditLogsRO = JSON.parse(getAuditLogsResult.text); - t.is(auditLogsRO.hasOwnProperty('logs'), true); + t.is(Object.hasOwn(auditLogsRO, 'logs'), true); // All returned logs should have email sign-in method auditLogsRO.logs.forEach((log: any) => { t.is(log.signInMethod, SignInMethodEnum.EMAIL); @@ -313,13 +313,13 @@ test.serial(`${currentTest} should support pagination for sign-in audit logs`, a t.is(getAuditLogsResult.status, 200); const auditLogsRO = JSON.parse(getAuditLogsResult.text); - t.is(auditLogsRO.hasOwnProperty('logs'), true); - t.is(auditLogsRO.hasOwnProperty('pagination'), true); + t.is(Object.hasOwn(auditLogsRO, 'logs'), true); + t.is(Object.hasOwn(auditLogsRO, 'pagination'), true); t.true(auditLogsRO.logs.length <= 2); - t.is(auditLogsRO.pagination.hasOwnProperty('total'), true); - t.is(auditLogsRO.pagination.hasOwnProperty('lastPage'), true); - t.is(auditLogsRO.pagination.hasOwnProperty('perPage'), true); - t.is(auditLogsRO.pagination.hasOwnProperty('currentPage'), true); + t.is(Object.hasOwn(auditLogsRO.pagination, 'total'), true); + t.is(Object.hasOwn(auditLogsRO.pagination, 'lastPage'), true); + t.is(Object.hasOwn(auditLogsRO.pagination, 'perPage'), true); + t.is(Object.hasOwn(auditLogsRO.pagination, 'currentPage'), true); } catch (err) { console.error(err); throw err; @@ -408,7 +408,7 @@ test.serial(`${currentTest} should filter sign-in audit logs by date range`, asy t.is(getAuditLogsResult.status, 200); const auditLogsRO = JSON.parse(getAuditLogsResult.text); - t.is(auditLogsRO.hasOwnProperty('logs'), true); + t.is(Object.hasOwn(auditLogsRO, 'logs'), true); t.true(auditLogsRO.logs.length >= 1); } catch (err) { console.error(err); diff --git a/backend/test/ava-tests/saas-tests/user-table-different-group-connection-readonly-permissions-e2e.test.ts b/backend/test/ava-tests/saas-tests/user-table-different-group-connection-readonly-permissions-e2e.test.ts index aecb66da..5bd9b014 100644 --- a/backend/test/ava-tests/saas-tests/user-table-different-group-connection-readonly-permissions-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/user-table-different-group-connection-readonly-permissions-e2e.test.ts @@ -24,7 +24,7 @@ import { ValidationError } from 'class-validator'; import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; let currentTest: string; const mockFactory = new MockFactory(); @@ -45,7 +45,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -99,22 +99,22 @@ test.serial(`${currentTest} should return connections, where second user have ac const result = findAll.body.connections; const nonTestConnection = result.find(({ connection }) => connection.id === connections.firstId); t.is(result.length, 5); - t.is(nonTestConnection.hasOwnProperty('connection'), true); - t.is(nonTestConnection.hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(nonTestConnection, 'connection'), true); + t.is(Object.hasOwn(nonTestConnection, 'accessLevel'), true); t.is(nonTestConnection.accessLevel, AccessLevelEnum.readonly); - t.is(nonTestConnection.connection.hasOwnProperty('host'), true); - t.is(result[0].connection.hasOwnProperty('host'), true); + t.is(Object.hasOwn(nonTestConnection.connection, 'host'), true); + t.is(Object.hasOwn(result[0].connection, 'host'), true); t.is(typeof result[0].connection.port, 'number'); - t.is(result[0].connection.hasOwnProperty('port'), true); - t.is(result[0].connection.hasOwnProperty('username'), true); - t.is(result[0].connection.hasOwnProperty('database'), true); - t.is(result[0].connection.hasOwnProperty('sid'), true); - t.is(result[0].connection.hasOwnProperty('createdAt'), true); - t.is(result[0].connection.hasOwnProperty('updatedAt'), true); - t.is(result[0].connection.hasOwnProperty('password'), false); - t.is(result[0].connection.hasOwnProperty('groups'), false); - t.is(result[0].connection.hasOwnProperty('author'), false); + t.is(Object.hasOwn(result[0].connection, 'port'), true); + t.is(Object.hasOwn(result[0].connection, 'username'), true); + t.is(Object.hasOwn(result[0].connection, 'database'), true); + t.is(Object.hasOwn(result[0].connection, 'sid'), true); + t.is(Object.hasOwn(result[0].connection, 'createdAt'), true); + t.is(Object.hasOwn(result[0].connection, 'updatedAt'), true); + t.is(Object.hasOwn(result[0].connection, 'password'), false); + t.is(Object.hasOwn(result[0].connection, 'groups'), false); + t.is(Object.hasOwn(result[0].connection, 'author'), false); const testConnectionsCount = result.filter((el: any) => el.connection.isTestConnection).length; t.is(testConnectionsCount, 4); } catch (e) { @@ -156,11 +156,11 @@ test.serial(`${currentTest} should return a found connection`, async (t) => { t.is(result.username, 'postgres'); t.is(result.database, newConnectionToPostgres.database); t.is(result.sid, null); - t.is(result.hasOwnProperty('createdAt'), true); - t.is(result.hasOwnProperty('updatedAt'), true); - t.is(result.hasOwnProperty('password'), false); - t.is(result.hasOwnProperty('groups'), false); - t.is(result.hasOwnProperty('author'), false); + t.is(Object.hasOwn(result, 'createdAt'), true); + t.is(Object.hasOwn(result, 'updatedAt'), true); + t.is(Object.hasOwn(result, 'password'), false); + t.is(Object.hasOwn(result, 'groups'), false); + t.is(Object.hasOwn(result, 'author'), false); } catch (e) { console.error(e); throw e; @@ -193,7 +193,7 @@ test.serial( // todo add checking connection object properties t.is(findOneResponce.status, 200); const findOneRO = JSON.parse(findOneResponce.text); - t.is(findOneRO.hasOwnProperty('host'), false); + t.is(Object.hasOwn(findOneRO, 'host'), false); } catch (e) { console.error(e); throw e; @@ -424,7 +424,7 @@ test.serial(`${currentTest} should return connection without deleted group resul let result = createGroupResponse.body; t.is(createGroupResponse.status, 201); - t.is(result.hasOwnProperty('id'), true); + t.is(Object.hasOwn(result, 'id'), true); t.is(result.title, newGroup1.title); const createGroupRO = JSON.parse(createGroupResponse.text); @@ -473,7 +473,7 @@ test.serial( t.is(createGroupResponse.status, 201); - t.is(result.hasOwnProperty('id'), true); + t.is(Object.hasOwn(result, 'id'), true); t.is(result.title, newGroup1.title); const createGroupRO = JSON.parse(createGroupResponse.text); @@ -528,9 +528,9 @@ test.serial(`${currentTest} should groups in connection`, async (t) => { t.is(response.status, 200); const result = JSON.parse(response.text); - const groupId = result[0].group.id; + const _groupId = result[0].group.id; - t.is(result[0].group.hasOwnProperty('title'), true); + t.is(Object.hasOwn(result[0].group, 'title'), true); t.is(result[0].accessLevel, AccessLevelEnum.readonly); const index = result.findIndex((el: any) => { @@ -614,9 +614,9 @@ test.serial(`${currentTest} should return permissions object for current group i const result = JSON.parse(response.text); t.is(response.status, 200); - t.is(result.hasOwnProperty('connection'), true); - t.is(result.hasOwnProperty('group'), true); - t.is(result.hasOwnProperty('tables'), true); + t.is(Object.hasOwn(result, 'connection'), true); + t.is(Object.hasOwn(result, 'group'), true); + t.is(Object.hasOwn(result, 'tables'), true); t.is(typeof result.connection, 'object'); t.is(typeof result.group, 'object'); t.is(result.connection.connectionId, connections.firstId); @@ -629,7 +629,7 @@ test.serial(`${currentTest} should return permissions object for current group i const tableIndex = tables.findIndex((table: any) => table.tableName === firstTableInfo.testTableName); t.is(tables.length > 0, true); t.is(typeof tables[tableIndex], 'object'); - t.is(tables[tableIndex].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(tables[tableIndex], 'accessLevel'), true); t.is(tables[tableIndex].accessLevel.visibility, tablePermissions.visibility); t.is(tables[tableIndex].accessLevel.readonly, tablePermissions.readonly); t.is(tables[tableIndex].accessLevel.add, tablePermissions.add); @@ -673,9 +673,9 @@ test.serial(`${currentTest} should return permissions object for current group i t.is(response.status, 200); const result = JSON.parse(response.text); - t.is(result.hasOwnProperty('connection'), true); - t.is(result.hasOwnProperty('group'), true); - t.is(result.hasOwnProperty('tables'), true); + t.is(Object.hasOwn(result, 'connection'), true); + t.is(Object.hasOwn(result, 'group'), true); + t.is(Object.hasOwn(result, 'tables'), true); t.is(typeof result.connection, 'object'); t.is(typeof result.group, 'object'); t.is(result.connection.connectionId, connections.firstId); @@ -688,7 +688,7 @@ test.serial(`${currentTest} should return permissions object for current group i const foundTableIndex = tables.findIndex((table) => table.tableName === firstTableInfo.testTableName); t.is(tables.length > 0, true); t.is(typeof tables[foundTableIndex], 'object'); - t.is(tables[foundTableIndex].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(tables[foundTableIndex], 'accessLevel'), true); t.is(tables[foundTableIndex].accessLevel.visibility, tablePermissions.visibility); t.is(tables[foundTableIndex].accessLevel.readonly, tablePermissions.readonly); t.is(tables[foundTableIndex].accessLevel.add, tablePermissions.add); @@ -734,9 +734,9 @@ test.serial( t.is(response.status, 200); const result = JSON.parse(response.text); - t.is(result.hasOwnProperty('connection'), true); - t.is(result.hasOwnProperty('group'), true); - t.is(result.hasOwnProperty('tables'), true); + t.is(Object.hasOwn(result, 'connection'), true); + t.is(Object.hasOwn(result, 'group'), true); + t.is(Object.hasOwn(result, 'tables'), true); t.is(typeof result.connection, 'object'); t.is(typeof result.group, 'object'); t.is(result.connection.connectionId, connections.secondId); @@ -773,11 +773,11 @@ test.serial(`${currentTest} should return found groups with current user`, async const { groups, groupsCount } = getGroupsRO; t.is(groupsCount, 1); t.is(groups.length, 1); - t.is(groups[0].hasOwnProperty('group'), true); - t.is(groups[0].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(groups[0], 'group'), true); + t.is(Object.hasOwn(groups[0], 'accessLevel'), true); - t.is(groups[0].group.hasOwnProperty('title'), true); - t.is(groups[0].group.hasOwnProperty('isMain'), true); + t.is(Object.hasOwn(groups[0].group, 'title'), true); + t.is(Object.hasOwn(groups[0].group, 'isMain'), true); } catch (e) { console.error(e); throw e; @@ -814,7 +814,7 @@ test.serial(`${currentTest} it should return users in groups`, async (t) => { .set('Content-Type', 'application/json') .set('Accept', 'application/json'); t.is(response.status, 200); - const getUsersRO = JSON.parse(response.text); + const _getUsersRO = JSON.parse(response.text); t.is(getGroupsRO.length, 2); } catch (e) { console.error(e); @@ -895,7 +895,7 @@ test.serial(`${currentTest} should throw exception ${Messages.DONT_HAVE_PERMISSI .set('Accept', 'application/json'); const addUserInGroupRO = JSON.parse(addUserInGroupResponse.text); t.is(addUserInGroupResponse.status, 403); - t.is(addUserInGroupRO.hasOwnProperty('message'), true); + t.is(Object.hasOwn(addUserInGroupRO, 'message'), true); t.is(addUserInGroupRO.message, Messages.DONT_HAVE_PERMISSIONS); } catch (e) { console.error(e); @@ -924,7 +924,7 @@ test.serial(`${currentTest} should throw exception, when group id not passed in t.is(getGroupsResponse.status, 200); const getGroupsRO = JSON.parse(getGroupsResponse.text); - const groupId = getGroupsRO[0].group.id; + const _groupId = getGroupsRO[0].group.id; const email = faker.internet.email(); const addUserInGroupResponse = await request(app.getHttpServer()) .put('/group/user') @@ -960,7 +960,7 @@ test.serial(`${currentTest} should throw exception, when group id passed in requ .set('Accept', 'application/json'); t.is(getGroupsResponse.status, 200); - const getGroupsRO = JSON.parse(getGroupsResponse.text); + const _getGroupsRO = JSON.parse(getGroupsResponse.text); const email = faker.internet.email(); const groupId = faker.string.uuid(); @@ -1073,7 +1073,7 @@ test.serial(`${currentTest} should throw an exception when group id not passed i t.is(getGroupsResponse.status, 200); const getGroupsRO = JSON.parse(getGroupsResponse.text); - const groupId = getGroupsRO[0].group.id; + const _groupId = getGroupsRO[0].group.id; const deleteGroupResponse = await request(app.getHttpServer()) .delete(`/group/`) .set('Cookie', simpleUserToken) @@ -1190,7 +1190,7 @@ test.serial(`${currentTest} should throw exception, when group id not passed in t.is(getGroupsResponse.status, 200); const getGroupsRO = JSON.parse(getGroupsResponse.text); - const groupId = getGroupsRO[0].group.id; + const _groupId = getGroupsRO[0].group.id; const thirdTestUser = await inviteUserInCompanyAndAcceptInvitation( testData.users.adminUserToken, @@ -1778,15 +1778,15 @@ test.serial(`${currentTest} should return added row`, async (t) => { .set('Accept', 'application/json'); const addRowInTableRO = JSON.parse(addRowInTable.text); t.is(addRowInTable.status, 201); - t.is(addRowInTableRO.row.hasOwnProperty('id'), true); + t.is(Object.hasOwn(addRowInTableRO.row, 'id'), true); t.is(addRowInTableRO.row[firstTableInfo.testTableColumnName], randomName); t.is(addRowInTableRO.row[firstTableInfo.testTableSecondColumnName], randomEmail); - t.is(addRowInTableRO.row.hasOwnProperty('created_at'), true); - t.is(addRowInTableRO.row.hasOwnProperty('updated_at'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO.row, 'created_at'), true); + t.is(Object.hasOwn(addRowInTableRO.row, 'updated_at'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); } catch (e) { console.error(e); throw e; @@ -1832,7 +1832,7 @@ test.serial(`${currentTest} should throw an exception, when user does not have a .set('Cookie', simpleUserToken) .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const addRowInTableRO = JSON.parse(addRowInTable.text); + const _addRowInTableRO = JSON.parse(addRowInTable.text); t.is(addRowInTable.status, 403); } catch (e) { console.error(e); @@ -2128,12 +2128,12 @@ test.serial(`${currentTest} should return row`, async (t) => { const getRowInTableRO = JSON.parse(getRowInTable.text); t.is(getRowInTable.status, 200); t.is(getRowInTableRO.row.id, 7); - t.is(getRowInTableRO.row.hasOwnProperty('created_at'), true); - t.is(getRowInTableRO.row.hasOwnProperty('updated_at'), true); - t.is(getRowInTableRO.hasOwnProperty('structure'), true); - t.is(getRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(getRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(getRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(getRowInTableRO.row, 'created_at'), true); + t.is(Object.hasOwn(getRowInTableRO.row, 'updated_at'), true); + t.is(Object.hasOwn(getRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(getRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(getRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getRowInTableRO, 'readonly_fields'), true); } catch (e) { console.error(e); throw e; @@ -2233,15 +2233,15 @@ test.serial(`${currentTest} should return all found logs in connection'`, async const getRowInTableRO = JSON.parse(getTableLogs.text); t.is(getRowInTableRO.logs.length, 1); - t.is(getRowInTableRO.logs[0].hasOwnProperty('table_name'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('received_data'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('old_data'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('cognitoUserName'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('email'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('operationType'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('operationStatusResult'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('createdAt'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('connection_id'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'table_name'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'received_data'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'old_data'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'cognitoUserName'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'email'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'operationType'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'operationStatusResult'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'createdAt'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'connection_id'), true); } catch (e) { console.error(e); throw e; @@ -2391,7 +2391,7 @@ test.serial(`${currentTest} 'should should return created table settings`, async .set('Cookie', simpleUserToken) .set('Content-Type', 'application/json') .set('Accept', 'application/json'); - const getTableSettingsRO = JSON.parse(getTableSettings.text); + const _getTableSettingsRO = JSON.parse(getTableSettings.text); t.is(getTableSettings.status, 200); } catch (e) { console.error(e); @@ -2866,7 +2866,7 @@ test.serial(`${currentTest} should return array of table widgets for table`, asy .set('Accept', 'application/json'); t.is(getTableStructureResponse.status, 200); const getTableStructureRO = JSON.parse(getTableStructureResponse.text); - t.is(getTableStructureRO.hasOwnProperty('table_widgets'), true); + t.is(Object.hasOwn(getTableStructureRO, 'table_widgets'), true); t.is(getTableStructureRO.table_widgets.length, 2); t.is(getTableStructureRO.table_widgets[0].field_name, newTableWidgets[0].field_name); t.is(getTableStructureRO.table_widgets[1].widget_type, newTableWidgets[1].widget_type); diff --git a/backend/test/ava-tests/saas-tests/user-with-table-only-permissions-e2e.test.ts b/backend/test/ava-tests/saas-tests/user-with-table-only-permissions-e2e.test.ts index 73c7b84f..4fa64551 100644 --- a/backend/test/ava-tests/saas-tests/user-with-table-only-permissions-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/user-with-table-only-permissions-e2e.test.ts @@ -24,11 +24,11 @@ import { ValidationError } from 'class-validator'; import { WinstonLogger } from '../../../src/entities/logging/winston-logger.js'; let app: INestApplication; -let testUtils: TestUtils; +let _testUtils: TestUtils; let currentTest: string; const mockFactory = new MockFactory(); -const newConnectionToPostgres = mockFactory.generateConnectionToTestPostgresDBInDocker(); +const _newConnectionToPostgres = mockFactory.generateConnectionToTestPostgresDBInDocker(); const updateConnection = mockFactory.generateUpdateConnectionDto(); const newGroup1 = mockFactory.generateCreateGroupDto1(); const tablePermissions = { @@ -45,7 +45,7 @@ test.before(async () => { providers: [DatabaseService, TestUtils], }).compile(); app = moduleFixture.createNestApplication(); - testUtils = moduleFixture.get(TestUtils); + _testUtils = moduleFixture.get(TestUtils); app.use(cookieParser()); app.useGlobalFilters(new AllExceptionsFilter(app.get(WinstonLogger))); @@ -163,7 +163,7 @@ test.serial( // todo add checking connection object properties t.is(findOneResponce.status, 200); const findOneRO = JSON.parse(findOneResponce.text); - t.is(findOneRO.hasOwnProperty('host'), false); + t.is(Object.hasOwn(findOneRO, 'host'), false); } catch (e) { console.error(e); throw e; @@ -387,7 +387,7 @@ test.serial(`${currentTest} should return connection without deleted group resul let result = createGroupResponse.body; t.is(createGroupResponse.status, 201); - t.is(result.hasOwnProperty('id'), true); + t.is(Object.hasOwn(result, 'id'), true); t.is(result.title, newGroup1.title); const createGroupRO = JSON.parse(createGroupResponse.text); @@ -435,7 +435,7 @@ test.serial( t.is(createGroupResponse.status, 201); - t.is(result.hasOwnProperty('id'), true); + t.is(Object.hasOwn(result, 'id'), true); t.is(result.title, newGroup1.title); const createGroupRO = JSON.parse(createGroupResponse.text); @@ -489,9 +489,9 @@ test.serial(`${currentTest} should groups in connection`, async (t) => { t.is(response.status, 200); const result = JSON.parse(response.text); - const groupId = result[0].group.id; + const _groupId = result[0].group.id; - t.is(result[0].group.hasOwnProperty('title'), true); + t.is(Object.hasOwn(result[0].group, 'title'), true); t.is(result[0].accessLevel, AccessLevelEnum.none); const index = result.findIndex((el: any) => { @@ -573,9 +573,9 @@ test.serial(`${currentTest} should return permissions object for current group i const result = JSON.parse(response.text); t.is(response.status, 200); - t.is(result.hasOwnProperty('connection'), true); - t.is(result.hasOwnProperty('group'), true); - t.is(result.hasOwnProperty('tables'), true); + t.is(Object.hasOwn(result, 'connection'), true); + t.is(Object.hasOwn(result, 'group'), true); + t.is(Object.hasOwn(result, 'tables'), true); t.is(typeof result.connection, 'object'); t.is(typeof result.group, 'object'); t.is(result.connection.connectionId, connections.firstId); @@ -588,7 +588,7 @@ test.serial(`${currentTest} should return permissions object for current group i const tableIndex = tables.findIndex((table: any) => table.tableName === firstTableInfo.testTableName); t.is(tables.length > 0, true); t.is(typeof tables[tableIndex], 'object'); - t.is(tables[tableIndex].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(tables[tableIndex], 'accessLevel'), true); t.is(tables[tableIndex].accessLevel.visibility, tablePermissions.visibility); t.is(tables[tableIndex].accessLevel.readonly, tablePermissions.readonly); t.is(tables[tableIndex].accessLevel.add, tablePermissions.add); @@ -631,9 +631,9 @@ test.serial(`${currentTest} should return permissions object for current group i t.is(response.status, 200); const result = JSON.parse(response.text); - t.is(result.hasOwnProperty('connection'), true); - t.is(result.hasOwnProperty('group'), true); - t.is(result.hasOwnProperty('tables'), true); + t.is(Object.hasOwn(result, 'connection'), true); + t.is(Object.hasOwn(result, 'group'), true); + t.is(Object.hasOwn(result, 'tables'), true); t.is(typeof result.connection, 'object'); t.is(typeof result.group, 'object'); t.is(result.connection.connectionId, connections.firstId); @@ -646,7 +646,7 @@ test.serial(`${currentTest} should return permissions object for current group i const foundTableIndex = tables.findIndex((table) => table.tableName === firstTableInfo.testTableName); t.is(tables.length > 0, true); t.is(typeof tables[foundTableIndex], 'object'); - t.is(tables[foundTableIndex].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(tables[foundTableIndex], 'accessLevel'), true); t.is(tables[foundTableIndex].accessLevel.visibility, tablePermissions.visibility); t.is(tables[foundTableIndex].accessLevel.readonly, tablePermissions.readonly); t.is(tables[foundTableIndex].accessLevel.add, tablePermissions.add); @@ -691,9 +691,9 @@ test.serial( t.is(response.status, 200); const result = JSON.parse(response.text); - t.is(result.hasOwnProperty('connection'), true); - t.is(result.hasOwnProperty('group'), true); - t.is(result.hasOwnProperty('tables'), true); + t.is(Object.hasOwn(result, 'connection'), true); + t.is(Object.hasOwn(result, 'group'), true); + t.is(Object.hasOwn(result, 'tables'), true); t.is(typeof result.connection, 'object'); t.is(typeof result.group, 'object'); t.is(result.connection.connectionId, connections.secondId); @@ -729,11 +729,11 @@ test.serial(`${currentTest} should return found groups with current user`, async const { groups, groupsCount } = getGroupsRO; t.is(groupsCount, 1); t.is(groups.length, 1); - t.is(groups[0].hasOwnProperty('group'), true); - t.is(groups[0].hasOwnProperty('accessLevel'), true); + t.is(Object.hasOwn(groups[0], 'group'), true); + t.is(Object.hasOwn(groups[0], 'accessLevel'), true); - t.is(groups[0].group.hasOwnProperty('title'), true); - t.is(groups[0].group.hasOwnProperty('isMain'), true); + t.is(Object.hasOwn(groups[0].group, 'title'), true); + t.is(Object.hasOwn(groups[0].group, 'isMain'), true); } catch (e) { console.error(e); throw e; @@ -770,7 +770,7 @@ test.serial(`${currentTest} it should throw exception ${Messages.DONT_HAVE_PERMI .set('Accept', 'application/json'); t.is(response.status, 403); const getUsersRO = JSON.parse(response.text); - t.is(getUsersRO.hasOwnProperty('message'), true); + t.is(Object.hasOwn(getUsersRO, 'message'), true); t.is(getUsersRO.message, Messages.DONT_HAVE_PERMISSIONS); } catch (e) { console.error(e); @@ -849,7 +849,7 @@ test.serial(`${currentTest} should throw exception ${Messages.DONT_HAVE_PERMISSI .set('Accept', 'application/json'); const addUserInGroupRO = JSON.parse(addUserInGroupResponse.text); t.is(addUserInGroupResponse.status, 403); - t.is(addUserInGroupRO.hasOwnProperty('message'), true); + t.is(Object.hasOwn(addUserInGroupRO, 'message'), true); t.is(addUserInGroupRO.message, Messages.DONT_HAVE_PERMISSIONS); } catch (e) { console.error(e); @@ -877,7 +877,7 @@ test.serial(`${currentTest} should throw exception, when group id not passed in t.is(getGroupsResponse.status, 200); const getGroupsRO = JSON.parse(getGroupsResponse.text); - const groupId = getGroupsRO[0].group.id; + const _groupId = getGroupsRO[0].group.id; const email = faker.internet.email(); const addUserInGroupResponse = await request(app.getHttpServer()) .put('/group/user') @@ -912,7 +912,7 @@ test.serial(`${currentTest} should throw exception, when group id passed in requ .set('Accept', 'application/json'); t.is(getGroupsResponse.status, 200); - const getGroupsRO = JSON.parse(getGroupsResponse.text); + const _getGroupsRO = JSON.parse(getGroupsResponse.text); const email = faker.internet.email(); const groupId = faker.string.uuid(); @@ -1022,7 +1022,7 @@ test.serial(`${currentTest} should throw an exception when group id not passed i t.is(getGroupsResponse.status, 200); const getGroupsRO = JSON.parse(getGroupsResponse.text); - const groupId = getGroupsRO[0].group.id; + const _groupId = getGroupsRO[0].group.id; const deleteGroupResponse = await request(app.getHttpServer()) .delete(`/group/`) .set('Cookie', simpleUserToken) @@ -1134,7 +1134,7 @@ test.serial(`${currentTest} should throw exception, when group id not passed in .set('Accept', 'application/json'); t.is(getGroupsResponse.status, 200); - const getGroupsRO = JSON.parse(getGroupsResponse.text); + const _getGroupsRO = JSON.parse(getGroupsResponse.text); const thirdTestUser = await inviteUserInCompanyAndAcceptInvitation( testData.users.adminUserToken, @@ -1706,15 +1706,15 @@ test.serial(`${currentTest} should return added row`, async (t) => { .set('Accept', 'application/json'); const addRowInTableRO = JSON.parse(addRowInTable.text); t.is(addRowInTable.status, 201); - t.is(addRowInTableRO.row.hasOwnProperty('id'), true); + t.is(Object.hasOwn(addRowInTableRO.row, 'id'), true); t.is(addRowInTableRO.row[firstTableInfo.testTableColumnName], randomName); t.is(addRowInTableRO.row[firstTableInfo.testTableSecondColumnName], randomEmail); - t.is(addRowInTableRO.row.hasOwnProperty('created_at'), true); - t.is(addRowInTableRO.row.hasOwnProperty('updated_at'), true); - t.is(addRowInTableRO.hasOwnProperty('structure'), true); - t.is(addRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(addRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(addRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(addRowInTableRO.row, 'created_at'), true); + t.is(Object.hasOwn(addRowInTableRO.row, 'updated_at'), true); + t.is(Object.hasOwn(addRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(addRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(addRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(addRowInTableRO, 'readonly_fields'), true); } catch (e) { console.error(e); throw e; @@ -2000,12 +2000,12 @@ test.serial(`${currentTest} should return row`, async (t) => { const getRowInTableRO = JSON.parse(getRowInTable.text); t.is(getRowInTable.status, 200); t.is(getRowInTableRO.row.id, 7); - t.is(getRowInTableRO.row.hasOwnProperty('created_at'), true); - t.is(getRowInTableRO.row.hasOwnProperty('updated_at'), true); - t.is(getRowInTableRO.hasOwnProperty('structure'), true); - t.is(getRowInTableRO.hasOwnProperty('foreignKeys'), true); - t.is(getRowInTableRO.hasOwnProperty('primaryColumns'), true); - t.is(getRowInTableRO.hasOwnProperty('readonly_fields'), true); + t.is(Object.hasOwn(getRowInTableRO.row, 'created_at'), true); + t.is(Object.hasOwn(getRowInTableRO.row, 'updated_at'), true); + t.is(Object.hasOwn(getRowInTableRO, 'structure'), true); + t.is(Object.hasOwn(getRowInTableRO, 'foreignKeys'), true); + t.is(Object.hasOwn(getRowInTableRO, 'primaryColumns'), true); + t.is(Object.hasOwn(getRowInTableRO, 'readonly_fields'), true); } catch (e) { console.error(e); throw e; @@ -2102,15 +2102,15 @@ test.serial(`${currentTest} should return all found logs in connection'`, async const getRowInTableRO = JSON.parse(getTableLogs.text); t.is(getRowInTableRO.logs.length, 1); - t.is(getRowInTableRO.logs[0].hasOwnProperty('table_name'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('received_data'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('old_data'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('cognitoUserName'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('email'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('operationType'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('operationStatusResult'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('createdAt'), true); - t.is(getRowInTableRO.logs[0].hasOwnProperty('connection_id'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'table_name'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'received_data'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'old_data'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'cognitoUserName'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'email'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'operationType'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'operationStatusResult'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'createdAt'), true); + t.is(Object.hasOwn(getRowInTableRO.logs[0], 'connection_id'), true); } catch (e) { console.error(e); throw e; @@ -2725,7 +2725,7 @@ test.serial(`${currentTest} should return array of table widgets for table`, asy .set('Accept', 'application/json'); t.is(getTableStructureResponse.status, 200); const getTableStructureRO = JSON.parse(getTableStructureResponse.text); - t.is(getTableStructureRO.hasOwnProperty('table_widgets'), true); + t.is(Object.hasOwn(getTableStructureRO, 'table_widgets'), true); t.is(getTableStructureRO.table_widgets.length, 2); t.is(getTableStructureRO.table_widgets[0].field_name, newTableWidgets[0].field_name); t.is(getTableStructureRO.table_widgets[1].widget_type, newTableWidgets[1].widget_type); diff --git a/backend/test/mock.factory.ts b/backend/test/mock.factory.ts index 7754b728..d0f6b558 100644 --- a/backend/test/mock.factory.ts +++ b/backend/test/mock.factory.ts @@ -452,7 +452,7 @@ export class MockFactory { generatePermissions( connectionId: string, - groupId: string, + _groupId: string, firstTableName: string, secondTableName: string, connectionAccessLevel: string, @@ -496,7 +496,7 @@ export class MockFactory { generateInternalPermissions( connectionId: string, - groupId: string, + _groupId: string, connectionAccessLevel: string, groupAccessLevel: string, ) { diff --git a/backend/test/utils/create-test-table.ts b/backend/test/utils/create-test-table.ts index ccac973c..d0e71228 100644 --- a/backend/test/utils/create-test-table.ts +++ b/backend/test/utils/create-test-table.ts @@ -1,11 +1,11 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ -import { fa, faker, th } from '@faker-js/faker'; +import { faker, } from '@faker-js/faker'; import { getRandomConstraintName, getRandomTestTableName } from './get-random-test-table-name.js'; import { getTestKnex } from './get-test-knex.js'; -import ibmdb, { Database } from 'ibm_db'; -import { MongoClient, Db, ObjectId } from 'mongodb'; +import ibmdb from 'ibm_db'; +import { MongoClient, } from 'mongodb'; import { DynamoDB, PutItemCommand, PutItemCommandInput } from '@aws-sdk/client-dynamodb'; -import { BatchWriteCommand, DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb'; +import { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb'; import { Client } from '@elastic/elasticsearch'; import * as cassandra from 'cassandra-driver'; import { v4 as uuidv4 } from 'uuid'; @@ -59,7 +59,7 @@ export async function createTestTable( } const Knex = getTestKnex(connectionParamsCopy); // await Knex.schema.dropTableIfExists(testTableName); - await Knex.schema.createTable(testTableName, function (table) { + await Knex.schema.createTable(testTableName, (table) => { table.increments(); table.string(testTableColumnName); table.string(testTableSecondColumnName); @@ -67,7 +67,7 @@ export async function createTestTable( }); if (withJsonField) { - await Knex.schema.table(testTableName, function (table) { + await Knex.schema.table(testTableName, (table) => { table.json('json_field'); table.jsonb('jsonb_field'); }); @@ -82,7 +82,7 @@ export async function createTestTable( // hslColorColumns, // email columns already exists as some of the test columns if (withWidgetsData) { - await Knex.schema.table(testTableName, function (table) { + await Knex.schema.table(testTableName, (table) => { table.string('telephone'); table.string('uuid'); table.string('countryCode'); @@ -149,7 +149,7 @@ async function createTestElasticsearchTable( }, }; const client = new Client(options); - const response = await client.indices.create({ + const _response = await client.indices.create({ index: testTableName, }); await client.indices.putMapping({ @@ -361,7 +361,7 @@ export async function createTestTableForMSSQLWithChema( connectionParams, testEntitiesSeedsCount = 42, testSearchedUserName = 'Vasia', - schemaName = 'test_chema', + _schemaName = 'test_chema', ) { const testTableName = getRandomTestTableName(); const testTableColumnName = `${faker.lorem.words(1)}_${faker.lorem.words(1)}`; @@ -377,7 +377,7 @@ EXEC('CREATE SCHEMA [test_schema]');`); } await Knex.schema.dropTableIfExists(`test_schema.${testTableName}`); - await Knex.schema.createTable(`test_schema.${testTableName}`, function (table) { + await Knex.schema.createTable(`test_schema.${testTableName}`, (table) => { table.increments(); table.string(testTableColumnName); table.string(testTableSecondColumnName); @@ -426,14 +426,14 @@ export async function createTestOracleTable( const testTableName = getRandomTestTableName().toUpperCase(); const Knex = getTestKnex(connectionParams); await Knex.schema.dropTableIfExists(testTableName); - await Knex.schema.createTable(testTableName, function (table) { + await Knex.schema.createTable(testTableName, (table) => { table.integer(pColumnName); table.string(testTableColumnName); table.string(testTableSecondColumnName); table.timestamp('created_at'); table.date('updated_at'); }); - await Knex.schema.alterTable(testTableName, function (t) { + await Knex.schema.alterTable(testTableName, (t) => { t.primary([pColumnName], primaryKeyConstraintName); }); let counter = 0; @@ -496,16 +496,16 @@ export async function createTestOracleTableWithDifferentData( testEntitiesSeedsCount = 42, testSearchedUserName = 'Vasia', ) { - const primaryKeyConstraintName = getRandomConstraintName(); - const pColumnName = 'id'; - const testTableColumnName = 'name'; - const testTableSecondColumnName = 'email'; + const _primaryKeyConstraintName = getRandomConstraintName(); + const _pColumnName = 'id'; + const _testTableColumnName = 'name'; + const _testTableSecondColumnName = 'email'; const { shema, username } = connectionParams; const testTableName = getRandomTestTableName().toUpperCase(); const Knex = getTestKnex(connectionParams); await Knex.schema.dropTableIfExists(testTableName); - await Knex.schema.createTable(testTableName, function (table) { + await Knex.schema.createTable(testTableName, (table) => { table.specificType('patient_id', 'RAW(16) DEFAULT SYS_GUID()').primary(); table.string('first_name', 100).notNullable(); table.string('last_name', 100).notNullable(); @@ -522,11 +522,11 @@ export async function createTestOracleTableWithDifferentData( await Knex.raw( `ALTER TABLE ${testTableName} ADD CONSTRAINT chk_gender_${testTableName} CHECK ("gender" IN ('M','F','O'))`, ); - } catch (error) { + } catch (_error) { console.log('Warning: Could not add CHECK constraint for gender field'); } - let counter = 0; + let _counter = 0; if (shema) { for (let i = 0; i < testEntitiesSeedsCount; i++) { @@ -608,7 +608,7 @@ export async function createTestPostgresTableWithSchema( await Knex.schema.createSchemaIfNotExists(testSchema); await Knex.schema.withSchema(testSchema).dropTableIfExists(testSchema); - await Knex.schema.withSchema(testSchema).createTable(testTableName, function (table) { + await Knex.schema.withSchema(testSchema).createTable(testTableName, (table) => { table.increments(); table.string(testTableColumnName); table.string(testTableSecondColumnName); @@ -834,7 +834,7 @@ async function createTestRedisTable( port: connectionParams.port, ca: connectionParams.cert || undefined, cert: connectionParams.cert || undefined, - rejectUnauthorized: connectionParams.ssl === false ? false : true, + rejectUnauthorized: connectionParams.ssl !==false, }, password: connectionParams.password || undefined, }); diff --git a/backend/test/utils/drop-test-tables.ts b/backend/test/utils/drop-test-tables.ts index c48bbc5d..56e5fd95 100644 --- a/backend/test/utils/drop-test-tables.ts +++ b/backend/test/utils/drop-test-tables.ts @@ -1,4 +1,4 @@ -import { getDataAccessObject } from '@rocketadmin/shared-code/dist/src/data-access-layer/shared/create-data-access-object.js'; + import { getTestKnex } from './get-test-knex.js'; export async function dropTestTables(tableNames: Array, connectionParams): Promise { diff --git a/backend/test/utils/test-utilities/create-test-ibmdb2-tables.ts b/backend/test/utils/test-utilities/create-test-ibmdb2-tables.ts index 2fd88448..f71671d0 100644 --- a/backend/test/utils/test-utilities/create-test-ibmdb2-tables.ts +++ b/backend/test/utils/test-utilities/create-test-ibmdb2-tables.ts @@ -1,4 +1,4 @@ -import ibmdb, { Database } from 'ibm_db'; +import ibmdb from 'ibm_db'; import { TableCreationResult } from '../../ava-tests/complex-table-tests/complex-ibmdb2-table-e2e.test.js'; export const createTestIBMDB2TablesWithComplexPFKeys = async (connectionParams: any): Promise => { diff --git a/backend/test/utils/test.utils.ts b/backend/test/utils/test.utils.ts index d6d25970..ee3f2971 100644 --- a/backend/test/utils/test.utils.ts +++ b/backend/test/utils/test.utils.ts @@ -5,7 +5,6 @@ import jwt from 'jsonwebtoken'; import { SchedulerRegistry } from '@nestjs/schedule'; @Injectable() -// @ts-ignore export class TestUtils { databaseService: DatabaseService; schedulerRegistry: SchedulerRegistry; @@ -54,12 +53,12 @@ export class TestUtils { } { const tokenValue = token.split('=')[1].split(';')[0]; const jwtSecret = process.env.JWT_SECRET; - const data = jwt.verify(tokenValue, jwtSecret); + const data = jwt.verify(tokenValue, jwtSecret) as jwt.JwtPayload; return { - sub: data['id'], - email: data['email'], - exp: data['exp'], - iat: data['iat'], + sub: data.id, + email: data.email, + exp: data.exp, + iat: data.iat, }; } @@ -88,14 +87,6 @@ export class TestUtils { } } - private async cleanAll() { - try { - await this.databaseService.dropDatabase(); - } catch (error) { - throw new Error(`ERROR: Cleaning test db: ${error}`); - } - } - sleep(ms = 1000): Promise { return new Promise((resolve) => { setTimeout(() => { diff --git a/backend/test/utils/user-with-different-permissions-utils.ts b/backend/test/utils/user-with-different-permissions-utils.ts index b58da857..215e5630 100644 --- a/backend/test/utils/user-with-different-permissions-utils.ts +++ b/backend/test/utils/user-with-different-permissions-utils.ts @@ -98,7 +98,7 @@ export async function createConnectionsAndInviteNewUserInNewGroupWithGroupPermis ], }; - const createOrUpdatePermissionResponse = await request(app.getHttpServer()) + const _createOrUpdatePermissionResponse = await request(app.getHttpServer()) .put(`/permissions/${groupId}?connectionId=${connectionsId.firstId}`) .send({ permissions }) .set('Cookie', connectionAdminUserToken) @@ -231,7 +231,7 @@ export async function createConnectionsAndInviteNewUserInNewGroupWithOnlyTablePe ], }; - const createOrUpdatePermissionResponse = await request(app.getHttpServer()) + const _createOrUpdatePermissionResponse = await request(app.getHttpServer()) .put(`/permissions/${groupId}?connectionId=${connectionsId.firstId}`) .send({ permissions }) .set('Cookie', connectionAdminUserToken) @@ -378,7 +378,7 @@ export async function createConnectionsAndInviteNewUserInNewGroupWithTableDiffer ], }; - const createOrUpdatePermissionResponse = await request(app.getHttpServer()) + const _createOrUpdatePermissionResponse = await request(app.getHttpServer()) .put(`/permissions/${groupId}?connectionId=${connectionsId.firstId}`) .send({ permissions }) .set('Cookie', connectionAdminUserToken) @@ -446,11 +446,11 @@ export async function createConnectionsAndInviteNewUserInAdminGroupOfFirstConnec const newConnection = mockFactory.generateConnectionToTestPostgresDBInDocker(); const newConnection2 = mockFactory.generateConnectionToTestMySQLDBInDocker(); - const newGroup1 = mockFactory.generateCreateGroupDto1(); + const _newGroup1 = mockFactory.generateCreateGroupDto1(); const firstTable = await createTestTable(newConnection); const secondTable = await createTestTable(newConnection2); - const tablePermissions = { + const _tablePermissions = { visibility: true, readonly: false, add: true, diff --git a/biome.json b/biome.json index db9e07e7..aad5ad1e 100644 --- a/biome.json +++ b/biome.json @@ -56,16 +56,16 @@ "complexity": { "noAdjacentSpacesInRegex": "error", "noArguments": "error", - "noBannedTypes": "off", - "noCommaOperator": "off", + "noBannedTypes": "on", + "noCommaOperator": "on", "noEmptyTypeParameters": "error", "noExtraBooleanCast": "error", "noFlatMapIdentity": "error", - "noStaticOnlyClass": "off", - "noThisInStatic": "off", - "noUselessCatch": "off", - "noUselessConstructor": "off", - "noUselessContinue": "off", + "noStaticOnlyClass": "on", + "noThisInStatic": "on", + "noUselessCatch": "on", + "noUselessConstructor": "on", + "noUselessContinue": "on", "noUselessEmptyExport": "error", "noUselessEscapeInRegex": "error", "noUselessFragments": "error", @@ -74,18 +74,18 @@ "noUselessRename": "error", "noUselessStringRaw": "error", "noUselessSwitchCase": "error", - "noUselessTernary": "off", + "noUselessTernary": "on", "noUselessThisAlias": "error", "noUselessTypeConstraint": "error", - "noUselessUndefinedInitialization": "off", + "noUselessUndefinedInitialization": "on", "noVoid": "error", - "useArrowFunction": "off", + "useArrowFunction": "on", "useDateNow": "error", - "useFlatMap": "off", - "useIndexOf": "off", - "useLiteralKeys": "off", + "useFlatMap": "on", + "useIndexOf": "on", + "useLiteralKeys": "on", "useNumericLiterals": "error", - "useOptionalChain": "off", + "useOptionalChain": "on", "useRegexLiterals": "error", "useSimpleNumberKeys": "error" }, @@ -111,15 +111,15 @@ "noUnreachableSuper": "error", "noUnsafeFinally": "error", "noUnsafeOptionalChaining": "error", - "noUnusedFunctionParameters": "off", - "noUnusedImports": "off", + "noUnusedFunctionParameters": "on", + "noUnusedImports": "on", "noUnusedLabels": "error", - "noUnusedPrivateClassMembers": "off", - "noUnusedVariables": "off", + "noUnusedPrivateClassMembers": "on", + "noUnusedVariables": "on", "noVoidElementsWithChildren": "error", "noVoidTypeReturn": "error", "useIsNan": "error", - "useParseIntRadix": "off", + "useParseIntRadix": "on", "useValidForDirection": "error", "useValidTypeof": "error", "useYield": "error" @@ -141,12 +141,12 @@ "noCommentText": "error", "noCompareNegZero": "error", "noConfusingLabels": "error", - "noConfusingVoidType": "off", + "noConfusingVoidType": "on", "noConstEnum": "error", "noControlCharactersInRegex": "off", "noDebugger": "error", - "noDocumentCookie": "off", - "noDoubleEquals": "off", + "noDocumentCookie": "on", + "noDoubleEquals": "on", "noDuplicateCase": "error", "noDuplicateClassMembers": "error", "noDuplicateElseIf": "error", @@ -154,13 +154,13 @@ "noDuplicateObjectKeys": "error", "noDuplicateParameters": "error", "noEmptyInterface": "error", - "noExplicitAny": "off", + "noExplicitAny": "on", "noExtraNonNullAssertion": "error", "noFallthroughSwitchClause": "error", "noFunctionAssign": "error", "noGlobalAssign": "error", "noGlobalIsFinite": "error", - "noGlobalIsNan": "off", + "noGlobalIsNan": "on", "noHeadImportInDocument": "error", "noImplicitAnyLet": "off", "noImportAssign": "error", @@ -171,7 +171,7 @@ "noMisrefactoredShorthandAssign": "error", "noNonNullAssertedOptionalChain": "error", "noOctalEscape": "error", - "noPrototypeBuiltins": "off", + "noPrototypeBuiltins": "on", "noRedeclare": "error", "noRedundantUseStrict": "error", "noSelfCompare": "error", @@ -180,14 +180,14 @@ "noSuspiciousSemicolonInJsx": "error", "noTemplateCurlyInString": "error", "noThenProperty": "error", - "noTsIgnore": "off", + "noTsIgnore": "on", "noUnsafeDeclarationMerging": "error", "noUnsafeNegation": "error", "noUselessEscapeInString": "error", "noUselessRegexBackrefs": "error", "noWith": "error", "useAdjacentOverloadSignatures": "error", - "useAwait": "off", + "useAwait": "on", "useDefaultSwitchClauseLast": "error", "useGetterReturn": "error", "useGoogleFontDisplay": "error", diff --git a/frontend/karma.conf.js b/frontend/karma.conf.js index 1a996701..4f7b304a 100644 --- a/frontend/karma.conf.js +++ b/frontend/karma.conf.js @@ -1,7 +1,7 @@ // Karma configuration file, see link for more information // https://karma-runner.github.io/1.0/config/configuration-file.html -module.exports = function (config) { +module.exports = (config) => { config.set({ basePath: '', frameworks: ['jasmine', '@angular-devkit/build-angular'], diff --git a/frontend/src/app/app.component.spec.ts b/frontend/src/app/app.component.spec.ts index 62999964..0a1ca405 100644 --- a/frontend/src/app/app.component.spec.ts +++ b/frontend/src/app/app.component.spec.ts @@ -128,13 +128,13 @@ describe('AppComponent', () => { fixture.detectChanges(); spyOn(app, 'logOut'); - spyOn(app['router'], 'navigate'); + spyOn(app.router, 'navigate'); }); afterEach(() => { localStorage.removeItem('token_expiration'); (app.logOut as jasmine.Spy)?.calls.reset?.(); - (app['router'].navigate as jasmine.Spy)?.calls.reset?.(); + (app.router.navigate as jasmine.Spy)?.calls.reset?.(); mockUiSettingsService.getUiSettings.calls.reset?.(); mockCompanyService.getWhiteLabelProperties.calls.reset?.(); mockUserService.fetchUser.calls.reset?.(); @@ -243,7 +243,7 @@ describe('AppComponent', () => { ['detectChanges', 'markForCheck', 'detach', 'checkNoChanges', 'reattach'] ); - app['changeDetector'] = mockChangeDetectorRef; // inject mock manually if needed + app.changeDetector = mockChangeDetectorRef; // inject mock manually if needed app.setUserLoggedIn(true); @@ -256,7 +256,7 @@ describe('AppComponent', () => { mockUiSettingsService.getUiSettings.and.returnValue(of({globalSettings: {lastFeatureNotificationId: 'old-id'}})); const expirationDate = new Date(Date.now() + 10_000); // 10s from now - app['currentFeatureNotificationId'] = 'some-id'; + app.currentFeatureNotificationId = 'some-id'; app.ngOnInit(); @@ -294,7 +294,7 @@ describe('AppComponent', () => { tick(5000); expect(app.logOut).toHaveBeenCalledWith(true); - expect(app['router'].navigate).toHaveBeenCalledWith(['/login']); + expect(app.router.navigate).toHaveBeenCalledWith(['/login']); })); it('should immediately log out and navigate to login if token is expired', fakeAsync(() => { @@ -313,6 +313,6 @@ describe('AppComponent', () => { expect(app.initializeUserSession).not.toHaveBeenCalled(); expect(app.logOut).toHaveBeenCalledWith(true); - expect(app['router'].navigate).toHaveBeenCalledWith(['/login']); + expect(app.router.navigate).toHaveBeenCalledWith(['/login']); })); }); diff --git a/frontend/src/app/app.component.ts b/frontend/src/app/app.component.ts index 9e1ab46f..8a9a78cc 100644 --- a/frontend/src/app/app.component.ts +++ b/frontend/src/app/app.component.ts @@ -1,7 +1,7 @@ import { ActivatedRoute, NavigationEnd, Router } from '@angular/router'; import { Angulartics2, Angulartics2Amplitude, Angulartics2OnModule } from 'angulartics2'; -import { ChangeDetectorRef, Component, HostListener, NgZone } from '@angular/core'; -import { catchError, filter, map } from 'rxjs/operators'; +import { ChangeDetectorRef, Component, } from '@angular/core'; +import { filter, } from 'rxjs/operators'; import { AuthService } from './services/auth.service'; import { CommonModule } from '@angular/common'; @@ -31,7 +31,7 @@ import { differenceInMilliseconds } from 'date-fns'; import { environment } from '../environments/environment'; import { version } from './version'; -//@ts-ignore +//@ts-expect-error window.amplitude = amplitude; amplitude.getInstance().init("9afd282be91f94da735c11418d5ff4f5"); @@ -86,15 +86,14 @@ export class AppComponent { public connections: Connection[] = []; constructor ( - private changeDetector: ChangeDetectorRef, + public changeDetector: ChangeDetectorRef, // private ngZone: NgZone, public route: ActivatedRoute, public router: Router, public _connections: ConnectionsService, public _company: CompanyService, public _user: UserService, - public _auth: AuthService, - private _tables: TablesService, + public _auth: AuthService,_tables: TablesService, private _uiSettings: UiSettingsService, angulartics2Amplitude: Angulartics2Amplitude, private angulartics2: Angulartics2, @@ -141,7 +140,7 @@ export class AppComponent { const expirationDateFromURL = new URLSearchParams(location.search).get('expires'); if (expirationDateFromURL) { - const expirationDateString = new Date(parseInt(expirationDateFromURL)); + const expirationDateString = new Date(parseInt(expirationDateFromURL, 10)); localStorage.setItem('token_expiration', expirationDateString.toString()); }; @@ -257,16 +256,16 @@ export class AppComponent { this.isDemo = this.currentUser.email.startsWith('demo_') && this.currentUser.email.endsWith('@rocketadmin.com'); this._user.setIsDemo(this.isDemo); this.setUserLoggedIn(true); - // @ts-ignore + // @ts-expect-error if (typeof window.Intercom !== 'undefined') window.Intercom("boot", { - // @ts-ignore + // @ts-expect-error ...window.intercomSettings, user_hash: res.intercom_hash, user_id: res.id, email: res.email }); - //@ts-ignore + //@ts-expect-error if (this.isDemo) window.hj?.('identify', this.currentUser.id, { 'mode': 'demo' }); @@ -347,7 +346,7 @@ export class AppComponent { logOut(isTokenExpired?: boolean) { try { - // @ts-ignore + // @ts-expect-error google.accounts.id.revoke(this.currentUser.email, done => { console.log('consent revoked'); console.log(done); diff --git a/frontend/src/app/auth.guard.ts b/frontend/src/app/auth.guard.ts index e7849a73..b54f669d 100644 --- a/frontend/src/app/auth.guard.ts +++ b/frontend/src/app/auth.guard.ts @@ -1,4 +1,4 @@ -import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot, UrlTree, Router } from '@angular/router'; +import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot, Router } from '@angular/router'; import { differenceInMilliseconds } from 'date-fns' import { Injectable } from '@angular/core'; @@ -13,8 +13,8 @@ export class AuthGuard implements CanActivate { ) {} async canActivate( - route: ActivatedRouteSnapshot, - state: RouterStateSnapshot + _route: ActivatedRouteSnapshot, + _state: RouterStateSnapshot ) { try { const expirationToken = localStorage.getItem('token_expiration'); diff --git a/frontend/src/app/components/audit/audit-data-source.ts b/frontend/src/app/components/audit/audit-data-source.ts index 0ef494a7..1bc69487 100644 --- a/frontend/src/app/components/audit/audit-data-source.ts +++ b/frontend/src/app/components/audit/audit-data-source.ts @@ -30,11 +30,11 @@ export class AuditDataSource implements DataSource { constructor(private _connections: ConnectionsService) {} - connect(collectionViewer: CollectionViewer): Observable { + connect(_collectionViewer: CollectionViewer): Observable { return this.rowsSubject.asObservable(); } - disconnect(collectionViewer: CollectionViewer): void { + disconnect(_collectionViewer: CollectionViewer): void { this.rowsSubject.complete(); this.loadingSubject.complete(); } @@ -72,11 +72,11 @@ export class AuditDataSource implements DataSource { const date = new Date(log.createdAt); const formattedDate = format(date, "P p") return { - ['Table']: log.table_name, - ['User']: log.email, - ['Action']: actions[log.operationType], - ['Date']: formattedDate, - ['Status']: log.operationStatusResult, + "Table": log.table_name, + "User": log.email, + "Action": actions[log.operationType], + "Date": formattedDate, + "Status": log.operationStatusResult, operationType: log.operationType, createdAt: log.createdAt, prevValue: log.old_data, diff --git a/frontend/src/app/components/audit/audit.component.ts b/frontend/src/app/components/audit/audit.component.ts index efff0fc2..a598c3d6 100644 --- a/frontend/src/app/components/audit/audit.component.ts +++ b/frontend/src/app/components/audit/audit.component.ts @@ -1,6 +1,6 @@ import { AsyncPipe, NgClass, NgForOf, NgIf } from '@angular/common'; import { Component, OnInit, ViewChild } from '@angular/core'; -import { Subscription, merge } from 'rxjs'; +import { merge } from 'rxjs'; import { take, tap } from 'rxjs/operators'; import { Angulartics2OnModule } from 'angulartics2'; @@ -66,7 +66,6 @@ export class AuditComponent implements OnInit { public noTablesError: boolean = false; public dataSource: AuditDataSource = null; - private getTitleSubscription: Subscription; @ViewChild(MatPaginator) paginator: MatPaginator; @@ -140,7 +139,7 @@ export class AuditComponent implements OnInit { } openIntercome() { - // @ts-ignore + // @ts-expect-error Intercom('show'); } } diff --git a/frontend/src/app/components/audit/info-dialog/info-dialog.component.ts b/frontend/src/app/components/audit/info-dialog/info-dialog.component.ts index 7fd51978..32c491ea 100644 --- a/frontend/src/app/components/audit/info-dialog/info-dialog.component.ts +++ b/frontend/src/app/components/audit/info-dialog/info-dialog.component.ts @@ -47,7 +47,7 @@ export class InfoDialogComponent implements OnInit { } }; - if (this.log && this.log.createdAt) { + if (this.log?.createdAt) { const datetime = new Date(this.log.createdAt); this.formattedCrreatedAt = format(datetime, 'PPPpp'); this.action = actions[this.log.Status][this.log.operationType]; diff --git a/frontend/src/app/components/company/company.component.ts b/frontend/src/app/components/company/company.component.ts index e3fe89b6..3e40c235 100644 --- a/frontend/src/app/components/company/company.component.ts +++ b/frontend/src/app/components/company/company.component.ts @@ -346,24 +346,24 @@ export class CompanyComponent { companyLogoFile = null; } - this._company.uploadLogo(this.company.id, companyLogoFile).subscribe(res => { + this._company.uploadLogo(this.company.id, companyLogoFile).subscribe(_res => { this.submittingLogo = false; this.angulartics2.eventTrack.next({ action: 'Company: logo is uploaded successfully', }); - }, err => { + }, _err => { this.submittingLogo = false; }); } removeLogo() { this.submittingLogo = true; - this._company.removeLogo(this.company.id).subscribe(res => { + this._company.removeLogo(this.company.id).subscribe(_res => { this.submittingLogo = false; this.angulartics2.eventTrack.next({ action: 'Company: logo is removed successfully', }); - }, err => { + }, _err => { this.submittingLogo = false; }); } @@ -382,24 +382,24 @@ export class CompanyComponent { faviconFile = null; } - this._company.uploadFavicon(this.company.id, faviconFile).subscribe(res => { + this._company.uploadFavicon(this.company.id, faviconFile).subscribe(_res => { this.submittingFavicon = false; this.angulartics2.eventTrack.next({ action: 'Company: favicon is uploaded successfully', }); - }, err => { + }, _err => { this.submittingFavicon = false; }); } removeFavicon() { this.submittingFavicon = true; - this._company.removeFavicon(this.company.id).subscribe(res => { + this._company.removeFavicon(this.company.id).subscribe(_res => { this.submittingFavicon = false; this.angulartics2.eventTrack.next({ action: 'Company: favicon is removed successfully', }); - }, err => { + }, _err => { this.submittingFavicon = false; }); } @@ -411,7 +411,7 @@ export class CompanyComponent { this.angulartics2.eventTrack.next({ action: 'Company: tab title is updated successfully', }); - }, err => { + }, _err => { this.submittingTabTitle = false; }); } diff --git a/frontend/src/app/components/company/revoke-invitation-dialog/revoke-invitation-dialog.component.spec.ts b/frontend/src/app/components/company/revoke-invitation-dialog/revoke-invitation-dialog.component.spec.ts index 0a80fb36..1fd4e931 100644 --- a/frontend/src/app/components/company/revoke-invitation-dialog/revoke-invitation-dialog.component.spec.ts +++ b/frontend/src/app/components/company/revoke-invitation-dialog/revoke-invitation-dialog.component.spec.ts @@ -10,7 +10,7 @@ describe('RevokeInvitationDialogComponent', () => { let component: RevokeInvitationDialogComponent; let fixture: ComponentFixture; - const mockDialogRef = { + const _mockDialogRef = { close: () => { } }; diff --git a/frontend/src/app/components/connect-db/connect-db.component.spec.ts b/frontend/src/app/components/connect-db/connect-db.component.spec.ts index 47458c1c..b8243b6c 100644 --- a/frontend/src/app/components/connect-db/connect-db.component.spec.ts +++ b/frontend/src/app/components/connect-db/connect-db.component.spec.ts @@ -86,9 +86,9 @@ describe('ConnectDBComponent', () => { component = fixture.componentInstance; dialog = TestBed.get(MatDialog); - // @ts-ignore + // @ts-expect-error global.window.fbq = jasmine.createSpy(); - // @ts-ignore + // @ts-expect-error global.window.Intercom = jasmine.createSpy(); fakeConnectionsService.currentConnection.and.returnValue(connectionCredsApp); diff --git a/frontend/src/app/components/connect-db/connect-db.component.ts b/frontend/src/app/components/connect-db/connect-db.component.ts index 43d96fa4..74aef7e0 100644 --- a/frontend/src/app/components/connect-db/connect-db.component.ts +++ b/frontend/src/app/components/connect-db/connect-db.component.ts @@ -4,7 +4,7 @@ import { Alert, AlertActionType, AlertType } from 'src/app/models/alert'; import { Angulartics2, Angulartics2Module } from 'angulartics2'; import { Component, NgZone, OnInit } from '@angular/core'; import { Connection, ConnectionType, DBtype, TestConnection } from 'src/app/models/connection'; -import { Subscription, take } from 'rxjs'; +import { take } from 'rxjs'; import { supportedDatabasesTitles, supportedOrderedDatabases } from 'src/app/consts/databases'; import { AccessLevel } from 'src/app/models/user'; @@ -113,8 +113,6 @@ export class ConnectDBComponent implements OnInit { [DBtype.DB2]: '50000' } - private getTitleSubscription: Subscription; - // public isDemo: boolean = false; public isDemoConnectionWarning: Alert = { @@ -162,7 +160,7 @@ export class ConnectDBComponent implements OnInit { if (!this.connectionID) { this._user.sendUserAction('CONNECTION_CREATION_NOT_FINISHED').subscribe(); if (this.isSaas) { - // @ts-ignore + // @ts-expect-error fbq('trackCustom', 'Add_connection'); } }; @@ -197,7 +195,7 @@ export class ConnectDBComponent implements OnInit { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); }; @@ -306,7 +304,7 @@ export class ConnectDBComponent implements OnInit { }; } - createConnection(connectForm: NgForm) { + createConnection(_connectForm: NgForm) { if (this.db.connectionType === 'direct') { if (this.db.type !== DBtype.Dynamo) { const ipAddressDilaog = this.dialog.open(DbConnectionIpAccessDialogComponent, { @@ -330,12 +328,12 @@ export class ConnectDBComponent implements OnInit { properties: { connectionType: this.db.connectionType, dbType: this.db.type, errorMessage: credsCorrect.message } }); - if (credsCorrect && credsCorrect.result) { + if (credsCorrect?.result) { this.createConnectionRequest(); } else { this.handleConnectionError(credsCorrect.message); }; - } catch (e) { + } catch (_e) { credsCorrect = null; this.submitting = false; } @@ -356,13 +354,13 @@ export class ConnectDBComponent implements OnInit { errorMessage: credsCorrect.message } }); - if (credsCorrect && credsCorrect.result) { + if (credsCorrect?.result) { this.createConnectionRequest(); } else { this.handleConnectionError(credsCorrect.message); } }) - .catch((e) => { + .catch((_e) => { credsCorrect = null; this.submitting = false; }); diff --git a/frontend/src/app/components/connect-db/db-connection-confirm-dialog/db-connection-confirm-dialog.component.ts b/frontend/src/app/components/connect-db/db-connection-confirm-dialog/db-connection-confirm-dialog.component.ts index e8d94bbc..ca056a08 100644 --- a/frontend/src/app/components/connect-db/db-connection-confirm-dialog/db-connection-confirm-dialog.component.ts +++ b/frontend/src/app/components/connect-db/db-connection-confirm-dialog/db-connection-confirm-dialog.component.ts @@ -70,7 +70,7 @@ export class DbConnectionConfirmDialogComponent implements OnInit { } openIntercome() { - // @ts-ignore + // @ts-expect-error Intercom('show'); } } diff --git a/frontend/src/app/components/connection-settings/connection-settings.component.ts b/frontend/src/app/components/connection-settings/connection-settings.component.ts index 0af59ac6..743d010c 100644 --- a/frontend/src/app/components/connection-settings/connection-settings.component.ts +++ b/frontend/src/app/components/connection-settings/connection-settings.component.ts @@ -14,7 +14,7 @@ import { MatSelectModule } from '@angular/material/select'; import { MatSlideToggleModule } from '@angular/material/slide-toggle'; import { RouterModule } from '@angular/router'; import { ServerError } from 'src/app/models/alert'; -import { Subscription, take } from 'rxjs'; +import { take } from 'rxjs'; import { TableProperties } from 'src/app/models/table'; import { TablesService } from 'src/app/services/tables.service'; import { Title } from '@angular/platform-browser'; @@ -69,8 +69,6 @@ export class ConnectionSettingsComponent implements OnInit { public isServerError: boolean = false; public serverError: ServerError; - private getTitleSubscription: Subscription; - constructor( private _connections: ConnectionsService, private _tables: TablesService, @@ -228,7 +226,7 @@ export class ConnectionSettingsComponent implements OnInit { } openIntercome() { - // @ts-ignore + // @ts-expect-error Intercom('show'); } } diff --git a/frontend/src/app/components/connections-list/connections-list.component.ts b/frontend/src/app/components/connections-list/connections-list.component.ts index af77e2cf..f97fcd67 100644 --- a/frontend/src/app/components/connections-list/connections-list.component.ts +++ b/frontend/src/app/components/connections-list/connections-list.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { Connection, ConnectionItem } from 'src/app/models/connection'; +import { Connection, } from 'src/app/models/connection'; import { AlertComponent } from '../ui-components/alert/alert.component'; import { Angulartics2Module } from 'angulartics2'; diff --git a/frontend/src/app/components/dashboard/dashboard.component.ts b/frontend/src/app/components/dashboard/dashboard.component.ts index bde1a415..13acc197 100644 --- a/frontend/src/app/components/dashboard/dashboard.component.ts +++ b/frontend/src/app/components/dashboard/dashboard.component.ts @@ -3,7 +3,7 @@ import { Angulartics2, Angulartics2Module } from 'angulartics2'; import { Component, OnDestroy, OnInit } from '@angular/core'; import { ConnectionSettingsUI, UiSettings } from 'src/app/models/ui-settings'; import { CustomEvent, TableProperties } from 'src/app/models/table'; -import { first, map } from 'rxjs/operators'; +import { map } from 'rxjs/operators'; import { AlertComponent } from '../ui-components/alert/alert.component'; import { BannerComponent } from '../ui-components/banner/banner.component'; @@ -251,8 +251,8 @@ export class DashboardComponent implements OnInit, OnDestroy { const queryParams = this.route.snapshot.queryParams; this.filters = JsonURL.parse(queryParams.filters); this.comparators = getComparatorsFromUrl(this.filters); - this.pageIndex = parseInt(queryParams.page_index) || 0; - this.pageSize = parseInt(queryParams.page_size) || 30; + this.pageIndex = parseInt(queryParams.page_index, 10) || 0; + this.pageSize = parseInt(queryParams.page_size, 10) || 30; this.sortColumn = queryParams.sort_active; this.sortOrder = queryParams.sort_direction; @@ -260,7 +260,7 @@ export class DashboardComponent implements OnInit, OnDestroy { this.getRows(search); console.log('getRows from setTable'); - const selectedTableProperties = this.tablesList.find( (table: any) => table.table == this.selectedTableName); + const selectedTableProperties = this.tablesList.find( (table: any) => table.table === this.selectedTableName); if (selectedTableProperties) { this.selectedTableDisplayName = selectedTableProperties.display_name || normalizeTableName(selectedTableProperties.table); } else { @@ -404,7 +404,7 @@ export class DashboardComponent implements OnInit, OnDestroy { } openIntercome() { - // @ts-ignore + // @ts-expect-error Intercom('show'); } @@ -417,7 +417,7 @@ export class DashboardComponent implements OnInit, OnDestroy { } else { this._tables.activateActions(this.connectionID, this.selectedTableName, action.id, action.title, primaryKeys) .subscribe((res) => { - if (res && res.location) this.dialog.open(DbActionLinkDialogComponent, { + if (res?.location) this.dialog.open(DbActionLinkDialogComponent, { width: '25em', data: {href: res.location, actionName: action.title, primaryKeys: primaryKeys[0]} }) diff --git a/frontend/src/app/components/dashboard/db-table-view/db-bulk-action-confirmation-dialog/db-bulk-action-confirmation-dialog.component.ts b/frontend/src/app/components/dashboard/db-table-view/db-bulk-action-confirmation-dialog/db-bulk-action-confirmation-dialog.component.ts index d7b65d45..f765d052 100644 --- a/frontend/src/app/components/dashboard/db-table-view/db-bulk-action-confirmation-dialog/db-bulk-action-confirmation-dialog.component.ts +++ b/frontend/src/app/components/dashboard/db-table-view/db-bulk-action-confirmation-dialog/db-bulk-action-confirmation-dialog.component.ts @@ -54,7 +54,7 @@ export class BbBulkActionConfirmationDialogComponent implements OnInit { .subscribe( (res) => { this.onActionsComplete(); - if (res && res.location) this.dialog.open(DbActionLinkDialogComponent, { + if (res?.location) this.dialog.open(DbActionLinkDialogComponent, { width: '25em', data: {href: res.location, actionName: this.data.title, primaryKeys: this.data.primaryKeys[0]} }) diff --git a/frontend/src/app/components/dashboard/db-table-view/db-table-actions/db-table-actions.component.spec.ts b/frontend/src/app/components/dashboard/db-table-view/db-table-actions/db-table-actions.component.spec.ts index 444ef858..28918707 100644 --- a/frontend/src/app/components/dashboard/db-table-view/db-table-actions/db-table-actions.component.spec.ts +++ b/frontend/src/app/components/dashboard/db-table-view/db-table-actions/db-table-actions.component.spec.ts @@ -3,7 +3,7 @@ import { MatDialog, MatDialogModule } from '@angular/material/dialog'; import { ActionDeleteDialogComponent } from './action-delete-dialog/action-delete-dialog.component'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; -import { CustomActionMethod, CustomActionType } from 'src/app/models/table'; +import { CustomActionMethod, } from 'src/app/models/table'; import { DbTableActionsComponent } from './db-table-actions.component'; import { MatSnackBarModule } from '@angular/material/snack-bar'; import { NotificationsService } from 'src/app/services/notifications.service'; diff --git a/frontend/src/app/components/dashboard/db-table-view/db-table-actions/db-table-actions.component.ts b/frontend/src/app/components/dashboard/db-table-view/db-table-actions/db-table-actions.component.ts index 8a2d9c08..97a38fdf 100644 --- a/frontend/src/app/components/dashboard/db-table-view/db-table-actions/db-table-actions.component.ts +++ b/frontend/src/app/components/dashboard/db-table-view/db-table-actions/db-table-actions.component.ts @@ -1,4 +1,4 @@ -import { AlertActionType, AlertType } from 'src/app/models/alert'; + import { Angulartics2, Angulartics2OnModule } from 'angulartics2'; import { Component, OnInit } from '@angular/core'; import { CustomAction, CustomActionMethod, CustomActionType, CustomEvent, EventType, Rule } from 'src/app/models/table'; @@ -271,7 +271,7 @@ export class DbTableActionsComponent implements OnInit { } removeRuleFromLocalList(ruleTitle: string) { - this.rules = this.rules.filter((rule: Rule) => rule.title != ruleTitle); + this.rules = this.rules.filter((rule: Rule) => rule.title !== ruleTitle); if (this.rules.length) this.setSelectedRule(this.rules[0]); } diff --git a/frontend/src/app/components/dashboard/db-table-view/db-table-export-dialog/db-table-export-dialog.component.ts b/frontend/src/app/components/dashboard/db-table-view/db-table-export-dialog/db-table-export-dialog.component.ts index 83152195..dfb4e64b 100644 --- a/frontend/src/app/components/dashboard/db-table-view/db-table-export-dialog/db-table-export-dialog.component.ts +++ b/frontend/src/app/components/dashboard/db-table-view/db-table-export-dialog/db-table-export-dialog.component.ts @@ -24,7 +24,7 @@ import { MatRadioModule } from '@angular/material/radio'; }) export class DbTableExportDialogComponent { - public recordsNumber: Number = 10; + public recordsNumber: number = 10; public recordsExportType: string = 'export-all'; public submitting: boolean = false; @@ -53,7 +53,7 @@ export class DbTableExportDialogComponent { action: 'Dashboard: db export is successful', }); }, - err => { this.submitting = false; }, + _err => { this.submitting = false; }, () => { this.submitting = false; }); } diff --git a/frontend/src/app/components/dashboard/db-table-view/db-table-filters-dialog/db-table-filters-dialog.component.spec.ts b/frontend/src/app/components/dashboard/db-table-view/db-table-filters-dialog/db-table-filters-dialog.component.spec.ts index 79b84e37..970aff59 100644 --- a/frontend/src/app/components/dashboard/db-table-view/db-table-filters-dialog/db-table-filters-dialog.component.spec.ts +++ b/frontend/src/app/components/dashboard/db-table-view/db-table-filters-dialog/db-table-filters-dialog.component.spec.ts @@ -154,7 +154,7 @@ describe('DbTableFiltersDialogComponent', () => { component.tableRowFieldsShown = { name: 'John' }; component.updateField('new user name', 'name'); - expect(component.tableRowFieldsShown['name']).toEqual('new user name'); + expect(component.tableRowFieldsShown.name).toEqual('new user name'); }) it('should reset filters', () => { diff --git a/frontend/src/app/components/dashboard/db-table-view/db-table-filters-dialog/db-table-filters-dialog.component.ts b/frontend/src/app/components/dashboard/db-table-view/db-table-filters-dialog/db-table-filters-dialog.component.ts index 177217d3..7bad098d 100644 --- a/frontend/src/app/components/dashboard/db-table-view/db-table-filters-dialog/db-table-filters-dialog.component.ts +++ b/frontend/src/app/components/dashboard/db-table-view/db-table-filters-dialog/db-table-filters-dialog.component.ts @@ -18,7 +18,7 @@ import { getComparatorsFromUrl, getFiltersFromUrl } from 'src/app/lib/parse-filt import { getTableTypes } from 'src/app/lib/setup-table-row-structure'; import * as JSON5 from 'json5'; import { map, startWith } from 'rxjs/operators'; -import { Observable, Subject } from 'rxjs'; +import { Observable, } from 'rxjs'; import { FormControl } from '@angular/forms'; import JsonURL from "@jsonurl/jsonurl"; import { DynamicModule } from 'ng-dynamic-component'; @@ -58,7 +58,7 @@ export class DbTableFiltersDialogComponent implements OnInit { public tableRowFields: Object; public tableRowStructure: Object; - public tableRowFieldsShown: Object = {}; + public tableRowFieldsShown: Record = {}; public tableRowFieldsComparator: Object = {}; public tableForeignKeys: {[key: string]: TableForeignKey}; public tableFiltersCount: number; @@ -162,7 +162,7 @@ export class DbTableFiltersDialogComponent implements OnInit { ); } - trackByFn(index: number, item: any) { + trackByFn(_index: number, item: any) { return item.key; // or item.id } diff --git a/frontend/src/app/components/dashboard/db-table-view/db-table-import-dialog/db-table-import-dialog.component.ts b/frontend/src/app/components/dashboard/db-table-view/db-table-import-dialog/db-table-import-dialog.component.ts index adb24f57..6b3386a1 100644 --- a/frontend/src/app/components/dashboard/db-table-view/db-table-import-dialog/db-table-import-dialog.component.ts +++ b/frontend/src/app/components/dashboard/db-table-view/db-table-import-dialog/db-table-import-dialog.component.ts @@ -36,14 +36,14 @@ export class DbTableImportDialogComponent { importCSV() { this.submitting = true; - this._tables.importTableCSV(this.data.connectionID, this.data.tableName, this.file).subscribe(res => { + this._tables.importTableCSV(this.data.connectionID, this.data.tableName, this.file).subscribe(_res => { this.dialogRef.close(); this.submitting = false; this.angulartics2.eventTrack.next({ action: 'Dashboard: db import is successful', }); }, - err => {this.submitting = false; }, + _err => {this.submitting = false; }, () => { this.submitting = false; } ); } diff --git a/frontend/src/app/components/dashboard/db-table-view/db-table-row-view/db-table-row-view.component.ts b/frontend/src/app/components/dashboard/db-table-view/db-table-row-view/db-table-row-view.component.ts index d533b9fc..3e729f0b 100644 --- a/frontend/src/app/components/dashboard/db-table-view/db-table-row-view/db-table-row-view.component.ts +++ b/frontend/src/app/components/dashboard/db-table-view/db-table-row-view/db-table-row-view.component.ts @@ -76,7 +76,7 @@ export class DbTableRowViewComponent implements OnInit, OnDestroy { console.log('Selected row:', this.selectedRow); - if (row && row.columnsOrder) { + if (row?.columnsOrder) { const columnsOrder = this.selectedRow.columnsOrder.length ? this.selectedRow.columnsOrder : Object.keys(this.selectedRow.record); this.columns = columnsOrder.map(column => { @@ -278,7 +278,7 @@ export class DbTableRowViewComponent implements OnInit, OnDestroy { if (this.selectedRow) { const params = {}; for (const key in this.selectedRow.primaryKeys) { - if (this.selectedRow.primaryKeys.hasOwnProperty(key)) { + if (Object.hasOwn(this.selectedRow.primaryKeys, key)) { if (this.selectedRow.foreignKeysList.includes(key)) { const referencedColumnName = this.selectedRow.foreignKeys[key].referenced_column_name; params[key] = this.selectedRow.record[key][referencedColumnName]; @@ -299,7 +299,7 @@ export class DbTableRowViewComponent implements OnInit, OnDestroy { const paramsObj = this.getDedicatedPageLinkParams(); const params = new URLSearchParams(); for (const key in paramsObj) { - if (paramsObj.hasOwnProperty(key)) { + if (Object.hasOwn(paramsObj, key)) { params.set(key, paramsObj[key]); } } diff --git a/frontend/src/app/components/dashboard/db-table-view/db-table-settings/db-table-settings.component.ts b/frontend/src/app/components/dashboard/db-table-view/db-table-settings/db-table-settings.component.ts index 20bb0ebf..bb582fbe 100644 --- a/frontend/src/app/components/dashboard/db-table-view/db-table-settings/db-table-settings.component.ts +++ b/frontend/src/app/components/dashboard/db-table-view/db-table-settings/db-table-settings.component.ts @@ -1,5 +1,5 @@ import {CdkDragDrop, moveItemInArray} from '@angular/cdk/drag-drop'; -import { Component, Inject, OnInit } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; import { TableField, TableOrdering, TableSettings } from 'src/app/models/table'; import { AlertComponent } from '../../../ui-components/alert/alert.component'; @@ -148,7 +148,7 @@ export class DbTableSettingsComponent implements OnInit { } else { this.tableSettings = this.tableSettingsInitial; }; - if (Object.keys(res).length === 0 || (res && res.list_fields && !res.list_fields.length)) { + if (Object.keys(res).length === 0 || (res?.list_fields && !res.list_fields.length)) { this.listFieldsOrder = [...this.fields]; }; this.title.setTitle(`${res.display_name || this.displayTableName} - Table settings | ${this._company.companyTabTitle || 'Rocketadmin'}`); diff --git a/frontend/src/app/components/dashboard/db-table-view/db-table-view.component.spec.ts b/frontend/src/app/components/dashboard/db-table-view/db-table-view.component.spec.ts index 5dbea58e..85457108 100644 --- a/frontend/src/app/components/dashboard/db-table-view/db-table-view.component.spec.ts +++ b/frontend/src/app/components/dashboard/db-table-view/db-table-view.component.spec.ts @@ -18,7 +18,7 @@ describe('DbTableViewComponent', () => { let component: DbTableViewComponent; let fixture: ComponentFixture; - const mockWidgets = { + const _mockWidgets = { "Region": { "id": "c768dde8-7348-46e8-a522-718a29b705e8", "field_name": "Region", @@ -50,7 +50,7 @@ describe('DbTableViewComponent', () => { } } - const mockSelectOption = { + const _mockSelectOption = { "Region": [ { "value": "AK", diff --git a/frontend/src/app/components/dashboard/db-table-view/db-table-view.component.ts b/frontend/src/app/components/dashboard/db-table-view/db-table-view.component.ts index eb329e76..84f8f9c0 100644 --- a/frontend/src/app/components/dashboard/db-table-view/db-table-view.component.ts +++ b/frontend/src/app/components/dashboard/db-table-view/db-table-view.component.ts @@ -231,7 +231,7 @@ export class DbTableViewComponent implements OnInit { } ngOnChanges(changes: SimpleChanges) { - if (changes.name && changes.name.currentValue && this.paginator) { + if (changes.name?.currentValue && this.paginator) { this.paginator.pageIndex = 0; this.searchString = ''; } @@ -319,15 +319,15 @@ export class DbTableViewComponent implements OnInit { const displayedName = normalizeTableName(activeFilter.key); const comparator = Object.keys(activeFilter.value)[0]; const filterValue = Object.values(activeFilter.value)[0]; - if (comparator == 'startswith') { + if (comparator === 'startswith') { return `${displayedName} = ${filterValue}...` - } else if (comparator == 'endswith') { + } else if (comparator === 'endswith') { return `${displayedName} = ...${filterValue}` - } else if (comparator == 'contains') { + } else if (comparator === 'contains') { return `${displayedName} = ...${filterValue}...` - } else if (comparator == 'icontains') { + } else if (comparator === 'icontains') { return `${displayedName} != ...${filterValue}...` - } else if (comparator == 'empty') { + } else if (comparator === 'empty') { return `${displayedName} = ' '` } else { return `${displayedName} ${this.displayedComparators[Object.keys(activeFilter.value)[0]]} ${filterValue}` @@ -514,7 +514,7 @@ export class DbTableViewComponent implements OnInit { this._notifications.showSuccessSnackbar(message); } - switchTable(e) { + switchTable(_e) { } @@ -534,7 +534,7 @@ export class DbTableViewComponent implements OnInit { if (typeof value === 'object') { try { value = JSON.stringify(value); - } catch (e) { + } catch (_e) { value = '[Object]'; } } diff --git a/frontend/src/app/components/dashboard/db-table-view/db-table-widgets/db-table-widgets.component.ts b/frontend/src/app/components/dashboard/db-table-view/db-table-widgets/db-table-widgets.component.ts index bad5d0f7..0fe5da5b 100644 --- a/frontend/src/app/components/dashboard/db-table-view/db-table-widgets/db-table-widgets.component.ts +++ b/frontend/src/app/components/dashboard/db-table-view/db-table-widgets/db-table-widgets.component.ts @@ -29,7 +29,6 @@ import { TextEditComponent } from '../../../ui-components/record-edit-fields/tex import { Title } from '@angular/platform-browser'; import { UIwidgets } from "src/app/consts/record-edit-types"; import { UiSettingsService } from 'src/app/services/ui-settings.service'; -import { UrlEditComponent } from '../../../ui-components/record-edit-fields/url/url.component'; import { WidgetComponent } from './widget/widget.component'; import { WidgetDeleteDialogComponent } from './widget-delete-dialog/widget-delete-dialog.component'; import { difference } from "lodash"; @@ -299,7 +298,7 @@ export class DbTableWidgetsComponent implements OnInit { this.tableName = this._tables.currentTableName; this.widgetsWithSettings = Object .entries(this.defaultParams) - .filter(([key, value]) => value !== '// No settings required') + .filter(([_key, value]) => value !== '// No settings required') .map(widgetDefault => widgetDefault[0]); this._tables.fetchTableStructure(this.connectionID, this.tableName) diff --git a/frontend/src/app/components/dashboard/db-table-view/db-table-widgets/widget-delete-dialog/widget-delete-dialog.component.ts b/frontend/src/app/components/dashboard/db-table-view/db-table-widgets/widget-delete-dialog/widget-delete-dialog.component.ts index 5eb5f792..33ae6c6b 100644 --- a/frontend/src/app/components/dashboard/db-table-view/db-table-widgets/widget-delete-dialog/widget-delete-dialog.component.ts +++ b/frontend/src/app/components/dashboard/db-table-view/db-table-widgets/widget-delete-dialog/widget-delete-dialog.component.ts @@ -13,8 +13,7 @@ import { MatIconModule } from '@angular/material/icon'; export class WidgetDeleteDialogComponent implements OnInit { constructor( - @Inject(MAT_DIALOG_DATA) public widgetFieldName: any, - private dialogRef: MatDialogRef + @Inject(MAT_DIALOG_DATA) public widgetFieldName: any,_dialogRef: MatDialogRef ) { } ngOnInit(): void { diff --git a/frontend/src/app/components/dashboard/db-table-view/db-table-widgets/widget/widget.component.ts b/frontend/src/app/components/dashboard/db-table-view/db-table-widgets/widget/widget.component.ts index fd33103e..5a61eeca 100644 --- a/frontend/src/app/components/dashboard/db-table-view/db-table-widgets/widget/widget.component.ts +++ b/frontend/src/app/components/dashboard/db-table-view/db-table-widgets/widget/widget.component.ts @@ -8,7 +8,6 @@ import { MatFormFieldModule } from '@angular/material/form-field'; import { MatIconModule } from '@angular/material/icon'; import { MatInputModule } from '@angular/material/input'; import { MatSelectModule } from '@angular/material/select'; -import { T } from '@angular/cdk/portal-directives.d-BoG39gYN'; import { Widget } from 'src/app/models/table'; @Component({ diff --git a/frontend/src/app/components/dashboard/db-table-view/saved-filters-panel/saved-filters-dialog/saved-filters-dialog.component.spec.ts b/frontend/src/app/components/dashboard/db-table-view/saved-filters-panel/saved-filters-dialog/saved-filters-dialog.component.spec.ts index 139a26fe..5d890f1a 100644 --- a/frontend/src/app/components/dashboard/db-table-view/saved-filters-panel/saved-filters-dialog/saved-filters-dialog.component.spec.ts +++ b/frontend/src/app/components/dashboard/db-table-view/saved-filters-panel/saved-filters-dialog/saved-filters-dialog.component.spec.ts @@ -1,4 +1,4 @@ -import { ActivatedRoute, RouterModule } from '@angular/router'; +import { ActivatedRoute, } from '@angular/router'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; @@ -14,7 +14,7 @@ describe('SavedFiltersDialogComponent', () => { let component: SavedFiltersDialogComponent; let fixture: ComponentFixture; let tablesServiceMock: jasmine.SpyObj; - let connectionsServiceMock: jasmine.SpyObj; + let _connectionsServiceMock: jasmine.SpyObj; beforeEach(async () => { const tableSpy = jasmine.createSpyObj('TablesService', ['cast', 'createSavedFilter', 'deleteSavedFilter', 'updateSavedFilter']); @@ -61,7 +61,7 @@ describe('SavedFiltersDialogComponent', () => { .compileComponents(); tablesServiceMock = TestBed.inject(TablesService) as jasmine.SpyObj; - connectionsServiceMock = TestBed.inject(ConnectionsService) as jasmine.SpyObj; + _connectionsServiceMock = TestBed.inject(ConnectionsService) as jasmine.SpyObj; fixture = TestBed.createComponent(SavedFiltersDialogComponent); component = fixture.componentInstance; diff --git a/frontend/src/app/components/dashboard/db-table-view/saved-filters-panel/saved-filters-dialog/saved-filters-dialog.component.ts b/frontend/src/app/components/dashboard/db-table-view/saved-filters-panel/saved-filters-dialog/saved-filters-dialog.component.ts index ecf21981..1c658f9c 100644 --- a/frontend/src/app/components/dashboard/db-table-view/saved-filters-panel/saved-filters-dialog/saved-filters-dialog.component.ts +++ b/frontend/src/app/components/dashboard/db-table-view/saved-filters-panel/saved-filters-dialog/saved-filters-dialog.component.ts @@ -1,7 +1,7 @@ -import { FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms'; +import { FormControl, FormsModule, ReactiveFormsModule, } from '@angular/forms'; import { CommonModule } from '@angular/common'; -import { Component, Inject, Input, OnInit } from '@angular/core'; +import { Component, Inject, OnInit } from '@angular/core'; import { DynamicModule } from 'ng-dynamic-component'; import { MatAutocompleteModule } from '@angular/material/autocomplete'; import { MatButtonModule } from '@angular/material/button'; @@ -19,9 +19,8 @@ import { TablesService } from 'src/app/services/tables.service'; import { ConnectionsService } from 'src/app/services/connections.service'; import { filterTypes } from 'src/app/consts/filter-types'; import { UIwidgets } from 'src/app/consts/record-edit-types'; -import { TableField, TableForeignKey } from 'src/app/models/table'; +import { TableField, } from 'src/app/models/table'; import { getTableTypes } from 'src/app/lib/setup-table-row-structure'; -import { omitBy } from 'lodash'; import { Angulartics2, Angulartics2OnModule } from 'angulartics2'; @Component({ @@ -84,7 +83,7 @@ export class SavedFiltersDialogComponent implements OnInit { if (this.data.filtersSet) { this.tableRowFieldsShown = Object.entries(this.data.filtersSet.filters).reduce((acc, [field, conditions]) => { - const [comparator, value] = Object.entries(conditions)[0]; + const [_comparator, value] = Object.entries(conditions)[0]; acc[field] = value; return acc; }, {}); @@ -96,7 +95,7 @@ export class SavedFiltersDialogComponent implements OnInit { }, {}); // Initialize dynamic column if it exists in the filters set - if (this.data.filtersSet.dynamic_column && this.data.filtersSet.dynamic_column.column_name) { + if (this.data.filtersSet.dynamic_column?.column_name) { this.tableRowFieldsShown[this.data.filtersSet.dynamic_column.column_name] = null; this.tableRowFieldsComparator[this.data.filtersSet.dynamic_column.column_name] = this.data.filtersSet.dynamic_column.comparator || ''; this.dynamicColumn = this.data.filtersSet.dynamic_column.column_name; @@ -116,7 +115,7 @@ export class SavedFiltersDialogComponent implements OnInit { })); // Setup widgets if available - if (this.data.tableWidgets && this.data.tableWidgets.length) { + if (this.data.tableWidgets?.length) { this.setWidgets(this.data.tableWidgets); } @@ -142,7 +141,7 @@ export class SavedFiltersDialogComponent implements OnInit { if (widget.widget_params !== '// No settings required') { try { params = JSON.parse(widget.widget_params); - } catch (e) { + } catch (_e) { params = ''; } } else { @@ -155,7 +154,7 @@ export class SavedFiltersDialogComponent implements OnInit { ); } - trackByFn(index: number, item: any) { + trackByFn(_index: number, item: any) { return item.key; } @@ -265,7 +264,7 @@ export class SavedFiltersDialogComponent implements OnInit { // Only add dynamic_column if one is selected if (this.dynamicColumn) { // Create object with column_name and comparator properties - payload['dynamic_column'] = { + payload.dynamic_column = { column_name: this.dynamicColumn, comparator: this.tableRowFieldsComparator[this.dynamicColumn] || '' }; diff --git a/frontend/src/app/components/dashboard/db-table-view/saved-filters-panel/saved-filters-panel.component.spec.ts b/frontend/src/app/components/dashboard/db-table-view/saved-filters-panel/saved-filters-panel.component.spec.ts index 88f7b0be..aa28dda4 100644 --- a/frontend/src/app/components/dashboard/db-table-view/saved-filters-panel/saved-filters-panel.component.spec.ts +++ b/frontend/src/app/components/dashboard/db-table-view/saved-filters-panel/saved-filters-panel.component.spec.ts @@ -19,7 +19,7 @@ class JsonURLMock { static parse(str: string): any { try { return JSON.parse(str); - } catch (e) { + } catch (_e) { return {}; } } @@ -31,8 +31,8 @@ class JsonURLMock { describe('SavedFiltersPanelComponent', () => { let component: SavedFiltersPanelComponent; let fixture: ComponentFixture; - let tablesServiceSpy: jasmine.SpyObj; - let routerSpy: jasmine.SpyObj; + let _tablesServiceSpy: jasmine.SpyObj; + let _routerSpy: jasmine.SpyObj; const mockFilter = { id: 'filter1', @@ -61,10 +61,10 @@ describe('SavedFiltersPanelComponent', () => { snapshot: { queryParams: {}, paramMap: { - get: (key: string) => null + get: (_key: string) => null }, queryParamMap: { - get: (key: string) => null + get: (_key: string) => null } } }; @@ -90,8 +90,8 @@ describe('SavedFiltersPanelComponent', () => { ] }).compileComponents(); - tablesServiceSpy = TestBed.inject(TablesService) as jasmine.SpyObj; - routerSpy = TestBed.inject(Router) as jasmine.SpyObj; + _tablesServiceSpy = TestBed.inject(TablesService) as jasmine.SpyObj; + _routerSpy = TestBed.inject(Router) as jasmine.SpyObj; fixture = TestBed.createComponent(SavedFiltersPanelComponent); component = fixture.componentInstance; diff --git a/frontend/src/app/components/dashboard/db-table-view/saved-filters-panel/saved-filters-panel.component.ts b/frontend/src/app/components/dashboard/db-table-view/saved-filters-panel/saved-filters-panel.component.ts index f2eea469..2423f922 100644 --- a/frontend/src/app/components/dashboard/db-table-view/saved-filters-panel/saved-filters-panel.component.ts +++ b/frontend/src/app/components/dashboard/db-table-view/saved-filters-panel/saved-filters-panel.component.ts @@ -125,7 +125,7 @@ export class SavedFiltersPanelComponent implements OnInit, OnDestroy { if (arg === 'filters set updated') { // Get the current saved filter ID from URL - const savedFilterIdFromUrl = this.route.snapshot.queryParams['saved_filter']; + const savedFilterIdFromUrl = this.route.snapshot.queryParams.saved_filter; if (savedFilterIdFromUrl) { // If we have a filter selected in URL, get latest data and update URL @@ -210,11 +210,11 @@ export class SavedFiltersPanelComponent implements OnInit, OnDestroy { })); const params = this.route.snapshot.queryParams; - const dynamicColumn = params['dynamic_column'] ? JsonURL.parse(params['dynamic_column']) : null; + const dynamicColumn = params.dynamic_column ? JsonURL.parse(params.dynamic_column) : null; if (this.selectedFilterSetId && this.savedFilterData.length > 0) { if (dynamicColumn && this.savedFilterMap[this.selectedFilterSetId]) { - const filters = params['filters'] ? JsonURL.parse(params['filters']) : {}; + const filters = params.filters ? JsonURL.parse(params.filters) : {}; this.savedFilterMap[this.selectedFilterSetId].dynamicColumn = { column: dynamicColumn.column_name, @@ -244,7 +244,7 @@ export class SavedFiltersPanelComponent implements OnInit, OnDestroy { } handleOpenSavedFiltersDialog(filtersSet: any = null) { - const dialogRef = this.dialog.open(SavedFiltersDialogComponent, { + const _dialogRef = this.dialog.open(SavedFiltersDialogComponent, { width: '56em', data: { connectionID: this.connectionID, @@ -290,14 +290,14 @@ export class SavedFiltersPanelComponent implements OnInit, OnDestroy { dynamicColumn: null as { column: string; operator: string; value: any } | null }; - if (filter.dynamic_column && filter.dynamic_column.column_name) { + if (filter.dynamic_column?.column_name) { transformedFilter.dynamicColumn = { column: filter.dynamic_column.column_name, operator: filter.dynamic_column.comparator, value: null }; - const dynamicColFilters = filter.filters && filter.filters[filter.dynamic_column.column_name]; + const dynamicColFilters = filter.filters?.[filter.dynamic_column.column_name]; if (dynamicColFilters) { const operator = filter.dynamic_column.comparator; transformedFilter.dynamicColumn.value = dynamicColFilters[operator]; @@ -315,17 +315,17 @@ export class SavedFiltersPanelComponent implements OnInit, OnDestroy { // Start with pagination parameters const queryParams: any = { page_index: 0, - page_size: currentParams['page_size'] || 30, + page_size: currentParams.page_size || 30, ...additionalParams }; // Preserve sort parameters if present - if (currentParams['sort_active']) { - queryParams.sort_active = currentParams['sort_active']; + if (currentParams.sort_active) { + queryParams.sort_active = currentParams.sort_active; } - if (currentParams['sort_direction']) { - queryParams.sort_direction = currentParams['sort_direction']; + if (currentParams.sort_direction) { + queryParams.sort_direction = currentParams.sort_direction; } return queryParams; @@ -375,15 +375,15 @@ export class SavedFiltersPanelComponent implements OnInit, OnDestroy { const displayedName = normalizeTableName(activeFilter.column); const comparator = activeFilter.operator; const filterValue = activeFilter.value; - if (comparator == 'startswith') { + if (comparator === 'startswith') { return `${displayedName} = ${filterValue}...` - } else if (comparator == 'endswith') { + } else if (comparator === 'endswith') { return `${displayedName} = ...${filterValue}` - } else if (comparator == 'contains') { + } else if (comparator === 'contains') { return `${displayedName} = ...${filterValue}...` - } else if (comparator == 'icontains') { + } else if (comparator === 'icontains') { return `${displayedName} != ...${filterValue}...` - } else if (comparator == 'empty') { + } else if (comparator === 'empty') { return `${displayedName} = ' '` } else { return `${displayedName} ${this.displayedComparators[comparator]} ${filterValue}` @@ -426,7 +426,7 @@ export class SavedFiltersPanelComponent implements OnInit, OnDestroy { if (widget.widget_params !== '// No settings required') { try { params = JSON.parse(widget.widget_params); - } catch (e) { + } catch (_e) { params = ''; } } else { @@ -439,7 +439,7 @@ export class SavedFiltersPanelComponent implements OnInit, OnDestroy { ); } - trackByFn(index: number, item: any) { + trackByFn(_index: number, item: any) { return item.key; } diff --git a/frontend/src/app/components/dashboard/db-tables-data-source.ts b/frontend/src/app/components/dashboard/db-tables-data-source.ts index a44c3d1b..1f87ebc3 100644 --- a/frontend/src/app/components/dashboard/db-tables-data-source.ts +++ b/frontend/src/app/components/dashboard/db-tables-data-source.ts @@ -10,12 +10,10 @@ import { CollectionViewer } from '@angular/cdk/collections'; import { ConnectionsService } from 'src/app/services/connections.service'; import { DataSource } from '@angular/cdk/table'; import { MatPaginator } from '@angular/material/paginator'; -import { NotificationsService } from 'src/app/services/notifications.service'; import { TableRowService } from 'src/app/services/table-row.service'; // import { MatSort } from '@angular/material/sort'; import { TablesService } from 'src/app/services/tables.service'; import { UiSettingsService } from 'src/app/services/ui-settings.service'; -import { UserService } from 'src/app/services/user.service'; import { filter } from "lodash"; import { formatFieldValue } from 'src/app/lib/format-field-value'; import { getTableTypes } from 'src/app/lib/setup-table-row-structure'; @@ -95,11 +93,11 @@ export class TablesDataSource implements DataSource { private _tableRow: TableRowService, ) {} - connect(collectionViewer: CollectionViewer): Observable { + connect(_collectionViewer: CollectionViewer): Observable { return this.rowsSubject.asObservable(); } - disconnect(collectionViewer: CollectionViewer): void { + disconnect(_collectionViewer: CollectionViewer): void { this.rowsSubject.complete(); this.loadingSubject.complete(); } @@ -153,10 +151,10 @@ export class TablesDataSource implements DataSource { finalize(() => this.loadingSubject.next(false)) ) .subscribe((res: any) => { - if (res.rows && res.rows.length) { + if (res.rows?.length) { const firstRow = res.rows[0]; - this.foreignKeysList = res.foreignKeys.map((field) => {return field['column_name']}); + this.foreignKeysList = res.foreignKeys.map((field) => {return field.column_name}); this.foreignKeys = Object.assign({}, ...res.foreignKeys.map((foreignKey: TableForeignKey) => ({[foreignKey.column_name]: foreignKey}))); this._tableRow.fetchTableRow( @@ -193,7 +191,7 @@ export class TablesDataSource implements DataSource { this.tableBulkActions = res.action_events.filter((action: CustomEvent) => action.type === CustomActionType.Multiple); if (res.widgets) { - this.widgetsList = res.widgets.map((widget: Widget) => {return widget['field_name']}); + this.widgetsList = res.widgets.map((widget: Widget) => {return widget.field_name}); this.widgetsCount = this.widgetsList.length; this.widgets = Object.assign({}, ...res.widgets.map((widget: Widget) => { let parsedParams; @@ -226,7 +224,7 @@ export class TablesDataSource implements DataSource { if (isTablePageSwitched === undefined) this.columns = orderedColumns .filter (item => item.isExcluded === false) .map((item, index) => { - if (shownColumns && shownColumns.length) { + if (shownColumns?.length) { return { title: item.column_name, normalizedTitle: this.widgets[item.column_name]?.name || normalizeFieldName(item.column_name), @@ -285,7 +283,7 @@ export class TablesDataSource implements DataSource { this.sortByColumns = res.sortable_by; - const widgetsConfigured = res.widgets && res.widgets.length; + const widgetsConfigured = res.widgets?.length; if (!res.configured && !widgetsConfigured && this._connections.connectionAccessLevel !== AccessLevel.None && this._connections.connectionAccessLevel !== AccessLevel.Readonly) diff --git a/frontend/src/app/components/dashboard/db-tables-list/db-folder-edit-dialog/db-folder-edit-dialog.component.ts b/frontend/src/app/components/dashboard/db-tables-list/db-folder-edit-dialog/db-folder-edit-dialog.component.ts index c1bc8370..7f7711c8 100644 --- a/frontend/src/app/components/dashboard/db-tables-list/db-folder-edit-dialog/db-folder-edit-dialog.component.ts +++ b/frontend/src/app/components/dashboard/db-tables-list/db-folder-edit-dialog/db-folder-edit-dialog.component.ts @@ -42,7 +42,7 @@ export class DbFolderEditDialogComponent { public folder: Folder; public tables: TableProperties[]; public folderIconColors: { name: string; value: string }[]; - private originalFolderName: string; + originalFolderName: string; constructor( public dialogRef: MatDialogRef, @@ -113,4 +113,4 @@ export class DbFolderEditDialogComponent { onCancel() { this.dialogRef.close(); } -} \ No newline at end of file +} diff --git a/frontend/src/app/components/dashboard/db-tables-list/db-tables-list.component.ts b/frontend/src/app/components/dashboard/db-tables-list/db-tables-list.component.ts index 68b63c87..ac7da4bb 100644 --- a/frontend/src/app/components/dashboard/db-tables-list/db-tables-list.component.ts +++ b/frontend/src/app/components/dashboard/db-tables-list/db-tables-list.component.ts @@ -1,8 +1,8 @@ -import { Component, EventEmitter, HostListener, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core'; +import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core'; import { DbFolderDeleteDialogComponent, DbFolderDeleteDialogData } from './db-folder-delete-dialog/db-folder-delete-dialog.component'; import { DbFolderEditDialogComponent, DbFolderEditDialogData } from './db-folder-edit-dialog/db-folder-edit-dialog.component'; import { MatDialog, MatDialogModule } from '@angular/material/dialog'; -import { TableProperties, TableSettings } from 'src/app/models/table'; +import { TableProperties, } from 'src/app/models/table'; import { AccessLevel } from 'src/app/models/user'; import { CommonModule } from '@angular/common'; @@ -83,9 +83,6 @@ export class DbTablesListComponent implements OnInit, OnChanges { private preservedFolderStates: { [key: string]: boolean } = {}; private preservedActiveFolder: string | null = null; - // Table icons cache - private tableIcons: { [key: string]: string } = {}; - // Folder icon colors public folderIconColors = [ { name: 'Default', value: '#212121' }, @@ -99,8 +96,7 @@ export class DbTablesListComponent implements OnInit, OnChanges { ]; constructor( - private _tableState: TableStateService, - private _tablesService: TablesService, + private _tableState: TableStateService,_tablesService: TablesService, private _connectionsService: ConnectionsService, private _uiSettingsService: UiSettingsService, private dialog: MatDialog @@ -113,11 +109,11 @@ export class DbTablesListComponent implements OnInit, OnChanges { } ngOnChanges(changes: SimpleChanges) { - if (changes['collapsed']) { - if (changes['collapsed'].currentValue === true) { + if (changes.collapsed) { + if (changes.collapsed.currentValue === true) { // Sidebar is being collapsed - preserve current state this.preserveFolderStates(); - } else if (changes['collapsed'].currentValue === false) { + } else if (changes.collapsed.currentValue === false) { // Sidebar is being expanded - restore preserved state this.restoreFolderStates(); } @@ -153,8 +149,8 @@ export class DbTablesListComponent implements OnInit, OnChanges { // Filter all tables by search term this.foundTables = allTables.filter(tableItem => tableItem.table.toLowerCase().includes(searchTerm) || - (tableItem.display_name && tableItem.display_name.toLowerCase().includes(searchTerm)) || - (tableItem.normalizedTableName && tableItem.normalizedTableName.toLowerCase().includes(searchTerm)) + (tableItem.display_name?.toLowerCase().includes(searchTerm)) || + (tableItem.normalizedTableName?.toLowerCase().includes(searchTerm)) ); // Remove duplicates @@ -257,7 +253,7 @@ export class DbTablesListComponent implements OnInit, OnChanges { return tables; } - navigateToTable(table: TableProperties) { + navigateToTable(_table: TableProperties) { // This method is called when clicking on a table in collapsed mode // The actual navigation is handled by routerLink in the template // We just need to close the sidebar after navigation @@ -308,8 +304,8 @@ export class DbTablesListComponent implements OnInit, OnChanges { const searchTerm = this.substringToSearch.toLowerCase(); return folderTables.filter(table => table.table.toLowerCase().includes(searchTerm) || - (table.display_name && table.display_name.toLowerCase().includes(searchTerm)) || - (table.normalizedTableName && table.normalizedTableName.toLowerCase().includes(searchTerm)) + (table.display_name?.toLowerCase().includes(searchTerm)) || + (table.normalizedTableName?.toLowerCase().includes(searchTerm)) ); } @@ -371,7 +367,7 @@ export class DbTablesListComponent implements OnInit, OnChanges { } // Check if we're in dark theme - if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + if (window.matchMedia?.('(prefers-color-scheme: dark)').matches) { // In dark theme, use #212121 for folders without custom color return folder.iconColor || '#212121'; } @@ -425,7 +421,7 @@ export class DbTablesListComponent implements OnInit, OnChanges { this.saveFolders(); } - trackByFolderId(index: number, folder: Folder): string { + trackByFolderId(_index: number, folder: Folder): string { return folder.id; } @@ -481,7 +477,7 @@ export class DbTablesListComponent implements OnInit, OnChanges { // Restore expanded states of all folders this.folders.forEach(folder => { - if (this.preservedFolderStates.hasOwnProperty(folder.id)) { + if (Object.hasOwn(this.preservedFolderStates, folder.id)) { folder.expanded = this.preservedFolderStates[folder.id]; } }); @@ -599,7 +595,7 @@ export class DbTablesListComponent implements OnInit, OnChanges { } } - onTableDragEnd(event: DragEvent) { + onTableDragEnd(_event: DragEvent) { this.draggedTable = null; this.dragOverFolder = null; } @@ -612,7 +608,7 @@ export class DbTablesListComponent implements OnInit, OnChanges { this.dragOverFolder = folderId; } - onFolderDragLeave(event: DragEvent, folderId: string) { + onFolderDragLeave(event: DragEvent, _folderId: string) { // Only clear if we're actually leaving the collection (not moving to a child element) const rect = (event.currentTarget as HTMLElement).getBoundingClientRect(); const x = event.clientX; diff --git a/frontend/src/app/components/db-table-row-edit/db-table-row-edit.component.spec.ts b/frontend/src/app/components/db-table-row-edit/db-table-row-edit.component.spec.ts index e51d86e5..bf65767b 100644 --- a/frontend/src/app/components/db-table-row-edit/db-table-row-edit.component.spec.ts +++ b/frontend/src/app/components/db-table-row-edit/db-table-row-edit.component.spec.ts @@ -13,7 +13,7 @@ import { provideRouter } from '@angular/router'; describe('DbTableRowEditComponent', () => { let component: DbTableRowEditComponent; let fixture: ComponentFixture; - let tablesService: TablesService; + let _tablesService: TablesService; let connectionsService: ConnectionsService; beforeEach(async () => { @@ -37,7 +37,7 @@ describe('DbTableRowEditComponent', () => { beforeEach(() => { fixture = TestBed.createComponent(DbTableRowEditComponent); component = fixture.componentInstance; - tablesService = TestBed.inject(TablesService); + _tablesService = TestBed.inject(TablesService); connectionsService = TestBed.inject(ConnectionsService); fixture.detectChanges(); }); @@ -268,25 +268,25 @@ describe('DbTableRowEditComponent', () => { it('should update tableRowValues when password field receives a value', () => { component.updateField('newPassword', 'password'); - expect(component.tableRowValues['password']).toBe('newPassword'); + expect(component.tableRowValues.password).toBe('newPassword'); }); it('should update tableRowValues when password field receives empty string', () => { component.updateField('', 'password'); - expect(component.tableRowValues['password']).toBe(''); + expect(component.tableRowValues.password).toBe(''); }); it('should update tableRowValues when password field receives null (clear password)', () => { component.updateField(null, 'password'); - expect(component.tableRowValues['password']).toBe(null); + expect(component.tableRowValues.password).toBe(null); }); it('should handle password field update alongside other fields', () => { component.updateField('updatedUser', 'username'); component.updateField('newPassword', 'password'); - expect(component.tableRowValues['username']).toBe('updatedUser'); - expect(component.tableRowValues['password']).toBe('newPassword'); + expect(component.tableRowValues.username).toBe('updatedUser'); + expect(component.tableRowValues.password).toBe('newPassword'); }); }); diff --git a/frontend/src/app/components/db-table-row-edit/db-table-row-edit.component.ts b/frontend/src/app/components/db-table-row-edit/db-table-row-edit.component.ts index 3ec715d8..acdeab6b 100644 --- a/frontend/src/app/components/db-table-row-edit/db-table-row-edit.component.ts +++ b/frontend/src/app/components/db-table-row-edit/db-table-row-edit.component.ts @@ -3,9 +3,9 @@ import * as JSON5 from 'json5'; import { ActivatedRoute, Router } from '@angular/router'; import { Alert, AlertType, ServerError } from 'src/app/models/alert'; import { Component, NgZone, OnInit } from '@angular/core'; -import { CustomAction, CustomActionType, CustomEvent, TableField, TableForeignKey, TablePermissions, Widget } from 'src/app/models/table'; +import { CustomAction, CustomEvent, TableField, TableForeignKey, TablePermissions, Widget } from 'src/app/models/table'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { MatProgressSpinnerModule, MatSpinner } from '@angular/material/progress-spinner'; +import { MatProgressSpinnerModule, } from '@angular/material/progress-spinner'; import { UIwidgets, defaultTimestampValues, recordEditTypes, timestampTypes } from 'src/app/consts/record-edit-types'; import { normalizeFieldName, normalizeTableName } from 'src/app/lib/normalize'; @@ -33,16 +33,13 @@ import { MatSelectModule } from '@angular/material/select'; import { MatTooltipModule } from '@angular/material/tooltip'; import { NotificationsService } from 'src/app/services/notifications.service'; import { PlaceholderRowEditComponent } from '../skeletons/placeholder-row-edit/placeholder-row-edit.component'; -import { PlaceholderTableViewComponent } from '../skeletons/placeholder-table-view/placeholder-table-view.component'; import { RouterModule } from '@angular/router'; -import { Subscription } from 'rxjs'; import { TableRowService } from 'src/app/services/table-row.service'; import { TableStateService } from 'src/app/services/table-state.service'; import { TablesService } from 'src/app/services/tables.service'; import { Title } from '@angular/platform-browser'; import { formatFieldValue } from 'src/app/lib/format-field-value'; import { getTableTypes } from 'src/app/lib/setup-table-row-structure'; -import { isSet } from 'lodash'; @Component({ selector: 'app-db-table-row-edit', @@ -77,7 +74,7 @@ export class DbTableRowEditComponent implements OnInit { public connectionName: string | null = null; public tableName: string | null = null; public dispalyTableName: string | null = null; - public tableRowValues: object; + public tableRowValues: Record; public tableRowStructure: object; public tableRowRequiredValues: object; public identityColumn: string; @@ -119,11 +116,10 @@ export class DbTableRowEditComponent implements OnInit { type: AlertType.Error, message: 'This is a TEST DATABASE, public to all. Avoid entering sensitive data!' } - - private routeSub: Subscription | undefined; private confirmationDialogRef: any; originalOrder = () => { return 0; } + routeSub: any; constructor( private _connections: ConnectionsService, @@ -310,7 +306,7 @@ export class DbTableRowEditComponent implements OnInit { } }); - if (res.rows && res.rows.length) { + if (res.rows?.length) { const firstRow = res.rows[0]; const relatedTableForeignKeys = Object.assign({}, ...res.foreignKeys.map((foreignKey: TableForeignKey) => ({[foreignKey.column_name]: foreignKey}))); @@ -491,7 +487,7 @@ export class DbTableRowEditComponent implements OnInit { return {[field.column_name]: field} })) - const foreignKeysList = this.tableForeignKeys.map((field: TableForeignKey) => {return field['column_name']}); + const foreignKeysList = this.tableForeignKeys.map((field: TableForeignKey) => {return field.column_name}); this.tableTypes = getTableTypes(structure, foreignKeysList); this.tableRowRequiredValues = Object.assign({}, ...structure.map((field: TableField) => { @@ -562,7 +558,7 @@ export class DbTableRowEditComponent implements OnInit { if (this.connectionType === DBtype.MySQL) { const datetimeFields = Object.entries(this.tableTypes) - .filter(([key, value]) => value === 'datetime' || value === 'timestamp'); + .filter(([_key, value]) => value === 'datetime' || value === 'timestamp'); if (datetimeFields.length) { for (const datetimeField of datetimeFields) { if (updatedRow[datetimeField[0]]) { @@ -572,7 +568,7 @@ export class DbTableRowEditComponent implements OnInit { }; const dateFields = Object.entries(this.tableTypes) - .filter(([key, value]) => value === 'date'); + .filter(([_key, value]) => value === 'date'); if (dateFields.length) { for (const dateField of dateFields) { if (updatedRow[dateField[0]]) { @@ -593,7 +589,7 @@ export class DbTableRowEditComponent implements OnInit { //parse json fields const jsonFields = Object.entries(this.tableTypes) - .filter(([key, value]) => value === 'json' || value === 'jsonb' || value === 'array' || value === 'ARRAY' || value === 'object' || value === 'set' || value === 'list' || value === 'map') + .filter(([_key, value]) => value === 'json' || value === 'jsonb' || value === 'array' || value === 'ARRAY' || value === 'object' || value === 'set' || value === 'list' || value === 'map') .map(jsonField => jsonField[0]); if (jsonFields.length) { for (const jsonField of jsonFields) { @@ -702,14 +698,14 @@ export class DbTableRowEditComponent implements OnInit { }); if (!action.id) { - this.confirmationDialogRef.afterClosed().subscribe((res) => { + this.confirmationDialogRef.afterClosed().subscribe((_res) => { this.router.navigate([`/dashboard/${this.connectionID}/${this.tableName}`], { queryParams: this.backUrlParams}); }); } } else { this._tables.activateActions(this.connectionID, this.tableName, action.id, action.title, [this.keyAttributesFromURL]) .subscribe((res) => { - if (res && res.location) this.dialog.open(DbActionLinkDialogComponent, { + if (res?.location) this.dialog.open(DbActionLinkDialogComponent, { width: '25em', data: {href: res.location, actionName: action.title, primaryKeys: this.keyAttributesFromURL} }) diff --git a/frontend/src/app/components/login/login.component.spec.ts b/frontend/src/app/components/login/login.component.spec.ts index 311ec43e..304e0f30 100644 --- a/frontend/src/app/components/login/login.component.spec.ts +++ b/frontend/src/app/components/login/login.component.spec.ts @@ -29,11 +29,9 @@ describe('LoginComponent', () => { providers: [provideHttpClient(), provideRouter([])] }).compileComponents(); - // @ts-ignore global.window.google = jasmine.createSpyObj(['accounts']); - // @ts-ignore + // @ts-expect-error global.window.google.accounts = jasmine.createSpyObj(['id']); - // @ts-ignore global.window.google.accounts.id = jasmine.createSpyObj(['initialize', 'renderButton', 'prompt']); }); diff --git a/frontend/src/app/components/login/login.component.ts b/frontend/src/app/components/login/login.component.ts index a948fe6f..8a974e0f 100644 --- a/frontend/src/app/components/login/login.component.ts +++ b/frontend/src/app/components/login/login.component.ts @@ -82,7 +82,7 @@ export class LoginComponent implements OnInit, AfterViewInit { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); } @@ -139,7 +139,7 @@ export class LoginComponent implements OnInit, AfterViewInit { this.angulartics2.eventTrack.next({ action: 'Login: login success' }); - }, (error) => { + }, (_error) => { this.angulartics2.eventTrack.next({ action: 'Login: login unsuccessful' }); @@ -168,7 +168,7 @@ export class LoginComponent implements OnInit, AfterViewInit { this.angulartics2.eventTrack.next({ action: 'Login: login with 2fa success' }); - }, (error) => { + }, (_error) => { this.angulartics2.eventTrack.next({ action: 'Login: login with 2fa unsuccessful' }); diff --git a/frontend/src/app/components/page-loader/page-loader.component.ts b/frontend/src/app/components/page-loader/page-loader.component.ts index 2851fae3..c1630919 100644 --- a/frontend/src/app/components/page-loader/page-loader.component.ts +++ b/frontend/src/app/components/page-loader/page-loader.component.ts @@ -11,8 +11,7 @@ import { Router } from '@angular/router'; export class PageLoaderComponent implements OnInit { constructor( - public router: Router, - private ngZone: NgZone + public router: Router,_ngZone: NgZone ) { } ngOnInit() { diff --git a/frontend/src/app/components/page-not-found/page-not-found.component.ts b/frontend/src/app/components/page-not-found/page-not-found.component.ts index c5c55a79..7a40bee4 100644 --- a/frontend/src/app/components/page-not-found/page-not-found.component.ts +++ b/frontend/src/app/components/page-not-found/page-not-found.component.ts @@ -7,8 +7,6 @@ import { Component, OnInit } from '@angular/core'; }) export class PageNotFoundComponent implements OnInit { - constructor() { } - ngOnInit() { } diff --git a/frontend/src/app/components/password-change/password-change.component.spec.ts b/frontend/src/app/components/password-change/password-change.component.spec.ts index dcffa30e..9e837c0c 100644 --- a/frontend/src/app/components/password-change/password-change.component.spec.ts +++ b/frontend/src/app/components/password-change/password-change.component.spec.ts @@ -8,7 +8,6 @@ import { IPasswordStrengthMeterService } from 'angular-password-strength-meter'; import { MatSnackBarModule } from '@angular/material/snack-bar'; import { PasswordChangeComponent } from './password-change.component'; import { Router } from '@angular/router'; -import { RouterTestingModule } from "@angular/router/testing"; import { SubscriptionPlans } from 'src/app/models/user'; import { UserService } from 'src/app/services/user.service'; import { of } from 'rxjs'; @@ -57,7 +56,7 @@ describe('PasswordChangeComponent', () => { expect(component).toBeTruthy(); }); - xit('should change password', async (done) => { + xit('should change password', async (_done) => { component.oldPassword = 'hH12345678'; component.newPassword = '12345678hH'; component.currentUser = { diff --git a/frontend/src/app/components/payment-form/payment-form.component.ts b/frontend/src/app/components/payment-form/payment-form.component.ts index e74f715a..87e4fbb2 100644 --- a/frontend/src/app/components/payment-form/payment-form.component.ts +++ b/frontend/src/app/components/payment-form/payment-form.component.ts @@ -68,8 +68,7 @@ export class PaymentFormComponent implements OnInit { constructor( private _paymentService: PaymentService, private _userService: UserService, - private _notifications: NotificationsService, - private http: HttpClient, + private _notifications: NotificationsService,_http: HttpClient, private fb: FormBuilder, private stripeService: StripeService, private route: ActivatedRoute, @@ -103,7 +102,7 @@ export class PaymentFormComponent implements OnInit { this._userService.cast.subscribe(user => { console.log('user'); console.log(user); - if (user && user.company.id) this._paymentService.createIntentToSubscription(user.company.id).subscribe(res => { + if (user?.company.id) this._paymentService.createIntentToSubscription(user.company.id).subscribe(res => { this.companyId = user.company.id; this.paymentElementForm = this.fb.group({ name: [user.name], @@ -146,14 +145,14 @@ export class PaymentFormComponent implements OnInit { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); } else { // The payment has been processed! if (result.setupIntent.status === 'succeeded') { this._paymentService.createSubscription(this.companyId, result.setupIntent.payment_method, this.subscriptionLevel) - .subscribe(res => { + .subscribe(_res => { this._notifications.showSuccessSnackbar('Subscription successfully started.'); this.router.navigate(['/upgrade']); }) @@ -162,7 +161,7 @@ export class PaymentFormComponent implements OnInit { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); } diff --git a/frontend/src/app/components/registration/registration.component.spec.ts b/frontend/src/app/components/registration/registration.component.spec.ts index 1ab42b18..30f29654 100644 --- a/frontend/src/app/components/registration/registration.component.spec.ts +++ b/frontend/src/app/components/registration/registration.component.spec.ts @@ -32,14 +32,12 @@ describe('RegistrationComponent', () => { ] }).compileComponents(); - // @ts-ignore + // @ts-expect-error global.window.gtag = jasmine.createSpy(); - // @ts-ignore global.window.google = jasmine.createSpyObj(['accounts']); - // @ts-ignore + // @ts-expect-error global.window.google.accounts = jasmine.createSpyObj(['id']); - // @ts-ignore global.window.google.accounts.id = jasmine.createSpyObj(['initialize', 'renderButton', 'prompt']); }); diff --git a/frontend/src/app/components/registration/registration.component.ts b/frontend/src/app/components/registration/registration.component.ts index 52dd5ae0..59f94cbc 100644 --- a/frontend/src/app/components/registration/registration.component.ts +++ b/frontend/src/app/components/registration/registration.component.ts @@ -67,16 +67,16 @@ export class RegistrationComponent implements OnInit, AfterViewInit { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); } ngAfterViewInit() { - //@ts-ignore + //@ts-expect-error gtag('event', 'conversion', {'send_to': 'AW-419937947/auKoCOvwgoYDEJv9nsgB'}); - //@ts-ignore + //@ts-expect-error google.accounts.id.initialize({ client_id: "681163285738-e4l0lrv5vv7m616ucrfhnhso9r396lum.apps.googleusercontent.com", callback: (authUser) => { @@ -89,12 +89,12 @@ export class RegistrationComponent implements OnInit, AfterViewInit { }) } }); - //@ts-ignore + //@ts-expect-error google.accounts.id.renderButton( document.getElementById("google_registration_button"), { theme: "filled_blue", size: "large", width: 400, text: "signup_with" } ); - //@ts-ignore + //@ts-expect-error google.accounts.id.prompt(); } @@ -110,7 +110,7 @@ export class RegistrationComponent implements OnInit, AfterViewInit { this.angulartics2.eventTrack.next({ action: 'Reg: sing up success' }); - }, (error) => { + }, (_error) => { this.angulartics2.eventTrack.next({ action: 'Reg: sing up unsuccessful' }); diff --git a/frontend/src/app/components/secrets/audit-log-dialog/audit-log-dialog.component.spec.ts b/frontend/src/app/components/secrets/audit-log-dialog/audit-log-dialog.component.spec.ts index cbb09b9e..f63cf001 100644 --- a/frontend/src/app/components/secrets/audit-log-dialog/audit-log-dialog.component.spec.ts +++ b/frontend/src/app/components/secrets/audit-log-dialog/audit-log-dialog.component.spec.ts @@ -137,67 +137,67 @@ describe('AuditLogDialogComponent', () => { describe('action labels', () => { it('should have label for create action', () => { - expect(component.actionLabels['create']).toBe('Created'); + expect(component.actionLabels.create).toBe('Created'); }); it('should have label for view action', () => { - expect(component.actionLabels['view']).toBe('Viewed'); + expect(component.actionLabels.view).toBe('Viewed'); }); it('should have label for copy action', () => { - expect(component.actionLabels['copy']).toBe('Copied'); + expect(component.actionLabels.copy).toBe('Copied'); }); it('should have label for update action', () => { - expect(component.actionLabels['update']).toBe('Updated'); + expect(component.actionLabels.update).toBe('Updated'); }); it('should have label for delete action', () => { - expect(component.actionLabels['delete']).toBe('Deleted'); + expect(component.actionLabels.delete).toBe('Deleted'); }); }); describe('action icons', () => { it('should have icon for create action', () => { - expect(component.actionIcons['create']).toBe('add_circle'); + expect(component.actionIcons.create).toBe('add_circle'); }); it('should have icon for view action', () => { - expect(component.actionIcons['view']).toBe('visibility'); + expect(component.actionIcons.view).toBe('visibility'); }); it('should have icon for copy action', () => { - expect(component.actionIcons['copy']).toBe('content_copy'); + expect(component.actionIcons.copy).toBe('content_copy'); }); it('should have icon for update action', () => { - expect(component.actionIcons['update']).toBe('edit'); + expect(component.actionIcons.update).toBe('edit'); }); it('should have icon for delete action', () => { - expect(component.actionIcons['delete']).toBe('delete'); + expect(component.actionIcons.delete).toBe('delete'); }); }); describe('action colors', () => { it('should have color for create action', () => { - expect(component.actionColors['create']).toBe('primary'); + expect(component.actionColors.create).toBe('primary'); }); it('should have color for view action', () => { - expect(component.actionColors['view']).toBe('accent'); + expect(component.actionColors.view).toBe('accent'); }); it('should have color for copy action', () => { - expect(component.actionColors['copy']).toBe('accent'); + expect(component.actionColors.copy).toBe('accent'); }); it('should have color for update action', () => { - expect(component.actionColors['update']).toBe('primary'); + expect(component.actionColors.update).toBe('primary'); }); it('should have color for delete action', () => { - expect(component.actionColors['delete']).toBe('warn'); + expect(component.actionColors.delete).toBe('warn'); }); }); diff --git a/frontend/src/app/components/secrets/audit-log-dialog/audit-log-dialog.component.ts b/frontend/src/app/components/secrets/audit-log-dialog/audit-log-dialog.component.ts index ad93a75a..d41a5bc7 100644 --- a/frontend/src/app/components/secrets/audit-log-dialog/audit-log-dialog.component.ts +++ b/frontend/src/app/components/secrets/audit-log-dialog/audit-log-dialog.component.ts @@ -64,8 +64,7 @@ export class AuditLogDialogComponent implements OnInit { }; constructor( - @Inject(MAT_DIALOG_DATA) public data: { secret: Secret }, - private dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data: { secret: Secret },_dialogRef: MatDialogRef, private _secrets: SecretsService ) {} diff --git a/frontend/src/app/components/secrets/secrets.component.spec.ts b/frontend/src/app/components/secrets/secrets.component.spec.ts index d75d5634..271b0928 100644 --- a/frontend/src/app/components/secrets/secrets.component.spec.ts +++ b/frontend/src/app/components/secrets/secrets.component.spec.ts @@ -315,7 +315,7 @@ describe('SecretsComponent', () => { describe('ngOnDestroy', () => { it('should unsubscribe from all subscriptions', () => { - const unsubscribeSpy = spyOn(component['subscriptions'][0], 'unsubscribe'); + const unsubscribeSpy = spyOn(component.subscriptions[0], 'unsubscribe'); component.ngOnDestroy(); diff --git a/frontend/src/app/components/secrets/secrets.component.ts b/frontend/src/app/components/secrets/secrets.component.ts index f060706d..9f0ef6c7 100644 --- a/frontend/src/app/components/secrets/secrets.component.ts +++ b/frontend/src/app/components/secrets/secrets.component.ts @@ -59,9 +59,9 @@ export class SecretsComponent implements OnInit, OnDestroy { public loading = true; public searchQuery = ''; public displayedColumns = ['slug', 'masterEncryption', 'expiresAt', 'updatedAt', 'actions']; + public subscriptions: Subscription[] = []; private searchSubject = new Subject(); - private subscriptions: Subscription[] = []; constructor( private _secrets: SecretsService, diff --git a/frontend/src/app/components/sso/sso.component.spec.ts b/frontend/src/app/components/sso/sso.component.spec.ts index 82d85cd9..44a409a5 100644 --- a/frontend/src/app/components/sso/sso.component.spec.ts +++ b/frontend/src/app/components/sso/sso.component.spec.ts @@ -1,7 +1,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { SsoComponent } from './sso.component'; import { HttpClientTestingModule } from '@angular/common/http/testing'; -import { ActivatedRoute, convertToParamMap, Router, RouterLink, RouterModule } from '@angular/router'; +import { ActivatedRoute, convertToParamMap, Router, RouterModule } from '@angular/router'; import { CompanyService } from 'src/app/services/company.service'; import { of } from 'rxjs'; diff --git a/frontend/src/app/components/ui-components/banner/banner.component.ts b/frontend/src/app/components/ui-components/banner/banner.component.ts index 59e0026a..f8c1ccd6 100644 --- a/frontend/src/app/components/ui-components/banner/banner.component.ts +++ b/frontend/src/app/components/ui-components/banner/banner.component.ts @@ -11,9 +11,5 @@ export class BannerComponent implements OnInit { @Input() type: AlertType; - constructor( - ) { } - - ngOnInit(): void {} } diff --git a/frontend/src/app/components/ui-components/breadcrumbs/breadcrumbs.component.ts b/frontend/src/app/components/ui-components/breadcrumbs/breadcrumbs.component.ts index 9edd40c2..2d537462 100644 --- a/frontend/src/app/components/ui-components/breadcrumbs/breadcrumbs.component.ts +++ b/frontend/src/app/components/ui-components/breadcrumbs/breadcrumbs.component.ts @@ -14,8 +14,6 @@ import { MatButtonModule } from '@angular/material/button'; export class BreadcrumbsComponent implements OnInit { @Input() crumbs; - constructor() { } - ngOnInit(): void { } diff --git a/frontend/src/app/components/ui-components/content-loader/content-loader.component.ts b/frontend/src/app/components/ui-components/content-loader/content-loader.component.ts index 3be8cc4e..8bc4ea87 100644 --- a/frontend/src/app/components/ui-components/content-loader/content-loader.component.ts +++ b/frontend/src/app/components/ui-components/content-loader/content-loader.component.ts @@ -7,8 +7,6 @@ import { Component, OnInit } from '@angular/core'; }) export class ContentLoaderComponent implements OnInit { - constructor() { } - ngOnInit(): void { } diff --git a/frontend/src/app/components/ui-components/filter-fields/country/country.component.ts b/frontend/src/app/components/ui-components/filter-fields/country/country.component.ts index 5a82a28d..1774f958 100644 --- a/frontend/src/app/components/ui-components/filter-fields/country/country.component.ts +++ b/frontend/src/app/components/ui-components/filter-fields/country/country.component.ts @@ -57,7 +57,7 @@ export class CountryFilterComponent extends BaseFilterFieldComponent { const filterValue = value.toLowerCase(); return this.countries.filter(country => country.label?.toLowerCase().includes(filterValue) || - (country.value && country.value.toLowerCase().includes(filterValue)) + (country.value?.toLowerCase().includes(filterValue)) ); } diff --git a/frontend/src/app/components/ui-components/filter-fields/file/file.component.ts b/frontend/src/app/components/ui-components/filter-fields/file/file.component.ts index b7e4c8ca..e38a34c3 100644 --- a/frontend/src/app/components/ui-components/filter-fields/file/file.component.ts +++ b/frontend/src/app/components/ui-components/filter-fields/file/file.component.ts @@ -10,8 +10,4 @@ import { Component } from '@angular/core'; }) export class FileFilterComponent extends BaseFilterFieldComponent { static type = 'file'; - - constructor() { - super(); - } } diff --git a/frontend/src/app/components/ui-components/filter-fields/foreign-key/foreign-key.component.ts b/frontend/src/app/components/ui-components/filter-fields/foreign-key/foreign-key.component.ts index 6d9df9c8..d0189c44 100644 --- a/frontend/src/app/components/ui-components/filter-fields/foreign-key/foreign-key.component.ts +++ b/frontend/src/app/components/ui-components/filter-fields/foreign-key/foreign-key.component.ts @@ -60,7 +60,7 @@ export class ForeignKeyFilterComponent extends BaseFilterFieldComponent { this.autocmpleteUpdate.pipe( debounceTime(500), distinctUntilChanged()) - .subscribe(value => { + .subscribe(_value => { if (this.currentDisplayedString === '') this.onFieldChange.emit(null); this.fetchSuggestions(); }); diff --git a/frontend/src/app/components/ui-components/filter-fields/long-text/long-text.component.ts b/frontend/src/app/components/ui-components/filter-fields/long-text/long-text.component.ts index 6b0a1eaf..26cd991c 100644 --- a/frontend/src/app/components/ui-components/filter-fields/long-text/long-text.component.ts +++ b/frontend/src/app/components/ui-components/filter-fields/long-text/long-text.component.ts @@ -21,7 +21,7 @@ export class LongTextFilterComponent extends BaseFilterFieldComponent implements ngOnInit(): void { super.ngOnInit(); - if (this.widgetStructure && this.widgetStructure.widget_params) { + if (this.widgetStructure?.widget_params) { this.rowsCount = this.widgetStructure.widget_params.rows } else { this.rowsCount = '4' diff --git a/frontend/src/app/components/ui-components/filter-fields/number/number.component.ts b/frontend/src/app/components/ui-components/filter-fields/number/number.component.ts index 2b1c36bf..9505fadc 100644 --- a/frontend/src/app/components/ui-components/filter-fields/number/number.component.ts +++ b/frontend/src/app/components/ui-components/filter-fields/number/number.component.ts @@ -1,4 +1,4 @@ -import { AfterViewInit, Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; +import { AfterViewInit, Component, ElementRef, Input, ViewChild } from '@angular/core'; import { BaseFilterFieldComponent } from '../base-filter-field/base-filter-field.component'; import { CommonModule } from '@angular/common'; diff --git a/frontend/src/app/components/ui-components/filter-fields/time-interval/time-interval.component.ts b/frontend/src/app/components/ui-components/filter-fields/time-interval/time-interval.component.ts index fd024cf4..9529af62 100644 --- a/frontend/src/app/components/ui-components/filter-fields/time-interval/time-interval.component.ts +++ b/frontend/src/app/components/ui-components/filter-fields/time-interval/time-interval.component.ts @@ -35,7 +35,7 @@ export class TimeIntervalFilterComponent extends BaseFilterFieldComponent { } onInputChange() { - // @ts-ignore + // @ts-expect-error const currentInterval = pgInterval.prototype.toPostgres.call(this.interval); this.onFieldChange.emit(currentInterval); } diff --git a/frontend/src/app/components/ui-components/filter-fields/timezone/timezone.component.ts b/frontend/src/app/components/ui-components/filter-fields/timezone/timezone.component.ts index 50344a18..8a8543fb 100644 --- a/frontend/src/app/components/ui-components/filter-fields/timezone/timezone.component.ts +++ b/frontend/src/app/components/ui-components/filter-fields/timezone/timezone.component.ts @@ -63,7 +63,7 @@ export class TimezoneFilterComponent extends BaseFilterFieldComponent { const parts = formatter.formatToParts(now); const offsetPart = parts.find(part => part.type === 'timeZoneName'); - if (offsetPart && offsetPart.value.includes('GMT')) { + if (offsetPart?.value.includes('GMT')) { // Extract offset from "GMT+XX:XX" format const offset = offsetPart.value.replace('GMT', ''); return offset === '' ? '+00:00' : offset; @@ -77,7 +77,7 @@ export class TimezoneFilterComponent extends BaseFilterFieldComponent { const minutes = Math.abs(offsetMinutes) % 60; const sign = offsetMinutes >= 0 ? '+' : '-'; return `${sign}${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}`; - } catch (error) { + } catch (_error) { return ''; } } diff --git a/frontend/src/app/components/ui-components/record-edit-fields/boolean/boolean.component.ts b/frontend/src/app/components/ui-components/record-edit-fields/boolean/boolean.component.ts index e2ec84d8..6efc0c0e 100644 --- a/frontend/src/app/components/ui-components/record-edit-fields/boolean/boolean.component.ts +++ b/frontend/src/app/components/ui-components/record-edit-fields/boolean/boolean.component.ts @@ -1,11 +1,11 @@ -import { Component, Input, OnInit } from '@angular/core'; +import { Component, Input, } from '@angular/core'; import { BaseEditFieldComponent } from '../base-row-field/base-row-field.component'; import { CommonModule } from '@angular/common'; import { ConnectionsService } from 'src/app/services/connections.service'; -import { DBtype } from 'src/app/models/connection'; import { FormsModule } from '@angular/forms'; import { MatButtonToggleModule } from '@angular/material/button-toggle'; +import { DBtype } from 'src/app/models/connection'; @Component({ selector: 'app-edit-boolean', @@ -17,7 +17,7 @@ export class BooleanEditComponent extends BaseEditFieldComponent { @Input() value: boolean | number | string | null; public isRadiogroup: boolean; - private connectionType: DBtype; + connectionType: DBtype; constructor( private _connections: ConnectionsService, @@ -42,8 +42,8 @@ export class BooleanEditComponent extends BaseEditFieldComponent { // Parse widget parameters if available let parsedParams = null; if (this.widgetStructure?.widget_params) { - parsedParams = typeof this.widgetStructure.widget_params === 'string' - ? JSON.parse(this.widgetStructure.widget_params) + parsedParams = typeof this.widgetStructure.widget_params === 'string' + ? JSON.parse(this.widgetStructure.widget_params) : this.widgetStructure.widget_params; } @@ -59,4 +59,4 @@ export class BooleanEditComponent extends BaseEditFieldComponent { } this.onFieldChange.emit(this.value); } -} \ No newline at end of file +} diff --git a/frontend/src/app/components/ui-components/record-edit-fields/code/code.component.spec.ts b/frontend/src/app/components/ui-components/record-edit-fields/code/code.component.spec.ts index d3b237de..32bbd5d1 100644 --- a/frontend/src/app/components/ui-components/record-edit-fields/code/code.component.spec.ts +++ b/frontend/src/app/components/ui-components/record-edit-fields/code/code.component.spec.ts @@ -2,7 +2,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { CodeEditComponent } from './code.component'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; -import { UiSettingsService } from 'src/app/services/ui-settings.service'; import { provideHttpClient } from '@angular/common/http'; describe('CodeComponent', () => { diff --git a/frontend/src/app/components/ui-components/record-edit-fields/country/country.component.ts b/frontend/src/app/components/ui-components/record-edit-fields/country/country.component.ts index 39d369c3..1900d19a 100644 --- a/frontend/src/app/components/ui-components/record-edit-fields/country/country.component.ts +++ b/frontend/src/app/components/ui-components/record-edit-fields/country/country.component.ts @@ -86,7 +86,7 @@ export class CountryEditComponent extends BaseEditFieldComponent { const filterValue = value.toLowerCase(); return this.countries.filter(country => country.label?.toLowerCase().includes(filterValue) || - (country.value && country.value.toLowerCase().includes(filterValue)) + (country.value?.toLowerCase().includes(filterValue)) ); } diff --git a/frontend/src/app/components/ui-components/record-edit-fields/file/file.component.ts b/frontend/src/app/components/ui-components/record-edit-fields/file/file.component.ts index 46253024..2298534a 100644 --- a/frontend/src/app/components/ui-components/record-edit-fields/file/file.component.ts +++ b/frontend/src/app/components/ui-components/record-edit-fields/file/file.component.ts @@ -64,20 +64,20 @@ export class FileEditComponent extends BaseEditFieldComponent { if (this.fileType === 'hex') { this.hexData = this.value; - //@ts-ignore + //@ts-expect-error this.initError = hexValidation()({value: this.hexData}); this.initError = 'Invalid hex format.'; }; if (this.fileType === 'base64') { this.base64Data = this.value; - //@ts-ignore + //@ts-expect-error this.initError = base64Validation()({value: this.hexData}); this.initError = 'Invalid base64 format.'; }; if (this.fileType === 'file') { - //@ts-ignore + //@ts-expect-error const blob = new Blob([this.value]); this.fileURL = this.sanitazer.bypassSecurityTrustUrl(URL.createObjectURL(blob)); }; @@ -99,7 +99,7 @@ export class FileEditComponent extends BaseEditFieldComponent { } onHexChange() { - //@ts-ignore + //@ts-expect-error this.isNotSwitcherActive = hexValidation()({value: this.hexData}); this.onFieldChange.emit(this.hexData); } @@ -137,7 +137,7 @@ export class FileEditComponent extends BaseEditFieldComponent { }; this.hexData = result; this.isNotSwitcherActive = false; - } catch(e) { + } catch(_e) { this.isNotSwitcherActive = true; } } diff --git a/frontend/src/app/components/ui-components/record-edit-fields/foreign-key/foreign-key.component.ts b/frontend/src/app/components/ui-components/record-edit-fields/foreign-key/foreign-key.component.ts index a52e2a16..f7661f92 100644 --- a/frontend/src/app/components/ui-components/record-edit-fields/foreign-key/foreign-key.component.ts +++ b/frontend/src/app/components/ui-components/record-edit-fields/foreign-key/foreign-key.component.ts @@ -1,5 +1,5 @@ import { Component, Input } from '@angular/core'; -import { debounceTime, distinctUntilChanged } from 'rxjs/operators'; +import { debounceTime, } from 'rxjs/operators'; import { BaseEditFieldComponent } from '../base-row-field/base-row-field.component'; import { CommonModule } from '@angular/common'; @@ -61,7 +61,7 @@ export class ForeignKeyEditComponent extends BaseEditFieldComponent { super(); this.autocmpleteUpdate.pipe( debounceTime(500)) - .subscribe(value => { + .subscribe(_value => { if (this.currentDisplayedString === '') this.onFieldChange.emit(null); this.fetchSuggestions(); }); @@ -71,7 +71,7 @@ export class ForeignKeyEditComponent extends BaseEditFieldComponent { super.ngOnInit(); this.connectionID = this._connections.currentConnectionID; - if (this.widgetStructure && this.widgetStructure.widget_params) { + if (this.widgetStructure?.widget_params) { this.fkRelations = this.widgetStructure.widget_params as TableForeignKey; } else if (this.relations) { this.fkRelations = this.relations; diff --git a/frontend/src/app/components/ui-components/record-edit-fields/language/language.component.ts b/frontend/src/app/components/ui-components/record-edit-fields/language/language.component.ts index c5835378..59a71d0e 100644 --- a/frontend/src/app/components/ui-components/record-edit-fields/language/language.component.ts +++ b/frontend/src/app/components/ui-components/record-edit-fields/language/language.component.ts @@ -1,4 +1,4 @@ -import { LANGUAGES, getLanguageFlag, Language } from '../../../../consts/languages'; +import { LANGUAGES, getLanguageFlag, } from '../../../../consts/languages'; import { CUSTOM_ELEMENTS_SCHEMA, Component, Input } from '@angular/core'; import { map, startWith } from 'rxjs/operators'; @@ -84,8 +84,8 @@ export class LanguageEditComponent extends BaseEditFieldComponent { const filterValue = value.toLowerCase(); return this.languages.filter(language => language.label?.toLowerCase().includes(filterValue) || - (language.value && language.value.toLowerCase().includes(filterValue)) || - (language.nativeName && language.nativeName.toLowerCase().includes(filterValue)) + (language.value?.toLowerCase().includes(filterValue)) || + (language.nativeName?.toLowerCase().includes(filterValue)) ); } diff --git a/frontend/src/app/components/ui-components/record-edit-fields/long-text/long-text.component.ts b/frontend/src/app/components/ui-components/record-edit-fields/long-text/long-text.component.ts index 2e69cf0e..0bebc14a 100644 --- a/frontend/src/app/components/ui-components/record-edit-fields/long-text/long-text.component.ts +++ b/frontend/src/app/components/ui-components/record-edit-fields/long-text/long-text.component.ts @@ -26,12 +26,12 @@ export class LongTextEditComponent extends BaseEditFieldComponent implements OnI super.ngOnInit(); // Use character_maximum_length from the field structure if available - if (this.structure && this.structure.character_maximum_length) { + if (this.structure?.character_maximum_length) { this.maxLength = this.structure.character_maximum_length; } // Parse widget parameters - if (this.widgetStructure && this.widgetStructure.widget_params) { + if (this.widgetStructure?.widget_params) { const params = typeof this.widgetStructure.widget_params === 'string' ? JSON.parse(this.widgetStructure.widget_params) : this.widgetStructure.widget_params; diff --git a/frontend/src/app/components/ui-components/record-edit-fields/money/money.component.spec.ts b/frontend/src/app/components/ui-components/record-edit-fields/money/money.component.spec.ts index 63a8a89e..bea664cd 100644 --- a/frontend/src/app/components/ui-components/record-edit-fields/money/money.component.spec.ts +++ b/frontend/src/app/components/ui-components/record-edit-fields/money/money.component.spec.ts @@ -27,13 +27,13 @@ describe('MoneyEditComponent', () => { fixture = TestBed.createComponent(MoneyEditComponent); component = fixture.componentInstance; - + // Set required properties from base component component.label = 'Test Money'; component.required = false; component.disabled = false; component.readonly = false; - + fixture.detectChanges(); }); @@ -78,7 +78,7 @@ describe('MoneyEditComponent', () => { it('should format amount with correct decimal places', () => { component.decimalPlaces = 2; - const formatted = component['formatAmount'](123.456); + const formatted = component.formatAmount(123.456); expect(formatted).toBe('123.46'); }); @@ -87,9 +87,9 @@ describe('MoneyEditComponent', () => { component.selectedCurrency = 'EUR'; component.amount = 100; spyOn(component.onFieldChange, 'emit'); - + component.onCurrencyChange(); - + expect(component.onFieldChange.emit).toHaveBeenCalledWith({ amount: 100, currency: 'EUR' @@ -100,9 +100,9 @@ describe('MoneyEditComponent', () => { component.displayAmount = '123.45'; component.selectedCurrency = 'USD'; spyOn(component.onFieldChange, 'emit'); - + component.onAmountChange(); - + expect(component.amount).toBe(123.45); expect(component.onFieldChange.emit).toHaveBeenCalledWith(123.45); }); @@ -112,9 +112,9 @@ describe('MoneyEditComponent', () => { component.displayAmount = '123.45'; component.selectedCurrency = 'USD'; spyOn(component.onFieldChange, 'emit'); - + component.onAmountChange(); - + expect(component.amount).toBe(123.45); expect(component.onFieldChange.emit).toHaveBeenCalledWith({ amount: 123.45, @@ -125,40 +125,39 @@ describe('MoneyEditComponent', () => { it('should handle invalid amount input with letters', () => { component.amount = 100; component.displayAmount = 'abc123def'; // Contains letters which get stripped - + component.onAmountChange(); component.onAmountBlur(); - + expect(component.amount).toBe(123); expect(component.displayAmount).toBe('123.00'); }); it('should handle completely invalid input', () => { - component.amount = 100; + component.amount = 100 as string | number; component.displayAmount = 'invalid'; // All letters, becomes empty after strip - + component.onAmountChange(); - - // @ts-ignore - expect(component.amount).toBe(''); + + expect(component.amount as string).toBe(''); expect(component.displayAmount).toBe(''); }); it('should handle invalid amount input when amount is empty', () => { component.amount = ''; component.displayAmount = 'invalid'; - + component.onAmountChange(); - + expect(component.displayAmount).toBe(''); }); it('should respect allow_negative configuration', () => { component.allowNegative = false; component.displayAmount = '-123.45'; - + component.onAmountChange(); - + expect(component.amount).toBe(123.45); }); @@ -175,9 +174,9 @@ describe('MoneyEditComponent', () => { allow_negative: false } }; - + component.configureFromWidgetParams(); - + expect(component.defaultCurrency).toBe('EUR'); expect(component.showCurrencySelector).toBe(true); expect(component.decimalPlaces).toBe(3); @@ -187,25 +186,25 @@ describe('MoneyEditComponent', () => { it('should return correct display value', () => { component.amount = 123.45; component.selectedCurrency = 'USD'; - + const displayValue = component.displayValue; - + expect(displayValue).toBe('$123.45'); }); it('should return correct placeholder', () => { component.selectedCurrency = 'EUR'; - + const placeholder = component.placeholder; - + expect(placeholder).toBe('Enter amount in Euro'); }); it('should find selected currency data', () => { component.selectedCurrency = 'GBP'; - + const currencyData = component.selectedCurrencyData; - + expect(currencyData.code).toBe('GBP'); expect(currencyData.name).toBe('British Pound'); expect(currencyData.symbol).toBe('£'); @@ -214,9 +213,9 @@ describe('MoneyEditComponent', () => { it('should emit empty value when amount is cleared', () => { component.amount = ''; spyOn(component.onFieldChange, 'emit'); - - component['updateValue'](); - + + component.updateValue(); + expect(component.onFieldChange.emit).toHaveBeenCalledWith(''); }); -}); \ No newline at end of file +}); diff --git a/frontend/src/app/components/ui-components/record-edit-fields/money/money.component.ts b/frontend/src/app/components/ui-components/record-edit-fields/money/money.component.ts index 65d52d5d..62dbe872 100644 --- a/frontend/src/app/components/ui-components/record-edit-fields/money/money.component.ts +++ b/frontend/src/app/components/ui-components/record-edit-fields/money/money.component.ts @@ -37,7 +37,7 @@ export class MoneyEditComponent extends BaseEditFieldComponent implements OnInit } configureFromWidgetParams(): void { - if (this.widgetStructure && this.widgetStructure.widget_params) { + if (this.widgetStructure?.widget_params) { const params = this.widgetStructure.widget_params; if (typeof params.default_currency === 'string') { @@ -122,7 +122,7 @@ export class MoneyEditComponent extends BaseEditFieldComponent implements OnInit // Parse the number const numericValue = parseFloat(cleanValue); - if (!isNaN(numericValue)) { + if (!Number.isNaN(numericValue)) { this.amount = numericValue; // Don't reformat while user is typing to preserve focus if (this.displayAmount !== cleanValue) { @@ -146,21 +146,21 @@ export class MoneyEditComponent extends BaseEditFieldComponent implements OnInit } } - private formatAmount(amount: number | string): string { + public formatAmount(amount: number | string): string { if (amount === '' || amount === null || amount === undefined) { return ''; } const numericAmount = typeof amount === 'string' ? parseFloat(amount) : amount; - if (isNaN(numericAmount)) { + if (Number.isNaN(numericAmount)) { return ''; } return numericAmount.toFixed(this.decimalPlaces); } - private updateValue(): void { + public updateValue(): void { if (this.amount === '' || this.amount === null || this.amount === undefined) { this.value = ''; } else { @@ -202,4 +202,4 @@ export class MoneyEditComponent extends BaseEditFieldComponent implements OnInit displayCurrencyFn(currency: Money): string { return currency ? `${currency.flag || ''} ${currency.code} - ${currency.name}` : ''; } -} \ No newline at end of file +} diff --git a/frontend/src/app/components/ui-components/record-edit-fields/phone/phone.component.ts b/frontend/src/app/components/ui-components/record-edit-fields/phone/phone.component.ts index d9d1caf9..e785d751 100644 --- a/frontend/src/app/components/ui-components/record-edit-fields/phone/phone.component.ts +++ b/frontend/src/app/components/ui-components/record-edit-fields/phone/phone.component.ts @@ -1,4 +1,4 @@ -import { AsYouType, CountryCode as LibPhoneCountryCode, getCountries, getCountryCallingCode, parsePhoneNumber } from 'libphonenumber-js'; +import { AsYouType, CountryCode as LibPhoneCountryCode, parsePhoneNumber } from 'libphonenumber-js'; import { Component, Injectable, Input, OnInit } from '@angular/core'; import { Observable, map, startWith } from 'rxjs'; @@ -299,7 +299,7 @@ export class PhoneEditComponent extends BaseEditFieldComponent implements OnInit } configureFromWidgetParams(): void { - if (this.widgetStructure && this.widgetStructure.widget_params) { + if (this.widgetStructure?.widget_params) { const params = this.widgetStructure.widget_params; if (params.preferred_countries && Array.isArray(params.preferred_countries)) { @@ -333,7 +333,7 @@ export class PhoneEditComponent extends BaseEditFieldComponent implements OnInit try { // First try to parse as international number phoneNumber = parsePhoneNumber(fullNumber); - } catch (error) { + } catch (_error) { // Will try with default country below } @@ -347,7 +347,7 @@ export class PhoneEditComponent extends BaseEditFieldComponent implements OnInit } } - if (phoneNumber && phoneNumber.country) { + if (phoneNumber?.country) { // Find the country in our list - exact match by country code const country = this.countries.find(c => c.code === phoneNumber.country); if (country) { @@ -463,7 +463,7 @@ export class PhoneEditComponent extends BaseEditFieldComponent implements OnInit try { const phoneNumber = parsePhoneNumber(this.displayPhoneNumber); - if (phoneNumber && phoneNumber.country) { + if (phoneNumber?.country) { const detectedCountry = this.countries.find(c => c.code === phoneNumber.country); if (detectedCountry) { this.selectedCountry = detectedCountry; @@ -502,7 +502,7 @@ export class PhoneEditComponent extends BaseEditFieldComponent implements OnInit phoneNumber = parsePhoneNumber(this.displayPhoneNumber, this.selectedCountry.code as LibPhoneCountryCode); } - if (phoneNumber && phoneNumber.isValid()) { + if (phoneNumber?.isValid()) { // Store in international format without spaces (E164) this.value = phoneNumber.number; // E164 format: +380671111111 } else { @@ -702,7 +702,7 @@ export class PhoneEditComponent extends BaseEditFieldComponent implements OnInit } return phoneNumber ? phoneNumber.isValid() : false; - } catch (error) { + } catch (_error) { return false; } } diff --git a/frontend/src/app/components/ui-components/record-edit-fields/text/text.component.ts b/frontend/src/app/components/ui-components/record-edit-fields/text/text.component.ts index 3aa4f65b..3d890352 100644 --- a/frontend/src/app/components/ui-components/record-edit-fields/text/text.component.ts +++ b/frontend/src/app/components/ui-components/record-edit-fields/text/text.component.ts @@ -28,12 +28,12 @@ export class TextEditComponent extends BaseEditFieldComponent implements OnInit super.ngOnInit(); // Use character_maximum_length from the field structure if available - if (this.structure && this.structure.character_maximum_length) { + if (this.structure?.character_maximum_length) { this.maxLength = this.structure.character_maximum_length; } // Parse widget parameters for validation - if (this.widgetStructure && this.widgetStructure.widget_params) { + if (this.widgetStructure?.widget_params) { const params = typeof this.widgetStructure.widget_params === 'string' ? JSON.parse(this.widgetStructure.widget_params) : this.widgetStructure.widget_params; diff --git a/frontend/src/app/components/ui-components/record-edit-fields/time-interval/time-interval.component.ts b/frontend/src/app/components/ui-components/record-edit-fields/time-interval/time-interval.component.ts index 197dc27b..e5a1113b 100644 --- a/frontend/src/app/components/ui-components/record-edit-fields/time-interval/time-interval.component.ts +++ b/frontend/src/app/components/ui-components/record-edit-fields/time-interval/time-interval.component.ts @@ -30,12 +30,11 @@ export class TimeIntervalEditComponent extends BaseEditFieldComponent { ngOnInit(): void { super.ngOnInit(); - // @ts-ignore if (this.value) this.interval = this.value; } onInputChange() { - // @ts-ignore + // @ts-expect-error const currentInterval = pgInterval.prototype.toPostgres.call(this.interval); this.onFieldChange.emit(currentInterval); } diff --git a/frontend/src/app/components/ui-components/record-edit-fields/timezone/timezone.component.ts b/frontend/src/app/components/ui-components/record-edit-fields/timezone/timezone.component.ts index 93d59958..6d0593d9 100644 --- a/frontend/src/app/components/ui-components/record-edit-fields/timezone/timezone.component.ts +++ b/frontend/src/app/components/ui-components/record-edit-fields/timezone/timezone.component.ts @@ -60,7 +60,7 @@ export class TimezoneEditComponent extends BaseEditFieldComponent { const parts = formatter.formatToParts(now); const offsetPart = parts.find(part => part.type === 'timeZoneName'); - if (offsetPart && offsetPart.value.includes('GMT')) { + if (offsetPart?.value.includes('GMT')) { // Extract offset from "GMT+XX:XX" format const offset = offsetPart.value.replace('GMT', ''); return offset === '' ? '+00:00' : offset; @@ -74,7 +74,7 @@ export class TimezoneEditComponent extends BaseEditFieldComponent { const minutes = Math.abs(offsetMinutes) % 60; const sign = offsetMinutes >= 0 ? '+' : '-'; return `${sign}${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}`; - } catch (error) { + } catch (_error) { return ''; } } diff --git a/frontend/src/app/components/ui-components/record-view-fields/base-record-view-field/base-record-view-field.component.ts b/frontend/src/app/components/ui-components/record-view-fields/base-record-view-field/base-record-view-field.component.ts index fe8eb408..b7651b5d 100644 --- a/frontend/src/app/components/ui-components/record-view-fields/base-record-view-field/base-record-view-field.component.ts +++ b/frontend/src/app/components/ui-components/record-view-fields/base-record-view-field/base-record-view-field.component.ts @@ -1,4 +1,4 @@ -import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { Component, EventEmitter, Input, Output } from '@angular/core'; import { TableField, WidgetStructure } from 'src/app/models/table'; import { CommonModule } from '@angular/common'; diff --git a/frontend/src/app/components/ui-components/record-view-fields/country/country.component.ts b/frontend/src/app/components/ui-components/record-view-fields/country/country.component.ts index 4b841e4e..74c4fa7d 100644 --- a/frontend/src/app/components/ui-components/record-view-fields/country/country.component.ts +++ b/frontend/src/app/components/ui-components/record-view-fields/country/country.component.ts @@ -1,5 +1,5 @@ import { COUNTRIES, getCountryFlag } from '../../../../consts/countries'; -import { Component, Injectable, OnChanges, OnInit, SimpleChanges } from '@angular/core'; +import { Component, Injectable, OnInit, } from '@angular/core'; import { BaseRecordViewFieldComponent } from '../base-record-view-field/base-record-view-field.component'; import { CommonModule } from '@angular/common'; diff --git a/frontend/src/app/components/ui-components/record-view-fields/date-time/date-time.component.ts b/frontend/src/app/components/ui-components/record-view-fields/date-time/date-time.component.ts index 1eb0ff15..a36abe6b 100644 --- a/frontend/src/app/components/ui-components/record-view-fields/date-time/date-time.component.ts +++ b/frontend/src/app/components/ui-components/record-view-fields/date-time/date-time.component.ts @@ -19,12 +19,12 @@ export class DateTimeRecordViewComponent extends BaseRecordViewFieldComponent im if (this.value) { try { const date = new Date(this.value); - if (!isNaN(date.getTime())) { + if (!Number.isNaN(date.getTime())) { this.formattedDateTime = format(date, "P p"); } else { this.formattedDateTime = this.value; } - } catch (error) { + } catch (_error) { this.formattedDateTime = this.value; } } diff --git a/frontend/src/app/components/ui-components/record-view-fields/date/date.component.ts b/frontend/src/app/components/ui-components/record-view-fields/date/date.component.ts index 846ccd90..31fb8c8b 100644 --- a/frontend/src/app/components/ui-components/record-view-fields/date/date.component.ts +++ b/frontend/src/app/components/ui-components/record-view-fields/date/date.component.ts @@ -1,5 +1,5 @@ import { Component, Injectable, OnInit } from '@angular/core'; -import { format, parseISO } from 'date-fns'; +import { format, } from 'date-fns'; import { BaseRecordViewFieldComponent } from '../base-record-view-field/base-record-view-field.component'; @@ -19,12 +19,12 @@ export class DateRecordViewComponent extends BaseRecordViewFieldComponent implem if (this.value) { try { const date = new Date(this.value); - if (!isNaN(date.getTime())) { + if (!Number.isNaN(date.getTime())) { this.formattedDate = format(date, "P"); } else { this.formattedDate = this.value; } - } catch (error) { + } catch (_error) { this.formattedDate = this.value; } } diff --git a/frontend/src/app/components/ui-components/record-view-fields/foreign-key/foreign-key.component.ts b/frontend/src/app/components/ui-components/record-view-fields/foreign-key/foreign-key.component.ts index 82a8068d..5dc66fc3 100644 --- a/frontend/src/app/components/ui-components/record-view-fields/foreign-key/foreign-key.component.ts +++ b/frontend/src/app/components/ui-components/record-view-fields/foreign-key/foreign-key.component.ts @@ -1,11 +1,8 @@ import { Component, EventEmitter, Injectable, Input, OnInit, Output } from '@angular/core'; import { BaseRecordViewFieldComponent } from '../base-record-view-field/base-record-view-field.component'; -import { ClipboardModule } from '@angular/cdk/clipboard'; import { CommonModule } from '@angular/common'; -import { MatButtonModule } from '@angular/material/button'; import { MatIconModule } from '@angular/material/icon'; -import { MatTooltipModule } from '@angular/material/tooltip'; import { RouterModule } from '@angular/router'; @Injectable() @@ -24,10 +21,6 @@ export class ForeignKeyRecordViewComponent extends BaseRecordViewFieldComponent public foreignKeyURLParams: any; - constructor() { - super(); - } - ngOnInit() { this.foreignKeyURLParams = {...this.primaryKeysParams, mode: 'view'} } diff --git a/frontend/src/app/components/ui-components/record-view-fields/money/money.component.ts b/frontend/src/app/components/ui-components/record-view-fields/money/money.component.ts index f0154db6..440e4865 100644 --- a/frontend/src/app/components/ui-components/record-view-fields/money/money.component.ts +++ b/frontend/src/app/components/ui-components/record-view-fields/money/money.component.ts @@ -17,7 +17,7 @@ export class MoneyRecordViewComponent extends BaseRecordViewFieldComponent imple ngOnInit(): void { // Get currency from widget params this.displayCurrency = ''; - if (this.widgetStructure && this.widgetStructure.widget_params && this.widgetStructure.widget_params.default_currency) { + if (this.widgetStructure?.widget_params?.default_currency) { this.displayCurrency = this.widgetStructure.widget_params.default_currency; const currency = getCurrencyByCode(this.displayCurrency); this.currencySymbol = currency ? currency.symbol : ''; @@ -47,7 +47,7 @@ export class MoneyRecordViewComponent extends BaseRecordViewFieldComponent imple amount = parseFloat(amount); } - if (isNaN(amount as number)) { + if (Number.isNaN(amount as number)) { return ''; } diff --git a/frontend/src/app/components/ui-components/record-view-fields/phone/phone.component.ts b/frontend/src/app/components/ui-components/record-view-fields/phone/phone.component.ts index 133a663d..6024f7e9 100644 --- a/frontend/src/app/components/ui-components/record-view-fields/phone/phone.component.ts +++ b/frontend/src/app/components/ui-components/record-view-fields/phone/phone.component.ts @@ -32,7 +32,7 @@ export class PhoneRecordViewComponent extends BaseRecordViewFieldComponent imple try { const phoneNumber = parsePhoneNumber(this.value); - if (phoneNumber && phoneNumber.country) { + if (phoneNumber?.country) { const country = COUNTRIES.find(c => c.code === phoneNumber.country); if (country) { @@ -49,7 +49,7 @@ export class PhoneRecordViewComponent extends BaseRecordViewFieldComponent imple this.countryName = ''; this.formattedNumber = this.value; } - } catch (error) { + } catch (_error) { this.countryFlag = ''; this.countryName = ''; this.formattedNumber = this.value; diff --git a/frontend/src/app/components/ui-components/record-view-fields/point/point.component.ts b/frontend/src/app/components/ui-components/record-view-fields/point/point.component.ts index 28aa20ea..f36e7666 100644 --- a/frontend/src/app/components/ui-components/record-view-fields/point/point.component.ts +++ b/frontend/src/app/components/ui-components/record-view-fields/point/point.component.ts @@ -37,7 +37,7 @@ export class PointRecordViewComponent extends BaseRecordViewFieldComponent imple const y = this.value.y || this.value[1]; this.formattedPoint = `(${x}, ${y})`; } - } catch (e) { + } catch (_e) { this.formattedPoint = String(this.value); } } diff --git a/frontend/src/app/components/ui-components/record-view-fields/select/select.component.ts b/frontend/src/app/components/ui-components/record-view-fields/select/select.component.ts index fb414c93..b15c2b62 100644 --- a/frontend/src/app/components/ui-components/record-view-fields/select/select.component.ts +++ b/frontend/src/app/components/ui-components/record-view-fields/select/select.component.ts @@ -29,7 +29,7 @@ export class SelectRecordViewComponent extends BaseRecordViewFieldComponent impl (opt: { value: any, label: string }) => opt.value === this.value ); this.displayValue = option ? option.label : this.value; - this.backgroundColor = option && option.background_color ? option.background_color : 'transparent'; + this.backgroundColor = option?.background_color ? option.background_color : 'transparent'; } else if (this.structure?.data_type_params) { // If no widget structure but we have data_type_params, just use the value this.displayValue = this.value; diff --git a/frontend/src/app/components/ui-components/record-view-fields/time-interval/time-interval.component.ts b/frontend/src/app/components/ui-components/record-view-fields/time-interval/time-interval.component.ts index 278f1c60..4fa47b4a 100644 --- a/frontend/src/app/components/ui-components/record-view-fields/time-interval/time-interval.component.ts +++ b/frontend/src/app/components/ui-components/record-view-fields/time-interval/time-interval.component.ts @@ -30,7 +30,7 @@ export class TimeIntervalRecordViewComponent extends BaseRecordViewFieldComponen if (interval.milliseconds) parts.push(`${interval.milliseconds}ms`); this.formattedInterval = parts.length > 0 ? parts.join(' ') : '0'; - } catch (e) { + } catch (_e) { this.formattedInterval = String(this.value); } } diff --git a/frontend/src/app/components/ui-components/record-view-fields/time/time.component.ts b/frontend/src/app/components/ui-components/record-view-fields/time/time.component.ts index ac284dbd..f9aeceda 100644 --- a/frontend/src/app/components/ui-components/record-view-fields/time/time.component.ts +++ b/frontend/src/app/components/ui-components/record-view-fields/time/time.component.ts @@ -23,13 +23,13 @@ export class TimeRecordViewComponent extends BaseRecordViewFieldComponent implem this.formattedTime = this.value; } else { const date = new Date(this.value); - if (!isNaN(date.getTime())) { + if (!Number.isNaN(date.getTime())) { this.formattedTime = format(date, 'HH:mm:ss'); } else { this.formattedTime = this.value; } } - } catch (error) { + } catch (_error) { this.formattedTime = this.value; } } diff --git a/frontend/src/app/components/ui-components/record-view-fields/timezone/timezone.component.ts b/frontend/src/app/components/ui-components/record-view-fields/timezone/timezone.component.ts index e02d5781..68ea74e5 100644 --- a/frontend/src/app/components/ui-components/record-view-fields/timezone/timezone.component.ts +++ b/frontend/src/app/components/ui-components/record-view-fields/timezone/timezone.component.ts @@ -18,7 +18,7 @@ export class TimezoneRecordViewComponent extends BaseRecordViewFieldComponent { try { const offset = this.getTimezoneOffset(this.value); return `${this.value} (UTC${offset})`; - } catch (error) { + } catch (_error) { return this.value; } } @@ -34,7 +34,7 @@ export class TimezoneRecordViewComponent extends BaseRecordViewFieldComponent { const parts = formatter.formatToParts(now); const offsetPart = parts.find(part => part.type === 'timeZoneName'); - if (offsetPart && offsetPart.value.includes('GMT')) { + if (offsetPart?.value.includes('GMT')) { const offset = offsetPart.value.replace('GMT', ''); return offset === '' ? '+00:00' : offset; } diff --git a/frontend/src/app/components/ui-components/table-display-fields/base-table-display-field/base-table-display-field.component.ts b/frontend/src/app/components/ui-components/table-display-fields/base-table-display-field/base-table-display-field.component.ts index 8663c31d..d598a13f 100644 --- a/frontend/src/app/components/ui-components/table-display-fields/base-table-display-field/base-table-display-field.component.ts +++ b/frontend/src/app/components/ui-components/table-display-fields/base-table-display-field/base-table-display-field.component.ts @@ -1,8 +1,7 @@ -import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; -import { TableField, TableForeignKey, WidgetStructure } from 'src/app/models/table'; +import { Component, EventEmitter, Input, Output } from '@angular/core'; +import { TableField, WidgetStructure } from 'src/app/models/table'; import { CommonModule } from '@angular/common'; -import { normalizeFieldName } from '../../../../lib/normalize'; @Component({ selector: 'app-base-display-field', diff --git a/frontend/src/app/components/ui-components/table-display-fields/country/country.component.ts b/frontend/src/app/components/ui-components/table-display-fields/country/country.component.ts index a23af09e..a23e5ba9 100644 --- a/frontend/src/app/components/ui-components/table-display-fields/country/country.component.ts +++ b/frontend/src/app/components/ui-components/table-display-fields/country/country.component.ts @@ -1,5 +1,5 @@ import { COUNTRIES, getCountryFlag } from '../../../../consts/countries'; -import { Component, OnChanges, OnInit, SimpleChanges } from '@angular/core'; +import { Component, OnInit, } from '@angular/core'; import { BaseTableDisplayFieldComponent } from '../base-table-display-field/base-table-display-field.component'; import { ClipboardModule } from '@angular/cdk/clipboard'; diff --git a/frontend/src/app/components/ui-components/table-display-fields/date-time/date-time.component.ts b/frontend/src/app/components/ui-components/table-display-fields/date-time/date-time.component.ts index 4263a2af..e5fdac88 100644 --- a/frontend/src/app/components/ui-components/table-display-fields/date-time/date-time.component.ts +++ b/frontend/src/app/components/ui-components/table-display-fields/date-time/date-time.component.ts @@ -26,7 +26,7 @@ export class DateTimeDisplayComponent extends BaseTableDisplayFieldComponent imp if (this.value) { try { const date = new Date(this.value); - if (!isNaN(date.getTime())) { + if (!Number.isNaN(date.getTime())) { // Always store the full date/time format for tooltip this.fullDateTime = format(date, "PPpp"); // e.g., "Apr 29, 2023 at 10:30 AM" @@ -40,7 +40,7 @@ export class DateTimeDisplayComponent extends BaseTableDisplayFieldComponent imp this.formattedDateTime = this.value; this.fullDateTime = this.value; } - } catch (error) { + } catch (_error) { this.formattedDateTime = this.value; this.fullDateTime = this.value; } diff --git a/frontend/src/app/components/ui-components/table-display-fields/date/date.component.ts b/frontend/src/app/components/ui-components/table-display-fields/date/date.component.ts index d390c5e1..8601b3f5 100644 --- a/frontend/src/app/components/ui-components/table-display-fields/date/date.component.ts +++ b/frontend/src/app/components/ui-components/table-display-fields/date/date.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { format, parseISO, formatDistanceToNow, differenceInHours } from 'date-fns'; +import { format, formatDistanceToNow, differenceInHours } from 'date-fns'; import { BaseTableDisplayFieldComponent } from '../base-table-display-field/base-table-display-field.component'; import { ClipboardModule } from '@angular/cdk/clipboard'; @@ -26,7 +26,7 @@ export class DateDisplayComponent extends BaseTableDisplayFieldComponent impleme if (this.value) { try { const date = new Date(this.value); - if (!isNaN(date.getTime())) { + if (!Number.isNaN(date.getTime())) { // Always store the full date format for tooltip this.fullDate = format(date, "PPP"); // e.g., "April 29th, 2023" @@ -40,7 +40,7 @@ export class DateDisplayComponent extends BaseTableDisplayFieldComponent impleme this.formattedDate = this.value; this.fullDate = this.value; } - } catch (error) { + } catch (_error) { this.formattedDate = this.value; this.fullDate = this.value; } diff --git a/frontend/src/app/components/ui-components/table-display-fields/foreign-key/foreign-key.component.ts b/frontend/src/app/components/ui-components/table-display-fields/foreign-key/foreign-key.component.ts index 6f7ec39d..1c14baf1 100644 --- a/frontend/src/app/components/ui-components/table-display-fields/foreign-key/foreign-key.component.ts +++ b/frontend/src/app/components/ui-components/table-display-fields/foreign-key/foreign-key.component.ts @@ -21,10 +21,6 @@ export class ForeignKeyDisplayComponent extends BaseTableDisplayFieldComponent { @Output() onForeignKeyClick = new EventEmitter<{foreignKey: any, value: string}>(); - constructor() { - super(); - } - handleForeignKeyClick($event): void { $event.stopPropagation(); if (this.relations && this.value) { diff --git a/frontend/src/app/components/ui-components/table-display-fields/json-editor/json-editor.component.ts b/frontend/src/app/components/ui-components/table-display-fields/json-editor/json-editor.component.ts index fba837ed..9c96e294 100644 --- a/frontend/src/app/components/ui-components/table-display-fields/json-editor/json-editor.component.ts +++ b/frontend/src/app/components/ui-components/table-display-fields/json-editor/json-editor.component.ts @@ -19,7 +19,7 @@ export class JsonEditorDisplayComponent extends BaseTableDisplayFieldComponent { try { const parsedValue = typeof this.value === 'string' ? JSON.parse(this.value) : this.value; return JSON.stringify(parsedValue, null, 2); - } catch (e) { + } catch (_e) { return String(this.value); } } diff --git a/frontend/src/app/components/ui-components/table-display-fields/markdown/markdown.component.ts b/frontend/src/app/components/ui-components/table-display-fields/markdown/markdown.component.ts index 0998b178..9a9b757e 100644 --- a/frontend/src/app/components/ui-components/table-display-fields/markdown/markdown.component.ts +++ b/frontend/src/app/components/ui-components/table-display-fields/markdown/markdown.component.ts @@ -57,7 +57,7 @@ export class MarkdownDisplayComponent extends BaseTableDisplayFieldComponent imp // If no heading or paragraph found, return first non-empty line const firstLine = markdown.trim().split('\n')[0]; return this._truncateText(firstLine, 100); - } catch (error) { + } catch (_error) { // Fallback if parsing fails const firstLine = markdown.trim().split('\n')[0]; return this._truncateText(firstLine, 100); diff --git a/frontend/src/app/components/ui-components/table-display-fields/money/money.component.ts b/frontend/src/app/components/ui-components/table-display-fields/money/money.component.ts index 1ac81948..132d4791 100644 --- a/frontend/src/app/components/ui-components/table-display-fields/money/money.component.ts +++ b/frontend/src/app/components/ui-components/table-display-fields/money/money.component.ts @@ -21,7 +21,7 @@ export class MoneyDisplayComponent extends BaseTableDisplayFieldComponent implem ngOnInit(): void { // Get currency from widget params this.displayCurrency = ''; - if (this.widgetStructure && this.widgetStructure.widget_params && this.widgetStructure.widget_params.default_currency) { + if (this.widgetStructure?.widget_params?.default_currency) { this.displayCurrency = this.widgetStructure.widget_params.default_currency; const currency = getCurrencyByCode(this.displayCurrency); this.currencySymbol = currency ? currency.symbol : ''; @@ -51,7 +51,7 @@ export class MoneyDisplayComponent extends BaseTableDisplayFieldComponent implem amount = parseFloat(amount); } - if (isNaN(amount as number)) { + if (Number.isNaN(amount as number)) { return ''; } diff --git a/frontend/src/app/components/ui-components/table-display-fields/phone/phone.component.ts b/frontend/src/app/components/ui-components/table-display-fields/phone/phone.component.ts index e7f25c19..6a005952 100644 --- a/frontend/src/app/components/ui-components/table-display-fields/phone/phone.component.ts +++ b/frontend/src/app/components/ui-components/table-display-fields/phone/phone.component.ts @@ -34,7 +34,7 @@ export class PhoneDisplayComponent extends BaseTableDisplayFieldComponent implem try { const phoneNumber = parsePhoneNumber(this.value); - if (phoneNumber && phoneNumber.country) { + if (phoneNumber?.country) { const country = COUNTRIES.find(c => c.code === phoneNumber.country); if (country) { @@ -51,7 +51,7 @@ export class PhoneDisplayComponent extends BaseTableDisplayFieldComponent implem this.countryName = ''; this.formattedNumber = this.value; } - } catch (error) { + } catch (_error) { this.countryFlag = ''; this.countryName = ''; this.formattedNumber = this.value; diff --git a/frontend/src/app/components/ui-components/table-display-fields/point/point.component.ts b/frontend/src/app/components/ui-components/table-display-fields/point/point.component.ts index ad8bd883..b42c182d 100644 --- a/frontend/src/app/components/ui-components/table-display-fields/point/point.component.ts +++ b/frontend/src/app/components/ui-components/table-display-fields/point/point.component.ts @@ -40,7 +40,7 @@ export class PointDisplayComponent extends BaseTableDisplayFieldComponent implem const y = this.value.y || this.value[1]; this.formattedPoint = `(${x}, ${y})`; } - } catch (e) { + } catch (_e) { this.formattedPoint = String(this.value); } } diff --git a/frontend/src/app/components/ui-components/table-display-fields/select/select.component.ts b/frontend/src/app/components/ui-components/table-display-fields/select/select.component.ts index ef740785..5888669e 100644 --- a/frontend/src/app/components/ui-components/table-display-fields/select/select.component.ts +++ b/frontend/src/app/components/ui-components/table-display-fields/select/select.component.ts @@ -33,7 +33,7 @@ export class SelectDisplayComponent extends BaseTableDisplayFieldComponent imple (opt: { value: any, label: string }) => opt.value === this.value ); this.displayValue = option ? option.label : this.value; - this.backgroundColor = option && option.background_color ? option.background_color : 'transparent'; + this.backgroundColor = option?.background_color ? option.background_color : 'transparent'; } else if (this.structure?.data_type_params) { // If no widget structure but we have data_type_params, just use the value this.displayValue = this.value; diff --git a/frontend/src/app/components/ui-components/table-display-fields/time-interval/time-interval.component.ts b/frontend/src/app/components/ui-components/table-display-fields/time-interval/time-interval.component.ts index f6e00acd..0bc99097 100644 --- a/frontend/src/app/components/ui-components/table-display-fields/time-interval/time-interval.component.ts +++ b/frontend/src/app/components/ui-components/table-display-fields/time-interval/time-interval.component.ts @@ -34,7 +34,7 @@ export class TimeIntervalDisplayComponent extends BaseTableDisplayFieldComponent if (interval.milliseconds) parts.push(`${interval.milliseconds}ms`); this.formattedInterval = parts.length > 0 ? parts.join(' ') : '0'; - } catch (e) { + } catch (_e) { this.formattedInterval = String(this.value); } } diff --git a/frontend/src/app/components/ui-components/table-display-fields/time/time.component.ts b/frontend/src/app/components/ui-components/table-display-fields/time/time.component.ts index b5619278..3f6cbad5 100644 --- a/frontend/src/app/components/ui-components/table-display-fields/time/time.component.ts +++ b/frontend/src/app/components/ui-components/table-display-fields/time/time.component.ts @@ -26,13 +26,13 @@ export class TimeDisplayComponent extends BaseTableDisplayFieldComponent impleme this.formattedTime = this.value; } else { const date = new Date(this.value); - if (!isNaN(date.getTime())) { + if (!Number.isNaN(date.getTime())) { this.formattedTime = format(date, 'HH:mm:ss'); } else { this.formattedTime = this.value; } } - } catch (error) { + } catch (_error) { this.formattedTime = this.value; } } diff --git a/frontend/src/app/components/ui-components/table-display-fields/timezone/timezone.component.ts b/frontend/src/app/components/ui-components/table-display-fields/timezone/timezone.component.ts index b266e6ff..a867e758 100644 --- a/frontend/src/app/components/ui-components/table-display-fields/timezone/timezone.component.ts +++ b/frontend/src/app/components/ui-components/table-display-fields/timezone/timezone.component.ts @@ -21,7 +21,7 @@ export class TimezoneDisplayComponent extends BaseTableDisplayFieldComponent { try { const offset = this.getTimezoneOffset(this.value); return `${this.value} (UTC${offset})`; - } catch (error) { + } catch (_error) { return this.value; } } @@ -37,7 +37,7 @@ export class TimezoneDisplayComponent extends BaseTableDisplayFieldComponent { const parts = formatter.formatToParts(now); const offsetPart = parts.find(part => part.type === 'timeZoneName'); - if (offsetPart && offsetPart.value.includes('GMT')) { + if (offsetPart?.value.includes('GMT')) { const offset = offsetPart.value.replace('GMT', ''); return offset === '' ? '+00:00' : offset; } @@ -50,7 +50,7 @@ export class TimezoneDisplayComponent extends BaseTableDisplayFieldComponent { const minutes = Math.abs(offsetMinutes) % 60; const sign = offsetMinutes >= 0 ? '+' : '-'; return `${sign}${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}`; - } catch (error) { + } catch (_error) { return ''; } } diff --git a/frontend/src/app/components/ui-components/user-password/user-password.component.ts b/frontend/src/app/components/ui-components/user-password/user-password.component.ts index 3c027b75..97e5c3bc 100644 --- a/frontend/src/app/components/ui-components/user-password/user-password.component.ts +++ b/frontend/src/app/components/ui-components/user-password/user-password.component.ts @@ -32,8 +32,6 @@ export class UserPasswordComponent implements OnInit { public passwordHidden: boolean; - constructor() { } - ngOnInit(): void { } diff --git a/frontend/src/app/components/upgrade-success/upgrade-success.component.spec.ts b/frontend/src/app/components/upgrade-success/upgrade-success.component.spec.ts index 7cb43f0e..9332c672 100644 --- a/frontend/src/app/components/upgrade-success/upgrade-success.component.spec.ts +++ b/frontend/src/app/components/upgrade-success/upgrade-success.component.spec.ts @@ -1,8 +1,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ActivatedRoute, convertToParamMap } from '@angular/router'; +import { ActivatedRoute, } from '@angular/router'; import { UpgradeSuccessComponent } from './upgrade-success.component'; -import { of } from 'rxjs'; import { MatSnackBarModule } from '@angular/material/snack-bar'; describe('UpgradeSuccessComponent', () => { diff --git a/frontend/src/app/components/upgrade/upgrade.component.spec.ts b/frontend/src/app/components/upgrade/upgrade.component.spec.ts index fd15c5c2..bcf9ada3 100644 --- a/frontend/src/app/components/upgrade/upgrade.component.spec.ts +++ b/frontend/src/app/components/upgrade/upgrade.component.spec.ts @@ -9,7 +9,7 @@ import { provideHttpClient } from '@angular/common/http'; describe('UpgradeComponent', () => { let component: UpgradeComponent; let fixture: ComponentFixture; - let userService: UserService; + let _userService: UserService; beforeEach(async () => { await TestBed.configureTestingModule({ @@ -25,7 +25,7 @@ describe('UpgradeComponent', () => { beforeEach(() => { fixture = TestBed.createComponent(UpgradeComponent); component = fixture.componentInstance; - userService = TestBed.get(UserService); + _userService = TestBed.get(UserService); fixture.detectChanges(); }); diff --git a/frontend/src/app/components/user-deleted-success/user-deleted-success.component.ts b/frontend/src/app/components/user-deleted-success/user-deleted-success.component.ts index 92b2049d..08313896 100644 --- a/frontend/src/app/components/user-deleted-success/user-deleted-success.component.ts +++ b/frontend/src/app/components/user-deleted-success/user-deleted-success.component.ts @@ -11,8 +11,6 @@ import { CommonModule } from '@angular/common'; }) export class UserDeletedSuccessComponent implements OnInit { - constructor() { } - ngOnInit(): void { } diff --git a/frontend/src/app/components/user-settings/account-delete-confirmation/account-delete-confirmation.component.ts b/frontend/src/app/components/user-settings/account-delete-confirmation/account-delete-confirmation.component.ts index d508d52b..b23ae244 100644 --- a/frontend/src/app/components/user-settings/account-delete-confirmation/account-delete-confirmation.component.ts +++ b/frontend/src/app/components/user-settings/account-delete-confirmation/account-delete-confirmation.component.ts @@ -1,5 +1,5 @@ import { Component, Inject, OnInit } from '@angular/core'; -import { MatDialogRef, MAT_DIALOG_DATA, MatDialog, MatDialogModule } from '@angular/material/dialog'; +import { MatDialogRef, MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog'; import { UserService } from 'src/app/services/user.service'; import { Router } from '@angular/router'; import { Angulartics2 } from 'angulartics2'; diff --git a/frontend/src/app/components/user-settings/enable-two-fa-dialog/enable-two-fa-dialog.component.ts b/frontend/src/app/components/user-settings/enable-two-fa-dialog/enable-two-fa-dialog.component.ts index 429c2047..d158dde2 100644 --- a/frontend/src/app/components/user-settings/enable-two-fa-dialog/enable-two-fa-dialog.component.ts +++ b/frontend/src/app/components/user-settings/enable-two-fa-dialog/enable-two-fa-dialog.component.ts @@ -3,7 +3,6 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { UserService } from 'src/app/services/user.service'; import { GroupDeleteDialogComponent } from '../../users/group-delete-dialog/group-delete-dialog.component'; import { Angulartics2 } from 'angulartics2'; -import { NgClass } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { MatDialogModule } from '@angular/material/dialog'; import { MatFormFieldModule } from '@angular/material/form-field'; diff --git a/frontend/src/app/components/user-settings/user-settings.component.ts b/frontend/src/app/components/user-settings/user-settings.component.ts index 6138bf04..957e728d 100644 --- a/frontend/src/app/components/user-settings/user-settings.component.ts +++ b/frontend/src/app/components/user-settings/user-settings.component.ts @@ -1,7 +1,7 @@ import { Alert, AlertActionType, AlertType } from 'src/app/models/alert'; import { Angulartics2, Angulartics2OnModule } from 'angulartics2'; import { ApiKey, User } from 'src/app/models/user'; -import { Component, Input, OnInit } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; import { AccountDeleteDialogComponent } from './account-delete-dialog/account-delete-dialog.component'; import { AlertComponent } from '../ui-components/alert/alert.component'; @@ -140,7 +140,7 @@ export class UserSettingsComponent implements OnInit { changeUserName() { this.submittingChangedName = true; this._userService.changeUserName(this.userName) - .subscribe((res) => { + .subscribe((_res) => { this.submittingChangedName = false; this.angulartics2.eventTrack.next({ action: 'User settings: user name is updated successfully', diff --git a/frontend/src/app/components/users/group-add-dialog/group-add-dialog.component.spec.ts b/frontend/src/app/components/users/group-add-dialog/group-add-dialog.component.spec.ts index 0b84b32a..44b25fa4 100644 --- a/frontend/src/app/components/users/group-add-dialog/group-add-dialog.component.spec.ts +++ b/frontend/src/app/components/users/group-add-dialog/group-add-dialog.component.spec.ts @@ -1,5 +1,5 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { MAT_DIALOG_DATA, MatDialogRef, MatDialogModule, MatDialog } from '@angular/material/dialog'; +import { MAT_DIALOG_DATA, MatDialogRef, MatDialogModule, } from '@angular/material/dialog'; import { FormsModule } from '@angular/forms'; import { GroupAddDialogComponent } from './group-add-dialog.component'; diff --git a/frontend/src/app/components/users/user-add-dialog/user-add-dialog.component.spec.ts b/frontend/src/app/components/users/user-add-dialog/user-add-dialog.component.spec.ts index 473988c3..c367ae2c 100644 --- a/frontend/src/app/components/users/user-add-dialog/user-add-dialog.component.spec.ts +++ b/frontend/src/app/components/users/user-add-dialog/user-add-dialog.component.spec.ts @@ -8,7 +8,6 @@ import { of } from 'rxjs'; import { UsersService } from 'src/app/services/users.service'; import { Angulartics2Module } from 'angulartics2'; import { provideHttpClient } from '@angular/common/http'; -import { group } from 'console'; import { RouterTestingModule } from '@angular/router/testing'; describe('UserAddDialogComponent', () => { diff --git a/frontend/src/app/components/users/user-add-dialog/user-add-dialog.component.ts b/frontend/src/app/components/users/user-add-dialog/user-add-dialog.component.ts index 33b07d2f..26e974b2 100644 --- a/frontend/src/app/components/users/user-add-dialog/user-add-dialog.component.ts +++ b/frontend/src/app/components/users/user-add-dialog/user-add-dialog.component.ts @@ -1,11 +1,9 @@ import { Component, OnInit, Inject } from '@angular/core'; import { UsersService } from 'src/app/services/users.service'; import { MAT_DIALOG_DATA, MatDialogRef, MatDialogModule } from '@angular/material/dialog'; -import { UserGroup } from 'src/app/models/user'; import { Angulartics2 } from 'angulartics2'; import { CompanyService } from 'src/app/services/company.service'; import { UserService } from 'src/app/services/user.service'; -import { differenceBy } from "lodash"; import { FormsModule } from '@angular/forms'; import { MatFormFieldModule } from '@angular/material/form-field'; import { MatSelectModule } from '@angular/material/select'; @@ -36,9 +34,7 @@ export class UserAddDialogComponent implements OnInit { constructor( @Inject(MAT_DIALOG_DATA) public data: any, - private _usersService: UsersService, - private _userService: UserService, - private _company: CompanyService, + private _usersService: UsersService,_userService: UserService,_company: CompanyService, private angulartics2: Angulartics2, private dialogRef: MatDialogRef ) { } @@ -50,7 +46,7 @@ export class UserAddDialogComponent implements OnInit { joinGroupUser() { this.submitting = true; this._usersService.addGroupUser(this.data.group.id, this.groupUserEmail) - .subscribe((res) => { + .subscribe((_res) => { this.dialogRef.close(); this.submitting = false; this.angulartics2.eventTrack.next({ diff --git a/frontend/src/app/components/users/users.component.ts b/frontend/src/app/components/users/users.component.ts index e30b6aee..f4a06112 100644 --- a/frontend/src/app/components/users/users.component.ts +++ b/frontend/src/app/components/users/users.component.ts @@ -1,9 +1,9 @@ -import { Alert, AlertType } from 'src/app/models/alert'; + import { CommonModule, NgClass, NgForOf, NgIf } from '@angular/common'; import { Component, OnDestroy, OnInit } from '@angular/core'; import { GroupUser, User, UserGroup, UserGroupInfo } from 'src/app/models/user'; import { MatAccordion, MatExpansionModule } from '@angular/material/expansion'; -import { Observable, Subscription, first, forkJoin, take, tap } from 'rxjs'; +import { Observable, Subscription, forkJoin, take, tap } from 'rxjs'; import { Angulartics2 } from 'angulartics2'; import { Angulartics2OnModule } from 'angulartics2'; @@ -57,8 +57,6 @@ export class UsersComponent implements OnInit, OnDestroy { public connectionID: string | null = null; public companyMembers: []; public companyMembersWithoutAccess: any = []; - - private getTitleSubscription: Subscription; private usersSubscription: Subscription; constructor( @@ -67,8 +65,7 @@ export class UsersComponent implements OnInit, OnDestroy { private _connections: ConnectionsService, private _company: CompanyService, public dialog: MatDialog, - private title: Title, - private angulartics2: Angulartics2, + private title: Title,_angulartics2: Angulartics2, ) { } ngOnInit() { @@ -139,7 +136,7 @@ export class UsersComponent implements OnInit, OnDestroy { // Wait until all these Observables complete forkJoin(groupRequests).subscribe({ - next: results => { + next: _results => { // Here, 'results' is an array of the user arrays from each group. // By this point, this.users[...] is updated for ALL groups. // Update any shared state diff --git a/frontend/src/app/consts/filter-types.ts b/frontend/src/app/consts/filter-types.ts index 5ce8a01a..88c4856e 100644 --- a/frontend/src/app/consts/filter-types.ts +++ b/frontend/src/app/consts/filter-types.ts @@ -1,4 +1,4 @@ -import { BinaryDataCaptionFilterComponent } from '../components/ui-components/filter-fields/binary-data-caption/binary-data-caption.component'; + import { BooleanFilterComponent } from 'src/app/components/ui-components/filter-fields/boolean/boolean.component' import { CountryFilterComponent } from '../components/ui-components/filter-fields/country/country.component'; import { DateFilterComponent } from '../components/ui-components/filter-fields/date/date.component'; diff --git a/frontend/src/app/consts/record-edit-types.ts b/frontend/src/app/consts/record-edit-types.ts index f16cb448..18505d96 100644 --- a/frontend/src/app/consts/record-edit-types.ts +++ b/frontend/src/app/consts/record-edit-types.ts @@ -1,4 +1,4 @@ -import { BinaryDataCaptionEditComponent } from '../components/ui-components/record-edit-fields/binary-data-caption/binary-data-caption.component'; + import { BooleanEditComponent } from 'src/app/components/ui-components/record-edit-fields/boolean/boolean.component' import { CodeEditComponent } from '../components/ui-components/record-edit-fields/code/code.component'; import { ColorEditComponent } from '../components/ui-components/record-edit-fields/color/color.component'; diff --git a/frontend/src/app/directives/ngmat-table-query-reflector.directive.ts b/frontend/src/app/directives/ngmat-table-query-reflector.directive.ts index b713adea..e4b585e7 100644 --- a/frontend/src/app/directives/ngmat-table-query-reflector.directive.ts +++ b/frontend/src/app/directives/ngmat-table-query-reflector.directive.ts @@ -76,10 +76,6 @@ export class NgMatTableQueryReflectorDirective implements OnInit, OnDestroy { // Picked a hack from: https://github.com/angular/components/issues/10242#issuecomment-421490991 const activeSortHeader = this.dataSource.sort.sortables.get(sortActiveColumn); if (!activeSortHeader) { return; } - activeSortHeader['_setAnimationTransitionState']({ - fromState: this.dataSource.sort.direction, - toState: 'active', - }); } } @@ -88,7 +84,7 @@ export class NgMatTableQueryReflectorDirective implements OnInit, OnDestroy { const queryParams = this._activatedRoute.snapshot.queryParams; - if (queryParams.hasOwnProperty('sort_active') || queryParams.hasOwnProperty('sort_direction')) { + if (Object.hasOwn(queryParams, 'sort_active') || Object.hasOwn(queryParams, 'sort_direction')) { return { sort_active: queryParams.sort_active, sort_direction: queryParams.sort_direction @@ -102,7 +98,7 @@ export class NgMatTableQueryReflectorDirective implements OnInit, OnDestroy { const queryParams = this._activatedRoute.snapshot.queryParams; - if (queryParams.hasOwnProperty('page_size') || queryParams.hasOwnProperty('page_index')) { + if (Object.hasOwn(queryParams, 'page_size') || Object.hasOwn(queryParams, 'page_index')) { return { page_size: queryParams.page_size, page_index: queryParams.page_index @@ -155,7 +151,7 @@ export class NgMatTableQueryReflectorDirective implements OnInit, OnDestroy { const titleCheckingInterval$ = interval(500); return new Promise((resolve) => { - this._dataSourceChecker$ = titleCheckingInterval$.subscribe(val => { + this._dataSourceChecker$ = titleCheckingInterval$.subscribe(_val => { if (this.dataSource?.sort && this.dataSource?.paginator) { this._dataSourceChecker$.unsubscribe(); return resolve(); @@ -170,4 +166,4 @@ export class NgMatTableQueryReflectorDirective implements OnInit, OnDestroy { this.unsubscribeAll$.complete(); } -} \ No newline at end of file +} diff --git a/frontend/src/app/directives/text-validator.directive.ts b/frontend/src/app/directives/text-validator.directive.ts index 1d46fc64..5ec067e4 100644 --- a/frontend/src/app/directives/text-validator.directive.ts +++ b/frontend/src/app/directives/text-validator.directive.ts @@ -1,4 +1,4 @@ -import * as validator from 'validator'; + import { AbstractControl, NG_VALIDATORS, ValidationErrors, Validator } from '@angular/forms'; import { Directive, Input } from '@angular/core'; diff --git a/frontend/src/app/services/auth.service.spec.ts b/frontend/src/app/services/auth.service.spec.ts index 172d0223..d6ef27ef 100644 --- a/frontend/src/app/services/auth.service.spec.ts +++ b/frontend/src/app/services/auth.service.spec.ts @@ -61,7 +61,7 @@ describe('AuthService', () => { expires: "2022-04-11T15:56:51.599Z" } - // @ts-ignore + // @ts-expect-error global.window.fbq = jasmine.createSpy(); service.signUpUser(userData).subscribe((res) => { diff --git a/frontend/src/app/services/auth.service.ts b/frontend/src/app/services/auth.service.ts index 5b96b293..61c0c3c9 100644 --- a/frontend/src/app/services/auth.service.ts +++ b/frontend/src/app/services/auth.service.ts @@ -30,7 +30,7 @@ export class AuthService { .pipe( map(res => { if ((environment as any).saas) { - // @ts-ignore + // @ts-expect-error window.fbq?.('trackCustom', 'Signup'); } this._notifications.showSuccessSnackbar(`Confirmation email has been sent to you.`); @@ -67,7 +67,7 @@ export class AuthService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -142,7 +142,7 @@ export class AuthService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -251,7 +251,7 @@ export class AuthService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; diff --git a/frontend/src/app/services/company.service.ts b/frontend/src/app/services/company.service.ts index 8fe516d9..b4124955 100644 --- a/frontend/src/app/services/company.service.ts +++ b/frontend/src/app/services/company.service.ts @@ -58,7 +58,7 @@ export class CompanyService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -76,7 +76,7 @@ export class CompanyService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -99,7 +99,7 @@ export class CompanyService { updateCompanyName(companyId: string, name: string) { return this._http.put(`/company/name/${companyId}`, {name}) .pipe( - map(res => this._notifications.showSuccessSnackbar('Company name has been updated.')), + map(_res => this._notifications.showSuccessSnackbar('Company name has been updated.')), catchError((err) => { console.log(err); this._notifications.showErrorSnackbar(err.error.message || err.message); @@ -156,7 +156,7 @@ export class CompanyService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -178,7 +178,7 @@ export class CompanyService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -200,7 +200,7 @@ export class CompanyService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -222,7 +222,7 @@ export class CompanyService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -248,7 +248,7 @@ export class CompanyService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -291,7 +291,7 @@ export class CompanyService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ] ); @@ -449,13 +449,13 @@ export class CompanyService { return this._http.get(`/company/white-label-properties/${companyId}`) .pipe( map(res => { - if (res.logo && res.logo.image && res.logo.mimeType) { + if (res.logo?.image && res.logo.mimeType) { this.companyLogo = `data:${res.logo.mimeType};base64,${res.logo.image}`; } else { this.companyLogo = null; } - if (res.favicon && res.favicon.image && res.favicon.mimeType) { + if (res.favicon?.image && res.favicon.mimeType) { this.companyFavicon = `data:${res.favicon.mimeType};base64,${res.favicon.image}`; } else { this.companyFavicon = null; diff --git a/frontend/src/app/services/configuration.service.ts b/frontend/src/app/services/configuration.service.ts index 5b914583..0817366d 100644 --- a/frontend/src/app/services/configuration.service.ts +++ b/frontend/src/app/services/configuration.service.ts @@ -1,4 +1,4 @@ -import { Injectable, Inject } from '@angular/core'; +import { Injectable, } from '@angular/core'; import config from "../../config.json"; @Injectable({ diff --git a/frontend/src/app/services/connections.service.spec.ts b/frontend/src/app/services/connections.service.spec.ts index e0f468c3..92afb78e 100644 --- a/frontend/src/app/services/connections.service.spec.ts +++ b/frontend/src/app/services/connections.service.spec.ts @@ -442,7 +442,7 @@ describe('ConnectionsService', () => { }); xit('should call updateConnection and show Success Snackbar', async () => { - service.updateConnection(connectionCredsApp, 'master_key_12345678').subscribe(res => { + service.updateConnection(connectionCredsApp, 'master_key_12345678').subscribe(_res => { expect(fakeNotifications.showSuccessSnackbar).toHaveBeenCalledWith('Connection has been updated successfully.'); }); @@ -476,7 +476,7 @@ describe('ConnectionsService', () => { message: 'i want to add tables' } - service.deleteConnection('12345678', metadata).subscribe(res => { + service.deleteConnection('12345678', metadata).subscribe(_res => { expect(fakeNotifications.showSuccessSnackbar).toHaveBeenCalledOnceWith('Connection has been deleted successfully.'); isSubscribeCalled = true; }); @@ -513,7 +513,7 @@ describe('ConnectionsService', () => { userEmail: 'eric.cartman@south.park', requstedPage: 2, chunkSize: 10 - }).subscribe(res => { + }).subscribe(_res => { isSubscribeCalled = true; }); @@ -533,7 +533,7 @@ describe('ConnectionsService', () => { userEmail: 'eric.cartman@south.park', requstedPage: 2, chunkSize: 10 - }).subscribe(res => { + }).subscribe(_res => { isSubscribeCalled = true; }); @@ -552,7 +552,7 @@ describe('ConnectionsService', () => { userEmail: 'showAll', requstedPage: 2, chunkSize: 10 - }).subscribe(res => { + }).subscribe(_res => { isSubscribeCalled = true; }); @@ -595,7 +595,7 @@ describe('ConnectionsService', () => { } const mockThemeService = jasmine.createSpyObj('_themeService', ['updateColors']); - service['_themeService'] = mockThemeService; + service._themeService = mockThemeService; service.getConnectionSettings('12345678').subscribe(res => { expect(res).toEqual(connectionSettingsNetwork); @@ -624,7 +624,7 @@ describe('ConnectionsService', () => { it('should call createConnectionSettings and show success snackbar', () => { let isSubscribeCalled = false; - service.createConnectionSettings('12345678', {hidden_tables: ['users', 'orders'], default_showing_table: ''}).subscribe(res => { + service.createConnectionSettings('12345678', {hidden_tables: ['users', 'orders'], default_showing_table: ''}).subscribe(_res => { expect(fakeNotifications.showSuccessSnackbar).toHaveBeenCalledOnceWith('Connection settings has been created successfully.'); isSubscribeCalled = true; }); @@ -671,7 +671,7 @@ describe('ConnectionsService', () => { it('should call updateConnectionSettings and show success snackbar', () => { let isSubscribeCalled = false; - service.updateConnectionSettings('12345678', {hidden_tables: ['users', 'orders', 'products'], default_showing_table: 'users'}).subscribe(res => { + service.updateConnectionSettings('12345678', {hidden_tables: ['users', 'orders', 'products'], default_showing_table: 'users'}).subscribe(_res => { expect(fakeNotifications.showSuccessSnackbar).toHaveBeenCalledOnceWith('Connection settings has been updated successfully.'); isSubscribeCalled = true; }); @@ -721,7 +721,7 @@ describe('ConnectionsService', () => { it('should call deleteConnectionSettings and show success snackbar', () => { let isSubscribeCalled = false; - service.deleteConnectionSettings('12345678').subscribe(res => { + service.deleteConnectionSettings('12345678').subscribe(_res => { expect(fakeNotifications.showSuccessSnackbar).toHaveBeenCalledOnceWith('Connection settings has been removed successfully.'); isSubscribeCalled = true; }); diff --git a/frontend/src/app/services/connections.service.ts b/frontend/src/app/services/connections.service.ts index a237afa0..5d949638 100644 --- a/frontend/src/app/services/connections.service.ts +++ b/frontend/src/app/services/connections.service.ts @@ -1,8 +1,8 @@ import { AlertActionType, AlertType } from '../models/alert'; -import { BehaviorSubject, EMPTY, of, throwError } from 'rxjs'; +import { BehaviorSubject, EMPTY, throwError } from 'rxjs'; import { Connection, ConnectionSettings, ConnectionType, DBtype } from '../models/connection'; import { IColorConfig, NgxThemeService } from '@brumeilde/ngx-theme'; -import { NavigationEnd, ResolveEnd, Router, RouterEvent } from '@angular/router'; +import { NavigationEnd, Router, } from '@angular/router'; import { catchError, filter, map } from 'rxjs/operators'; import { AccessLevel } from '../models/user'; @@ -70,7 +70,7 @@ export class ConnectionsService { private router: Router, private _notifications: NotificationsService, private _masterPassword: MasterPasswordService, - private _themeService: NgxThemeService> + public _themeService: NgxThemeService> ) { this.connection = {...this.connectionInitialState}; this.router = router; @@ -83,7 +83,7 @@ export class ConnectionsService { ) ) .subscribe( - ( event: NavigationEnd ) : void => { + ( _event: NavigationEnd ) : void => { const urlConnectionID = this.router.routerState.snapshot.root.firstChild.paramMap.get('connection-id'); this.currentPage = this.router.routerState.snapshot.root.firstChild.url[0].path; this.setConnectionID(urlConnectionID); @@ -182,7 +182,7 @@ export class ConnectionsService { } defineConnectionType(connection) { - if (connection.type && connection.type.startsWith('agent_')) { + if (connection.type?.startsWith('agent_')) { connection.type = connection.type.slice(6); connection.connectionType = ConnectionType.Agent; } else { @@ -255,7 +255,7 @@ export class ConnectionsService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -385,7 +385,7 @@ export class ConnectionsService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); // this._notifications.showErrorSnackbar(`${err.error.message}. Connection has not been updated.`); diff --git a/frontend/src/app/services/master-password.service.ts b/frontend/src/app/services/master-password.service.ts index 9b408fea..12a44753 100644 --- a/frontend/src/app/services/master-password.service.ts +++ b/frontend/src/app/services/master-password.service.ts @@ -1,4 +1,4 @@ -import { MatDialog, MatDialogRef } from '@angular/material/dialog'; +import { MatDialog, } from '@angular/material/dialog'; import { Injectable } from '@angular/core'; import { MasterPasswordDialogComponent } from '../components/master-password-dialog/master-password-dialog.component'; diff --git a/frontend/src/app/services/payment.service.ts b/frontend/src/app/services/payment.service.ts index cba94585..0298fd76 100644 --- a/frontend/src/app/services/payment.service.ts +++ b/frontend/src/app/services/payment.service.ts @@ -1,7 +1,7 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { catchError, map } from 'rxjs/operators'; -import { BehaviorSubject, EMPTY } from 'rxjs'; +import { EMPTY } from 'rxjs'; import { PaymentMethod } from '@stripe/stripe-js'; import { NotificationsService } from './notifications.service'; import { AlertActionType, AlertType } from '../models/alert'; @@ -30,7 +30,7 @@ export class PaymentService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -50,7 +50,7 @@ export class PaymentService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -70,7 +70,7 @@ export class PaymentService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; diff --git a/frontend/src/app/services/table-row.service.spec.ts b/frontend/src/app/services/table-row.service.spec.ts index e85ad073..2d35ed19 100644 --- a/frontend/src/app/services/table-row.service.spec.ts +++ b/frontend/src/app/services/table-row.service.spec.ts @@ -135,7 +135,7 @@ describe('TableRowService', () => { it('should call updateTableRow and show Success snackbar', () => { let isSubscribeCalled = false; - service.updateTableRow('12345678', 'users_table', {id: 1}, tableRowValues).subscribe(res => { + service.updateTableRow('12345678', 'users_table', {id: 1}, tableRowValues).subscribe(_res => { expect(fakeNotifications.showSuccessSnackbar).toHaveBeenCalledOnceWith('The row has been updated successfully in "users_table" table.'); isSubscribeCalled = true; }); @@ -165,7 +165,7 @@ describe('TableRowService', () => { it('should call deleteTableRow and show Success snackbar', () => { let isSubscribeCalled = false; - service.deleteTableRow('12345678', 'users_table', {id: 1}).subscribe(res => { + service.deleteTableRow('12345678', 'users_table', {id: 1}).subscribe(_res => { expect(fakeNotifications.showSuccessSnackbar).toHaveBeenCalledOnceWith('Row has been deleted successfully from "users_table" table.'); isSubscribeCalled = true; }); diff --git a/frontend/src/app/services/table-row.service.ts b/frontend/src/app/services/table-row.service.ts index 1a5ff011..da523fff 100644 --- a/frontend/src/app/services/table-row.service.ts +++ b/frontend/src/app/services/table-row.service.ts @@ -1,5 +1,5 @@ import { AlertActionType, AlertType } from '../models/alert'; -import { BehaviorSubject, EMPTY, Observable, ReplaySubject, Subject } from 'rxjs'; +import { EMPTY, Subject } from 'rxjs'; import { catchError, map } from 'rxjs/operators'; import { HttpClient } from '@angular/common/http'; @@ -55,7 +55,7 @@ export class TableRowService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -81,7 +81,7 @@ export class TableRowService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; diff --git a/frontend/src/app/services/tables.service.spec.ts b/frontend/src/app/services/tables.service.spec.ts index 4f9caf57..30b7dceb 100644 --- a/frontend/src/app/services/tables.service.spec.ts +++ b/frontend/src/app/services/tables.service.spec.ts @@ -467,7 +467,7 @@ describe('TablesService', () => { it('should call updateTableSettings for existing settings', () => { let isSubscribeCalled = false; - service.updateTableSettings(true, '12345678', 'users_table', tableSettingsApp).subscribe(res => { + service.updateTableSettings(true, '12345678', 'users_table', tableSettingsApp).subscribe(_res => { // expect(res).toEqual(tableSettingsNetwork); isSubscribeCalled = true; }); @@ -483,7 +483,7 @@ describe('TablesService', () => { it('should call updateTableSettings and create settings', () => { let isSubscribeCalled = false; - service.updateTableSettings(false, '12345678', 'users_table', tableSettingsApp).subscribe(res => { + service.updateTableSettings(false, '12345678', 'users_table', tableSettingsApp).subscribe(_res => { // expect(res).toEqual(tableSettingsNetwork); isSubscribeCalled = true; }); @@ -513,7 +513,7 @@ describe('TablesService', () => { it('should call deleteTableSettings', () => { let isSubscribeCalled = false; - service.deleteTableSettings('12345678', 'users_table').subscribe(res => { + service.deleteTableSettings('12345678', 'users_table').subscribe(_res => { isSubscribeCalled = true; }); @@ -541,7 +541,7 @@ describe('TablesService', () => { it('should call fetchTableWidgets', () => { let isSubscribeCalled = false; - service.fetchTableWidgets('12345678', 'users_table').subscribe(res => { + service.fetchTableWidgets('12345678', 'users_table').subscribe(_res => { isSubscribeCalled = true; }); diff --git a/frontend/src/app/services/tables.service.ts b/frontend/src/app/services/tables.service.ts index 98e96b56..54c8666a 100644 --- a/frontend/src/app/services/tables.service.ts +++ b/frontend/src/app/services/tables.service.ts @@ -1,7 +1,7 @@ import { AlertActionType, AlertType } from '../models/alert'; import { BehaviorSubject, EMPTY, throwError } from 'rxjs'; -import { CustomAction, Rule, TableSettings, Widget } from '../models/table'; -import { HttpClient, HttpHeaders } from '@angular/common/http'; +import { Rule, TableSettings, Widget } from '../models/table'; +import { HttpClient, } from '@angular/common/http'; import { NavigationEnd, Router } from '@angular/router'; import { catchError, filter, map } from 'rxjs/operators'; @@ -57,7 +57,7 @@ export class TablesService { ) ) .subscribe( - ( event: NavigationEnd ) : void => { + ( _event: NavigationEnd ) : void => { this.setTableName(this.router.routerState.snapshot.root.firstChild.paramMap.get('table-name')); } ) @@ -122,7 +122,7 @@ export class TablesService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -162,7 +162,7 @@ export class TablesService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -253,7 +253,7 @@ export class TablesService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -279,7 +279,7 @@ export class TablesService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -301,7 +301,7 @@ export class TablesService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -327,7 +327,7 @@ export class TablesService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -354,7 +354,7 @@ export class TablesService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -376,7 +376,7 @@ export class TablesService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -384,7 +384,7 @@ export class TablesService { ); } - saveRule(connectionID: string, tableName: string, rule: Rule) { + saveRule(connectionID: string, _tableName: string, rule: Rule) { return this._http.post(`/action/rule/${connectionID}`, rule) .pipe( map(res => { @@ -397,7 +397,7 @@ export class TablesService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -405,7 +405,7 @@ export class TablesService { ); } - updateRule(connectionID: string, tableName: string, rule: Rule) { + updateRule(connectionID: string, _tableName: string, rule: Rule) { return this._http.put(`/action/rule/${rule.id}/${connectionID}`, rule) .pipe( map(res => { @@ -418,7 +418,7 @@ export class TablesService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -426,7 +426,7 @@ export class TablesService { ); } - deleteRule(connectionID: string, tableName: string, ruleId: string) { + deleteRule(connectionID: string, _tableName: string, ruleId: string) { return this._http.delete(`/action/rule/${ruleId}/${connectionID}`) .pipe( map(res => { @@ -440,7 +440,7 @@ export class TablesService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -448,7 +448,7 @@ export class TablesService { ); } - activateActions(connectionID: string, tableName: string, actionId: string, actionTitle: string, primaryKeys: object[], confirmed?: boolean) { + activateActions(connectionID: string, _tableName: string, actionId: string, actionTitle: string, primaryKeys: object[], _confirmed?: boolean) { return this._http.post(`/event/actions/activate/${actionId}/${connectionID}`, primaryKeys) .pipe( map((res) => { @@ -462,7 +462,7 @@ export class TablesService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; diff --git a/frontend/src/app/services/ui-settings.service.ts b/frontend/src/app/services/ui-settings.service.ts index 105ee4b5..ddd578e1 100644 --- a/frontend/src/app/services/ui-settings.service.ts +++ b/frontend/src/app/services/ui-settings.service.ts @@ -1,4 +1,4 @@ -import { BehaviorSubject, EMPTY, Observable } from 'rxjs'; +import { EMPTY, Observable } from 'rxjs'; import { ConnectionSettingsUI, GlobalSettingsUI, UiSettings } from '../models/ui-settings'; import { catchError, map } from 'rxjs/operators'; diff --git a/frontend/src/app/services/user.service.spec.ts b/frontend/src/app/services/user.service.spec.ts index 75fb0be8..dbad955c 100644 --- a/frontend/src/app/services/user.service.spec.ts +++ b/frontend/src/app/services/user.service.spec.ts @@ -15,7 +15,7 @@ describe('UserService', () => { let fakeNotifications; let routerSpy; - const authUser = { + const _authUser = { email: 'eric.cartman@south.park', password: '12345678' } @@ -404,7 +404,7 @@ describe('UserService', () => { } const requestResponse = true; - service.deleteAccount(metadata).subscribe((res) => { + service.deleteAccount(metadata).subscribe((_res) => { // expect(fakeNotifications.showSuccessSnackbar).toHaveBeenCalledOnceWith('You account has been deleted.'); isDeleteuserCalled = true; }); diff --git a/frontend/src/app/services/user.service.ts b/frontend/src/app/services/user.service.ts index a013b290..540914cd 100644 --- a/frontend/src/app/services/user.service.ts +++ b/frontend/src/app/services/user.service.ts @@ -86,7 +86,7 @@ export class UserService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return res @@ -97,7 +97,7 @@ export class UserService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -118,7 +118,7 @@ export class UserService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -134,7 +134,7 @@ export class UserService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return res @@ -145,7 +145,7 @@ export class UserService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -166,7 +166,7 @@ export class UserService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -187,7 +187,7 @@ export class UserService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -266,7 +266,7 @@ export class UserService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -319,7 +319,7 @@ export class UserService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; @@ -344,7 +344,7 @@ export class UserService { { type: AlertActionType.Button, caption: 'Dismiss', - action: (id: number) => this._notifications.dismissAlert() + action: (_id: number) => this._notifications.dismissAlert() } ]); return EMPTY; diff --git a/frontend/src/app/services/users.service.spec.ts b/frontend/src/app/services/users.service.spec.ts index b91f6f92..38bba3a8 100644 --- a/frontend/src/app/services/users.service.spec.ts +++ b/frontend/src/app/services/users.service.spec.ts @@ -233,7 +233,7 @@ describe('UsersService', () => { it('should call createUsersGroup', () => { let isSubscribeCalled = false; - service.createUsersGroup('12345678', 'Managers').subscribe(res => { + service.createUsersGroup('12345678', 'Managers').subscribe(_res => { expect(fakeNotifications.showSuccessSnackbar).toHaveBeenCalledOnceWith('Group of users has been created.'); isSubscribeCalled = true; }); @@ -286,7 +286,7 @@ describe('UsersService', () => { it('should call updatePermission and show Success snackbar', () => { let isSubscribeCalled = false; - service.updatePermission('12345678', permissionsApp).subscribe(res => { + service.updatePermission('12345678', permissionsApp).subscribe(_res => { expect(fakeNotifications.showSuccessSnackbar).toHaveBeenCalledOnceWith('Permissions have been updated successfully.'); isSubscribeCalled = true; }); @@ -313,7 +313,7 @@ describe('UsersService', () => { it('should call addGroupUser and show Success snackbar', () => { let isSubscribeCalled = false; - service.addGroupUser('group12345678', 'eric.cartman@south.park').subscribe(res => { + service.addGroupUser('group12345678', 'eric.cartman@south.park').subscribe(_res => { // expect(fakeNotifications.showSuccessSnackbar).toHaveBeenCalledOnceWith('User has been added to group.'); isSubscribeCalled = true; }); @@ -348,7 +348,7 @@ describe('UsersService', () => { "affected": 1 } - service.deleteUsersGroup('group12345678').subscribe(res => { + service.deleteUsersGroup('group12345678').subscribe(_res => { expect(fakeNotifications.showSuccessSnackbar).toHaveBeenCalledOnceWith('Group has been removed.'); isSubscribeCalled = true; }); @@ -379,7 +379,7 @@ describe('UsersService', () => { "affected": 1 } - service.deleteGroupUser('eric.cartman@south.park', 'group12345678').subscribe(res => { + service.deleteGroupUser('eric.cartman@south.park', 'group12345678').subscribe(_res => { expect(fakeNotifications.showSuccessSnackbar).toHaveBeenCalledOnceWith('User has been removed from group.'); isSubscribeCalled = true; }); diff --git a/frontend/src/app/services/users.service.ts b/frontend/src/app/services/users.service.ts index ed4dc090..522b505a 100644 --- a/frontend/src/app/services/users.service.ts +++ b/frontend/src/app/services/users.service.ts @@ -1,5 +1,5 @@ import { Subject, EMPTY } from 'rxjs'; -import { catchError, filter, map } from 'rxjs/operators'; +import { catchError, map } from 'rxjs/operators'; import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; diff --git a/frontend/src/app/validators/hex.validator.ts b/frontend/src/app/validators/hex.validator.ts index b395e998..2515e61d 100644 --- a/frontend/src/app/validators/hex.validator.ts +++ b/frontend/src/app/validators/hex.validator.ts @@ -4,7 +4,7 @@ export function hexValidation():ValidatorFn { return (control: AbstractControl) : ValidationErrors | null=> { if (control.value) { const hexRegex = /^[-+]?[0-9A-Fa-f]+\.?[0-9A-Fa-f]*?$/; - if (!hexRegex.test(control.value) || !(control.value.length % 2 == 0)) return { 'isInvalidHex': true }; + if (!hexRegex.test(control.value) || !(control.value.length % 2 === 0)) return { 'isInvalidHex': true }; // don't make return if valid! or return null } } diff --git a/frontend/src/app/validators/url.validator.ts b/frontend/src/app/validators/url.validator.ts index a647ac50..9fd00eab 100644 --- a/frontend/src/app/validators/url.validator.ts +++ b/frontend/src/app/validators/url.validator.ts @@ -12,7 +12,7 @@ export function urlValidation(prefix: string = ''):ValidatorFn { try { new URL(fullUrl); } - catch (e) { + catch (_e) { return { 'isInvalidURL': true }; } } diff --git a/frontend/src/index.saas.html b/frontend/src/index.saas.html index e1b56691..58a8d8b8 100644 --- a/frontend/src/index.saas.html +++ b/frontend/src/index.saas.html @@ -47,10 +47,10 @@ - @@ -58,9 +58,9 @@ diff --git a/frontend/src/main.ts b/frontend/src/main.ts index dcc71a5b..f11a21dc 100644 --- a/frontend/src/main.ts +++ b/frontend/src/main.ts @@ -25,7 +25,6 @@ import { TablesService } from "./app/services/tables.service"; import { TokenInterceptor } from "./app/services/token.interceptor"; import { UsersService } from "./app/services/users.service"; import { environment } from './environments/environment'; -import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { provideAnimations } from "@angular/platform-browser/animations"; const saasExtraProviders = (environment as any).saas ? [ diff --git a/rocketadmin-agent/src/helpers/app-logs/logger.ts b/rocketadmin-agent/src/helpers/app-logs/logger.ts index 969ba096..ddf2bcb5 100644 --- a/rocketadmin-agent/src/helpers/app-logs/logger.ts +++ b/rocketadmin-agent/src/helpers/app-logs/logger.ts @@ -29,7 +29,7 @@ export class Logger { newRecord.operationType = operationType ? operationType : undefined; newRecord.operationStatusResult = operationStatusResult ? operationStatusResult : undefined; newRecord.old_data = oldData ? oldData : undefined; - this.printLogRecord(newRecord); + Logger.printLogRecord(newRecord); } private static printLogRecord(createLogRecordDto: CreateLogRecordDto): void { @@ -44,8 +44,8 @@ export class Logger { old_data: createLogRecordDto.old_data, }; - this.logger.info(log); - this.writeLogToFile(log); + Logger.logger.info(log); + Logger.writeLogToFile(log); } private static writeLogToFile(log): void { diff --git a/rocketadmin-agent/src/helpers/check-field-autoincrement.ts b/rocketadmin-agent/src/helpers/check-field-autoincrement.ts index 8212d21b..a01402bc 100644 --- a/rocketadmin-agent/src/helpers/check-field-autoincrement.ts +++ b/rocketadmin-agent/src/helpers/check-field-autoincrement.ts @@ -1,13 +1,10 @@ export function checkFieldAutoincrement(defaultValue: string): boolean { let result = false; if ( - (defaultValue != null && defaultValue?.toLowerCase().includes('nextval')) || - (defaultValue != null && - defaultValue?.toLowerCase().includes('generate')) || - (defaultValue != null && - defaultValue?.toLowerCase().includes('autoincrement')) || - (defaultValue != null && - defaultValue?.toLowerCase().includes('auto_increment')) + (defaultValue?.toLowerCase().includes('nextval')) || + (defaultValue?.toLowerCase().includes('generate')) || + (defaultValue?.toLowerCase().includes('autoincrement')) || + (defaultValue?.toLowerCase().includes('auto_increment')) ) { result = true; } diff --git a/rocketadmin-agent/src/helpers/cli/interactive-prompts.ts b/rocketadmin-agent/src/helpers/cli/interactive-prompts.ts index e6c6433b..22822e44 100644 --- a/rocketadmin-agent/src/helpers/cli/interactive-prompts.ts +++ b/rocketadmin-agent/src/helpers/cli/interactive-prompts.ts @@ -99,7 +99,7 @@ export class InteractivePrompts { message: chalk.cyan('Enter database port:'), default: defaultPort, validate: (input: number) => { - if (isNaN(input) || input < 1 || input > 65535) { + if (Number.isNaN(input) || input < 1 || input > 65535) { return chalk.red('Port must be a number between 1 and 65535'); } return true; @@ -325,7 +325,7 @@ export class InteractivePrompts { } static async runInteractiveSetup(): Promise { - this.displayWelcome(); + InteractivePrompts.displayWelcome(); const credentials: ICLIConnectionCredentials = { app_port: 3000, @@ -349,35 +349,35 @@ export class InteractivePrompts { authSource: null, }; - credentials.token = await this.askConnectionToken(); - credentials.type = await this.askConnectionType(); - credentials.host = await this.askConnectionHost(); - credentials.port = await this.askConnectionPort(credentials.type as ConnectionTypesEnum); + credentials.token = await InteractivePrompts.askConnectionToken(); + credentials.type = await InteractivePrompts.askConnectionType(); + credentials.host = await InteractivePrompts.askConnectionHost(); + credentials.port = await InteractivePrompts.askConnectionPort(credentials.type as ConnectionTypesEnum); if (credentials.type !== ConnectionTypesEnum.redis) { - credentials.username = await this.askConnectionUserName(); + credentials.username = await InteractivePrompts.askConnectionUserName(); } - credentials.password = await this.askConnectionPassword(); + credentials.password = await InteractivePrompts.askConnectionPassword(); if (credentials.type !== ConnectionTypesEnum.redis) { - credentials.database = await this.askConnectionDatabase(); - credentials.schema = await this.askConnectionSchema(); + credentials.database = await InteractivePrompts.askConnectionDatabase(); + credentials.schema = await InteractivePrompts.askConnectionSchema(); } if (credentials.type === ConnectionTypesEnum.oracledb) { - credentials.sid = await this.askConnectionSid(); + credentials.sid = await InteractivePrompts.askConnectionSid(); } if (credentials.type === ConnectionTypesEnum.mssql) { - credentials.azure_encryption = await this.askConnectionAzureEncryption(); + credentials.azure_encryption = await InteractivePrompts.askConnectionAzureEncryption(); } if (credentials.type === ConnectionTypesEnum.cassandra) { - credentials.dataCenter = await this.askConnectionDataCenter(); + credentials.dataCenter = await InteractivePrompts.askConnectionDataCenter(); } if (credentials.type === ConnectionTypesEnum.mongodb) { - credentials.authSource = await this.askConnectionAuthSource(); + credentials.authSource = await InteractivePrompts.askConnectionAuthSource(); } - credentials.ssl = await this.askConnectionSslOption(); + credentials.ssl = await InteractivePrompts.askConnectionSslOption(); console.log(''); console.log(chalk.cyan('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')); @@ -385,16 +385,16 @@ export class InteractivePrompts { console.log(chalk.cyan('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')); console.log(''); - credentials.application_save_option = await this.askApplicationSaveConfig(); + credentials.application_save_option = await InteractivePrompts.askApplicationSaveConfig(); if (credentials.application_save_option) { - credentials.config_encryption_option = await this.askApplicationEncryptConfigOption(); + credentials.config_encryption_option = await InteractivePrompts.askApplicationEncryptConfigOption(); if (credentials.config_encryption_option) { - credentials.encryption_password = await this.askApplicationEncryptionPassword(); + credentials.encryption_password = await InteractivePrompts.askApplicationEncryptionPassword(); } } - credentials.saving_logs_option = await this.askApplicationSaveLogsOption(); + credentials.saving_logs_option = await InteractivePrompts.askApplicationSaveLogsOption(); console.log(''); console.log(chalk.green('✓ Configuration complete!')); diff --git a/rocketadmin-agent/src/helpers/is-object-empty.ts b/rocketadmin-agent/src/helpers/is-object-empty.ts index 65a38119..654fbecc 100644 --- a/rocketadmin-agent/src/helpers/is-object-empty.ts +++ b/rocketadmin-agent/src/helpers/is-object-empty.ts @@ -1,5 +1,5 @@ export function isObjectEmpty(obj: any): boolean { - for (const key in obj) { + for (const _key in obj) { return false; } return true; diff --git a/rocketadmin-agent/src/helpers/read-file-util.ts b/rocketadmin-agent/src/helpers/read-file-util.ts index d11c3804..b83d6515 100644 --- a/rocketadmin-agent/src/helpers/read-file-util.ts +++ b/rocketadmin-agent/src/helpers/read-file-util.ts @@ -4,7 +4,7 @@ import path from 'path'; export async function readFileUtil(fileName): Promise { return new Promise((resolve, reject) => { - fs.readFile(path.join(process.cwd(), fileName), 'utf8', function (err, data) { + fs.readFile(path.join(process.cwd(), fileName), 'utf8', (err, data) => { if (err) { reject(err); } diff --git a/rocketadmin-agent/src/helpers/rename-object-key-name.ts b/rocketadmin-agent/src/helpers/rename-object-key-name.ts index fb295a03..2fcf8618 100644 --- a/rocketadmin-agent/src/helpers/rename-object-key-name.ts +++ b/rocketadmin-agent/src/helpers/rename-object-key-name.ts @@ -3,7 +3,7 @@ export function renameObjectKeyName( oldKey: string, newKey: string, ): void { - if (oldKey !== newKey && obj.hasOwnProperty(oldKey)) { + if (oldKey !== newKey && Object.hasOwn(obj, oldKey)) { Object.defineProperty( obj, newKey, diff --git a/rocketadmin-agent/src/shared/config/config.ts b/rocketadmin-agent/src/shared/config/config.ts index 1a83fb00..7ee09745 100644 --- a/rocketadmin-agent/src/shared/config/config.ts +++ b/rocketadmin-agent/src/shared/config/config.ts @@ -52,7 +52,7 @@ export class Config { if (config.ssl && rewrite) { try { - connectionConfig.cert = await this.readSslSertificate(); + connectionConfig.cert = await Config.readSslSertificate(); console.log('-> SSL certificate loaded from file'); } catch (e) { console.log('-> Failed to load SSL certificate' + e); @@ -182,7 +182,7 @@ export class Config { ssl: process.env.CONNECTION_SSL === '1', cert: process.env.CONNECTION_SSL_SERTIFICATE, token: process.env.CONNECTION_TOKEN, - app_port: parseInt(process.env.APP_PORT) || 3000, + app_port: parseInt(process.env.APP_PORT, 10) || 3000, azure_encryption: process.env.CONNECTION_AZURE_ENCRYPTION === '1', application_save_option: false, config_encryption_option: false, diff --git a/rocketadmin-agent/wait-for-db2.js b/rocketadmin-agent/wait-for-db2.js index eaeeca94..8be6377d 100644 --- a/rocketadmin-agent/wait-for-db2.js +++ b/rocketadmin-agent/wait-for-db2.js @@ -20,7 +20,7 @@ async function testConnectionToDB2() { const query = `SELECT 1 FROM sysibm.sysdummy1`; const testResult = await databaseConnection.query(query); await databaseConnection.close(); - if (testResult && testResult[0] && testResult[0]['1'] === 1) { + if (testResult?.[0] && testResult[0]['1'] === 1) { return true; } } catch (error) { @@ -30,7 +30,7 @@ async function testConnectionToDB2() { } function checkDB2() { - waitOn(opts, async function (err) { + waitOn(opts, async (err) => { if (err) { console.error('Error waiting for DB2:', err); setTimeout(checkDB2, 5000); diff --git a/shared-code/src/caching/lru-storage.ts b/shared-code/src/caching/lru-storage.ts index 9a2c3ab8..eb4fa870 100644 --- a/shared-code/src/caching/lru-storage.ts +++ b/shared-code/src/caching/lru-storage.ts @@ -22,29 +22,29 @@ const tablePrimaryKeysCache = new LRUCache(CACHING_CONSTANTS.DEFAULT_TABLE_STRUC const redisClientCache = new LRUCache(CACHING_CONSTANTS.DEFAULT_REDIS_CLIENT_CACHE_OPTIONS); export class LRUStorage { public static getRedisClientCache(connection: ConnectionParams): any | null { - const cachedClient = redisClientCache.get(this.getConnectionIdentifier(connection)); + const cachedClient = redisClientCache.get(LRUStorage.getConnectionIdentifier(connection)); return cachedClient ? cachedClient : null; } public static setRedisClientCache(connection: ConnectionParams, client: any): void { - redisClientCache.set(this.getConnectionIdentifier(connection), client); + redisClientCache.set(LRUStorage.getConnectionIdentifier(connection), client); } public static delRedisClientCache(connection: ConnectionParams): void { - redisClientCache.delete(this.getConnectionIdentifier(connection)); + redisClientCache.delete(LRUStorage.getConnectionIdentifier(connection)); } public static setCassandraClientCache(connection: ConnectionParams, client: Client): void { - cassandraClientCache.set(this.getConnectionIdentifier(connection), client); + cassandraClientCache.set(LRUStorage.getConnectionIdentifier(connection), client); } public static getCassandraClientCache(connection: ConnectionParams): Client | null { - const cachedClient = cassandraClientCache.get(this.getConnectionIdentifier(connection)) as Client; + const cachedClient = cassandraClientCache.get(LRUStorage.getConnectionIdentifier(connection)) as Client; return cachedClient ? cachedClient : null; } public static delCassandraClientCache(connection: ConnectionParams): void { - cassandraClientCache.delete(this.getConnectionIdentifier(connection)); + cassandraClientCache.delete(LRUStorage.getConnectionIdentifier(connection)); } public static getCassandraClientCount(): number { @@ -56,55 +56,55 @@ export class LRUStorage { } public static setMongoDbCache(connection: ConnectionParams, newDb: MongoClientDB): void { - mongoDbCache.set(this.getConnectionIdentifier(connection), newDb); + mongoDbCache.set(LRUStorage.getConnectionIdentifier(connection), newDb); } public static getMongoDbCache(connection: ConnectionParams): MongoClientDB | null { - const cachedDb = mongoDbCache.get(this.getConnectionIdentifier(connection)) as MongoClientDB; + const cachedDb = mongoDbCache.get(LRUStorage.getConnectionIdentifier(connection)) as MongoClientDB; return cachedDb ? cachedDb : null; } public static delMongoDbCache(connection: ConnectionParams): void { - mongoDbCache.delete(this.getConnectionIdentifier(connection)); + mongoDbCache.delete(LRUStorage.getConnectionIdentifier(connection)); } public static getImdbDb2Cache(connection: ConnectionParams): Database | null { - const cachedDb = imdbDb2Cache.get(this.getConnectionIdentifier(connection)) as Database; + const cachedDb = imdbDb2Cache.get(LRUStorage.getConnectionIdentifier(connection)) as Database; return cachedDb ? cachedDb : null; } public static delImdbDb2Cache(connection: ConnectionParams): void { - imdbDb2Cache.delete(this.getConnectionIdentifier(connection)); + imdbDb2Cache.delete(LRUStorage.getConnectionIdentifier(connection)); } public static setImdbDb2Cache(connection: ConnectionParams, newDb: Database): void { - imdbDb2Cache.set(this.getConnectionIdentifier(connection), newDb); + imdbDb2Cache.set(LRUStorage.getConnectionIdentifier(connection), newDb); } public static getCachedKnex(connectionConfig: ConnectionParams): Knex | null { - const cachedKnex = knexCache.get(this.getConnectionIdentifier(connectionConfig)) as Knex; + const cachedKnex = knexCache.get(LRUStorage.getConnectionIdentifier(connectionConfig)) as Knex; return cachedKnex ? cachedKnex : null; } public static setKnexCache(connectionConfig: ConnectionParams, newKnex: Knex): void { - knexCache.set(this.getConnectionIdentifier(connectionConfig), newKnex); + knexCache.set(LRUStorage.getConnectionIdentifier(connectionConfig), newKnex); } public static delKnexCache(connectionConfig: ConnectionParams): void { - knexCache.delete(this.getConnectionIdentifier(connectionConfig)); + knexCache.delete(LRUStorage.getConnectionIdentifier(connectionConfig)); } public static getTunnelCache(connection: ConnectionParams): any { - const cachedTnl = tunnelCache.get(this.getConnectionIdentifier(connection)); + const cachedTnl = tunnelCache.get(LRUStorage.getConnectionIdentifier(connection)); return cachedTnl ? cachedTnl : null; } public static setTunnelCache(connection: ConnectionParams, tnlObj: Record): void { - tunnelCache.set(this.getConnectionIdentifier(connection), tnlObj); + tunnelCache.set(LRUStorage.getConnectionIdentifier(connection), tnlObj); } public static delTunnelCache(connection: ConnectionParams): void { - tunnelCache.delete(this.getConnectionIdentifier(connection)); + tunnelCache.delete(LRUStorage.getConnectionIdentifier(connection)); } public static setTableForeignKeysCache( @@ -180,7 +180,7 @@ export class LRUStorage { } public static getConnectionIdentifier(connectionParams: ConnectionParams | ConnectionAgentParams): string { - if (this.isConnectionAgentParams(connectionParams)) { + if (LRUStorage.isConnectionAgentParams(connectionParams)) { const cacheObj = { id: connectionParams.id, token: connectionParams.token, @@ -220,7 +220,7 @@ export class LRUStorage { public static isConnectionAgentParams( connectionParams: ConnectionParams | ConnectionAgentParams, ): connectionParams is ConnectionAgentParams { - if (connectionParams.hasOwnProperty('token') && connectionParams['token']) { + if (Object.hasOwn(connectionParams, 'token') && (connectionParams as ConnectionAgentParams).token) { return true; } return false; diff --git a/shared-code/src/data-access-layer/data-access-objects/data-access-object-agent.ts b/shared-code/src/data-access-layer/data-access-objects/data-access-object-agent.ts index 57104092..ae62581c 100644 --- a/shared-code/src/data-access-layer/data-access-objects/data-access-object-agent.ts +++ b/shared-code/src/data-access-layer/data-access-objects/data-access-object-agent.ts @@ -45,7 +45,7 @@ export class DataAccessObjectAgent implements IDataAccessObjectAgent { userEmail: string, ): Promise> { const jwtAuthToken = this.generateJWT(this.connection.token); - axios.defaults.headers.common['Authorization'] = `Bearer ${jwtAuthToken}`; + axios.defaults.headers.common.Authorization = `Bearer ${jwtAuthToken}`; return this.executeWithRetry(async () => { try { @@ -81,7 +81,7 @@ export class DataAccessObjectAgent implements IDataAccessObjectAgent { userEmail: string, ): Promise> { const jwtAuthToken = this.generateJWT(this.connection.token); - axios.defaults.headers.common['Authorization'] = `Bearer ${jwtAuthToken}`; + axios.defaults.headers.common.Authorization = `Bearer ${jwtAuthToken}`; return this.executeWithRetry(async () => { try { @@ -119,7 +119,7 @@ export class DataAccessObjectAgent implements IDataAccessObjectAgent { userEmail: string, ): Promise>> { const jwtAuthToken = this.generateJWT(this.connection.token); - axios.defaults.headers.common['Authorization'] = `Bearer ${jwtAuthToken}`; + axios.defaults.headers.common.Authorization = `Bearer ${jwtAuthToken}`; return this.executeWithRetry(async () => { try { @@ -158,7 +158,7 @@ export class DataAccessObjectAgent implements IDataAccessObjectAgent { userEmail: string, ): Promise> { const jwtAuthToken = this.generateJWT(this.connection.token); - axios.defaults.headers.common['Authorization'] = `Bearer ${jwtAuthToken}`; + axios.defaults.headers.common.Authorization = `Bearer ${jwtAuthToken}`; return this.executeWithRetry(async () => { try { @@ -200,7 +200,7 @@ export class DataAccessObjectAgent implements IDataAccessObjectAgent { userEmail: string, ): Promise>> { const jwtAuthToken = this.generateJWT(this.connection.token); - axios.defaults.headers.common['Authorization'] = `Bearer ${jwtAuthToken}`; + axios.defaults.headers.common.Authorization = `Bearer ${jwtAuthToken}`; return this.executeWithRetry(async () => { try { @@ -243,7 +243,7 @@ export class DataAccessObjectAgent implements IDataAccessObjectAgent { userEmail: string, ): Promise { const jwtAuthToken = this.generateJWT(this.connection.token); - axios.defaults.headers.common['Authorization'] = `Bearer ${jwtAuthToken}`; + axios.defaults.headers.common.Authorization = `Bearer ${jwtAuthToken}`; return this.executeWithRetry(async () => { try { @@ -281,7 +281,7 @@ export class DataAccessObjectAgent implements IDataAccessObjectAgent { public async getTableForeignKeys(tableName: string, userEmail: string): Promise { const jwtAuthToken = this.generateJWT(this.connection.token); - axios.defaults.headers.common['Authorization'] = `Bearer ${jwtAuthToken}`; + axios.defaults.headers.common.Authorization = `Bearer ${jwtAuthToken}`; const cachedForeignKeys = LRUStorage.getTableForeignKeysCache(this.connection, tableName); if (cachedForeignKeys) { @@ -318,7 +318,7 @@ export class DataAccessObjectAgent implements IDataAccessObjectAgent { public async getTablePrimaryColumns(tableName: string, userEmail: string): Promise { const jwtAuthToken = this.generateJWT(this.connection.token); - axios.defaults.headers.common['Authorization'] = `Bearer ${jwtAuthToken}`; + axios.defaults.headers.common.Authorization = `Bearer ${jwtAuthToken}`; const cachedPrimaryColumns = LRUStorage.getTablePrimaryKeysCache(this.connection, tableName); if (cachedPrimaryColumns) { @@ -355,7 +355,7 @@ export class DataAccessObjectAgent implements IDataAccessObjectAgent { public async getTablesFromDB(userEmail: string): Promise { const jwtAuthToken = this.generateJWT(this.connection.token); - axios.defaults.headers.common['Authorization'] = `Bearer ${jwtAuthToken}`; + axios.defaults.headers.common.Authorization = `Bearer ${jwtAuthToken}`; return this.executeWithRetry(async () => { try { @@ -385,7 +385,7 @@ export class DataAccessObjectAgent implements IDataAccessObjectAgent { public async getTableStructure(tableName: string, userEmail: string): Promise { const jwtAuthToken = this.generateJWT(this.connection.token); - axios.defaults.headers.common['Authorization'] = `Bearer ${jwtAuthToken}`; + axios.defaults.headers.common.Authorization = `Bearer ${jwtAuthToken}`; const cachedTableStructure = LRUStorage.getTableStructureCache(this.connection, tableName); if (cachedTableStructure) { @@ -422,7 +422,7 @@ export class DataAccessObjectAgent implements IDataAccessObjectAgent { public async testConnect(userEmail: string = 'unknown'): Promise { const jwtAuthToken = this.generateJWT(this.connection.token); - axios.defaults.headers.common['Authorization'] = `Bearer ${jwtAuthToken}`; + axios.defaults.headers.common.Authorization = `Bearer ${jwtAuthToken}`; return this.executeWithRetry(async () => { try { @@ -453,7 +453,7 @@ export class DataAccessObjectAgent implements IDataAccessObjectAgent { userEmail: string, ): Promise> { const jwtAuthToken = this.generateJWT(this.connection.token); - axios.defaults.headers.common['Authorization'] = `Bearer ${jwtAuthToken}`; + axios.defaults.headers.common.Authorization = `Bearer ${jwtAuthToken}`; return this.executeWithRetry(async () => { try { @@ -491,7 +491,7 @@ export class DataAccessObjectAgent implements IDataAccessObjectAgent { userEmail: string, ): Promise>> { const jwtAuthToken = this.generateJWT(this.connection.token); - axios.defaults.headers.common['Authorization'] = `Bearer ${jwtAuthToken}`; + axios.defaults.headers.common.Authorization = `Bearer ${jwtAuthToken}`; return this.executeWithRetry(async () => { try { @@ -528,7 +528,7 @@ export class DataAccessObjectAgent implements IDataAccessObjectAgent { userEmail: string, ): Promise { const jwtAuthToken = this.generateJWT(this.connection.token); - axios.defaults.headers.common['Authorization'] = `Bearer ${jwtAuthToken}`; + axios.defaults.headers.common.Authorization = `Bearer ${jwtAuthToken}`; return this.executeWithRetry(async () => { try { @@ -564,7 +564,7 @@ export class DataAccessObjectAgent implements IDataAccessObjectAgent { userEmail: string, ): Promise { const jwtAuthToken = this.generateJWT(this.connection.token); - axios.defaults.headers.common['Authorization'] = `Bearer ${jwtAuthToken}`; + axios.defaults.headers.common.Authorization = `Bearer ${jwtAuthToken}`; return this.executeWithRetry(async () => { try { @@ -599,7 +599,7 @@ export class DataAccessObjectAgent implements IDataAccessObjectAgent { userEmail: string, ): Promise { const jwtAuthToken = this.generateJWT(this.connection.token); - axios.defaults.headers.common['Authorization'] = `Bearer ${jwtAuthToken}`; + axios.defaults.headers.common.Authorization = `Bearer ${jwtAuthToken}`; return this.executeWithRetry(async () => { try { @@ -630,7 +630,7 @@ export class DataAccessObjectAgent implements IDataAccessObjectAgent { public async isView(tableName: string, userEmail: string): Promise { const jwtAuthToken = this.generateJWT(this.connection.token); - axios.defaults.headers.common['Authorization'] = `Bearer ${jwtAuthToken}`; + axios.defaults.headers.common.Authorization = `Bearer ${jwtAuthToken}`; return this.executeWithRetry(async () => { try { @@ -668,7 +668,7 @@ export class DataAccessObjectAgent implements IDataAccessObjectAgent { filteringFields: Array, ): Promise> { const jwtAuthToken = this.generateJWT(this.connection.token); - axios.defaults.headers.common['Authorization'] = `Bearer ${jwtAuthToken}`; + axios.defaults.headers.common.Authorization = `Bearer ${jwtAuthToken}`; return this.executeWithRetry(async () => { try { @@ -703,7 +703,7 @@ export class DataAccessObjectAgent implements IDataAccessObjectAgent { public async importCSVInTable(file: Express.Multer.File, tableName: string, userEmail: string): Promise { const jwtAuthToken = this.generateJWT(this.connection.token); - axios.defaults.headers.common['Authorization'] = `Bearer ${jwtAuthToken}`; + axios.defaults.headers.common.Authorization = `Bearer ${jwtAuthToken}`; return this.executeWithRetry(async () => { try { @@ -740,7 +740,7 @@ export class DataAccessObjectAgent implements IDataAccessObjectAgent { userEmail: string, ): Promise>> { const jwtAuthToken = this.generateJWT(this.connection.token); - axios.defaults.headers.common['Authorization'] = `Bearer ${jwtAuthToken}`; + axios.defaults.headers.common.Authorization = `Bearer ${jwtAuthToken}`; return this.executeWithRetry(async () => { try { @@ -930,7 +930,6 @@ export class DataAccessObjectAgent implements IDataAccessObjectAgent { row[column] = date.toISOString(); } } catch (_error) { - continue; } } } diff --git a/shared-code/src/data-access-layer/data-access-objects/data-access-object-cassandra.ts b/shared-code/src/data-access-layer/data-access-objects/data-access-object-cassandra.ts index 962f3346..37669c84 100644 --- a/shared-code/src/data-access-layer/data-access-objects/data-access-object-cassandra.ts +++ b/shared-code/src/data-access-layer/data-access-objects/data-access-object-cassandra.ts @@ -9,7 +9,6 @@ import { DAO_CONSTANTS } from '../../helpers/data-access-objects-constants.js'; import { getTunnel } from '../../helpers/get-ssh-tunnel.js'; import { tableSettingsFieldValidator } from '../../helpers/validation/table-settings-validator.js'; import { AutocompleteFieldsDS } from '../shared/data-structures/autocomplete-fields.ds.js'; -import { ConnectionParams } from '../shared/data-structures/connections-params.ds.js'; import { FilteringFieldsDS } from '../shared/data-structures/filtering-fields.ds.js'; import { ForeignKeyDS } from '../shared/data-structures/foreign-key.ds.js'; import { FoundRowsDS } from '../shared/data-structures/found-rows.ds.js'; @@ -26,9 +25,6 @@ import { IDataAccessObject } from '../../shared/interfaces/data-access-object.in import { BasicDataAccessObject } from './basic-data-access-object.js'; export class DataAccessObjectCassandra extends BasicDataAccessObject implements IDataAccessObject { - constructor(connection: ConnectionParams) { - super(connection); - } public async addRowInTable( tableName: string, @@ -241,7 +237,7 @@ export class DataAccessObjectCassandra extends BasicDataAccessObject implements if (type === 'uuid' && isUuid(searchedFieldValue)) { valid = true; param = searchedFieldValue; - } else if ((type === 'int' || type === 'bigint') && !isNaN(Number(searchedFieldValue))) { + } else if ((type === 'int' || type === 'bigint') && !Number.isNaN(Number(searchedFieldValue))) { valid = true; param = Number(searchedFieldValue); } else if (type === 'date') { @@ -360,7 +356,7 @@ export class DataAccessObjectCassandra extends BasicDataAccessObject implements } if (type && typeof type === 'object') { - if (type.info && type.info.name) { + if (type.info?.name) { return this.stripGenerics(type.info.name); } @@ -477,7 +473,7 @@ export class DataAccessObjectCassandra extends BasicDataAccessObject implements ); for (const row of tablesResult.rows) { tables.push({ - tableName: row['table_name'], + tableName: row.table_name, isView: false, }); } @@ -488,7 +484,7 @@ export class DataAccessObjectCassandra extends BasicDataAccessObject implements ); for (const row of viewsResult.rows) { tables.push({ - tableName: row['view_name'], + tableName: row.view_name, isView: true, }); } @@ -511,9 +507,9 @@ export class DataAccessObjectCassandra extends BasicDataAccessObject implements ); for (const row of columnsResult.rows) { tableStructure.push({ - column_name: row['column_name'], + column_name: row.column_name, column_default: null, - data_type: this.cassandraTypeToReadable(row['type']), + data_type: this.cassandraTypeToReadable(row.type), allow_null: true, character_maximum_length: null, data_type_params: null, @@ -710,8 +706,8 @@ export class DataAccessObjectCassandra extends BasicDataAccessObject implements field.data_type.includes('float') || field.data_type.includes('double') ) { - value = isNaN(parseFloat(value)) ? null : parseFloat(value); - } else if (field.data_type === 'timestamp' && !isNaN(Number(value))) { + value = Number.isNaN(parseFloat(value)) ? null : parseFloat(value); + } else if (field.data_type === 'timestamp' && !Number.isNaN(Number(value))) { const timestamp = Number(value); value = new Date(timestamp); } else if (field.data_type.includes('boolean')) { diff --git a/shared-code/src/data-access-layer/data-access-objects/data-access-object-clickhouse.ts b/shared-code/src/data-access-layer/data-access-objects/data-access-object-clickhouse.ts index 5083177d..ab8d46c4 100644 --- a/shared-code/src/data-access-layer/data-access-objects/data-access-object-clickhouse.ts +++ b/shared-code/src/data-access-layer/data-access-objects/data-access-object-clickhouse.ts @@ -9,7 +9,6 @@ import { DAO_CONSTANTS } from '../../helpers/data-access-objects-constants.js'; import { ERROR_MESSAGES } from '../../helpers/errors/error-messages.js'; import { tableSettingsFieldValidator } from '../../helpers/validation/table-settings-validator.js'; import { AutocompleteFieldsDS } from '../shared/data-structures/autocomplete-fields.ds.js'; -import { ConnectionParams } from '../shared/data-structures/connections-params.ds.js'; import { FilteringFieldsDS } from '../shared/data-structures/filtering-fields.ds.js'; import { ForeignKeyDS } from '../shared/data-structures/foreign-key.ds.js'; import { FoundRowsDS } from '../shared/data-structures/found-rows.ds.js'; @@ -26,9 +25,6 @@ import { BasicDataAccessObject } from './basic-data-access-object.js'; import { NodeClickHouseClientConfigOptions } from '@clickhouse/client/dist/config.js'; export class DataAccessObjectClickHouse extends BasicDataAccessObject implements IDataAccessObject { - constructor(connection: ConnectionParams) { - super(connection); - } public async addRowInTable(tableName: string, row: Record): Promise> { const client = await this.getClickHouseClient(); @@ -869,7 +865,7 @@ export class DataAccessObjectClickHouse extends BasicDataAccessObject implements const connectionCopy = { ...this.connection }; const cachedTnl = LRUStorage.getTunnelCache(connectionCopy); - if (cachedTnl && cachedTnl.clickhouse && cachedTnl.server && cachedTnl.client) { + if (cachedTnl?.clickhouse && cachedTnl.server && cachedTnl.client) { return cachedTnl.clickhouse; } diff --git a/shared-code/src/data-access-layer/data-access-objects/data-access-object-dynamodb.ts b/shared-code/src/data-access-layer/data-access-objects/data-access-object-dynamodb.ts index 21a0c94b..4d43edf4 100644 --- a/shared-code/src/data-access-layer/data-access-objects/data-access-object-dynamodb.ts +++ b/shared-code/src/data-access-layer/data-access-objects/data-access-object-dynamodb.ts @@ -17,7 +17,6 @@ import { DAO_CONSTANTS } from '../../helpers/data-access-objects-constants.js'; import { isObjectEmpty } from '../../helpers/is-object-empty.js'; import { tableSettingsFieldValidator } from '../../helpers/validation/table-settings-validator.js'; import { AutocompleteFieldsDS } from '../shared/data-structures/autocomplete-fields.ds.js'; -import { ConnectionParams } from '../shared/data-structures/connections-params.ds.js'; import { FilteringFieldsDS } from '../shared/data-structures/filtering-fields.ds.js'; import { ForeignKeyDS } from '../shared/data-structures/foreign-key.ds.js'; import { FoundRowsDS } from '../shared/data-structures/found-rows.ds.js'; @@ -38,9 +37,6 @@ export type DdAndClient = { documentClient: DynamoDBDocumentClient; }; export class DataAccessObjectDynamoDB extends BasicDataAccessObject implements IDataAccessObject { - constructor(connection: ConnectionParams) { - super(connection); - } public async addRowInTable( tableName: string, @@ -78,10 +74,9 @@ export class DataAccessObjectDynamoDB extends BasicDataAccessObject implements I const foundKeySchema = tableStructure.find((el) => el.column_name === key); if (foundKeySchema?.data_type === 'number') { const numericValue = Number(primaryKey[key]); - if (!isNaN(numericValue)) { + if (!Number.isNaN(numericValue)) { primaryKey[key] = numericValue; } else { - continue; } } } @@ -155,10 +150,9 @@ export class DataAccessObjectDynamoDB extends BasicDataAccessObject implements I const foundKeySchema = tableStructure.find((el) => el.column_name === key); if (foundKeySchema?.data_type === 'number') { const numericValue = Number(primaryKey[key]); - if (!isNaN(numericValue)) { + if (!Number.isNaN(numericValue)) { primaryKey[key] = numericValue; } else { - continue; } } } @@ -194,7 +188,7 @@ export class DataAccessObjectDynamoDB extends BasicDataAccessObject implements I for (const key in primaryKey) { const schema = tableStructure.find((element) => element.column_name === key); const value = schema?.data_type === 'number' ? Number(primaryKey[key]) : primaryKey[key]; - if (schema?.data_type === 'number' && isNaN(value as number)) { + if (schema?.data_type === 'number' && Number.isNaN(value as number)) { throw new Error(`Invalid number value for key: ${key}`); } marshalledKey[key] = value; @@ -285,7 +279,7 @@ export class DataAccessObjectDynamoDB extends BasicDataAccessObject implements I const isNumberField = fieldInfo?.data_type === 'number'; if (isNumberField) { const numericValue = Number(searchedFieldValue); - if (!isNaN(numericValue)) { + if (!Number.isNaN(numericValue)) { expressionAttributeValues[`:${field}_value`] = { N: String(numericValue) }; return `#${field} = :${field}_value`; } @@ -486,10 +480,9 @@ export class DataAccessObjectDynamoDB extends BasicDataAccessObject implements I const foundKeySchema = tableStructure.find((el) => el.column_name === key); if (foundKeySchema?.data_type === 'number') { const numericValue = Number(primaryKey[key]); - if (!isNaN(numericValue)) { + if (!Number.isNaN(numericValue)) { primaryKey[key] = numericValue; } else { - continue; } } } @@ -535,7 +528,7 @@ export class DataAccessObjectDynamoDB extends BasicDataAccessObject implements I const updateExpression = 'SET ' + Object.keys(newValues) - .map((key, index) => `#key${index} = :value${index}`) + .map((_key, index) => `#key${index} = :value${index}`) .join(', '); const expressionAttributeNames = Object.keys(newValues).reduce((acc, key, index) => { acc[`#key${index}`] = key; @@ -576,7 +569,7 @@ export class DataAccessObjectDynamoDB extends BasicDataAccessObject implements I const foundKeySchema = tableStructure.find((el) => el.column_name === key); if (foundKeySchema?.data_type === 'number') { const numericValue = Number(primaryKey[key]); - if (!isNaN(numericValue)) { + if (!Number.isNaN(numericValue)) { primaryKey[key] = numericValue; } } @@ -683,7 +676,6 @@ export class DataAccessObjectDynamoDB extends BasicDataAccessObject implements I try { row[column.column_name] = (row[column.column_name] as string[]).map((value) => hexToBinary(value)); } catch (_e) { - continue; } } } @@ -752,7 +744,7 @@ export class DataAccessObjectDynamoDB extends BasicDataAccessObject implements I const fieldInfo = tableStructure.find((el) => el.column_name === key); if (fieldInfo?.data_type === 'number' || attributeType === 'N') { const valueToNumber = Number(transformedRow[key]); - if (!isNaN(valueToNumber)) { + if (!Number.isNaN(valueToNumber)) { transformedRow[key] = valueToNumber; } } @@ -792,7 +784,6 @@ export class DataAccessObjectDynamoDB extends BasicDataAccessObject implements I expressionAttributeValues: { [key: string]: any }, expressionAttributeNames: { [key: string]: string }, ): Promise { - try { let lastEvaluatedKey = null; let totalRowsCount = 0; const { dynamoDb } = this.getDynamoDb(); @@ -820,9 +811,6 @@ export class DataAccessObjectDynamoDB extends BasicDataAccessObject implements I } while (lastEvaluatedKey); return totalRowsCount; - } catch (error) { - throw error; - } } private sortRows(rows: any[], orderingField: string, ordering: QueryOrderingEnum): any[] { diff --git a/shared-code/src/data-access-layer/data-access-objects/data-access-object-elasticsearch.ts b/shared-code/src/data-access-layer/data-access-objects/data-access-object-elasticsearch.ts index d49323b8..6920e4b6 100644 --- a/shared-code/src/data-access-layer/data-access-objects/data-access-object-elasticsearch.ts +++ b/shared-code/src/data-access-layer/data-access-objects/data-access-object-elasticsearch.ts @@ -5,7 +5,6 @@ import { Readable, Stream } from 'stream'; import { DAO_CONSTANTS } from '../../helpers/data-access-objects-constants.js'; import { tableSettingsFieldValidator } from '../../helpers/validation/table-settings-validator.js'; import { AutocompleteFieldsDS } from '../shared/data-structures/autocomplete-fields.ds.js'; -import { ConnectionParams } from '../shared/data-structures/connections-params.ds.js'; import { FilteringFieldsDS } from '../shared/data-structures/filtering-fields.ds.js'; import { ForeignKeyDS } from '../shared/data-structures/foreign-key.ds.js'; import { FoundRowsDS } from '../shared/data-structures/found-rows.ds.js'; @@ -21,9 +20,6 @@ import { IDataAccessObject } from '../../shared/interfaces/data-access-object.in import { BasicDataAccessObject } from './basic-data-access-object.js'; export class DataAccessObjectElasticsearch extends BasicDataAccessObject implements IDataAccessObject { - constructor(connection: ConnectionParams) { - super(connection); - } public async addRowInTable( tableName: string, @@ -136,7 +132,7 @@ export class DataAccessObjectElasticsearch extends BasicDataAccessObject impleme const client = this.getElasticClient(); const primaryDocs = primaryKeys.map((primaryKey) => ({ - _id: primaryKey['_id'] as string, + _id: primaryKey._id as string, })); const response = (await client.mget({ index: tableName, @@ -588,7 +584,7 @@ export class DataAccessObjectElasticsearch extends BasicDataAccessObject impleme if (actions.length > 0) { try { const response = await client.bulk({ refresh: true, body: actions }); - const erroredDocuments = response.items.filter((item) => item.index && item.index.error); + const erroredDocuments = response.items.filter((item) => item.index?.error); if (erroredDocuments.length > 0) { throw new Error( `Failed to index some documents: ${erroredDocuments.map((doc) => doc.index.error).join(', ')}`, @@ -678,7 +674,7 @@ export class DataAccessObjectElasticsearch extends BasicDataAccessObject impleme return 'string'; } else if (typeof value === 'number') { return 'number'; - } else if (value instanceof Date || !isNaN(Date.parse(value))) { + } else if (value instanceof Date || !Number.isNaN(Date.parse(value))) { return 'date'; } else if (typeof value === 'boolean') { return 'boolean'; diff --git a/shared-code/src/data-access-layer/data-access-objects/data-access-object-ibmdb2.ts b/shared-code/src/data-access-layer/data-access-objects/data-access-object-ibmdb2.ts index a954863a..8a65d447 100644 --- a/shared-code/src/data-access-layer/data-access-objects/data-access-object-ibmdb2.ts +++ b/shared-code/src/data-access-layer/data-access-objects/data-access-object-ibmdb2.ts @@ -25,9 +25,6 @@ import { IDataAccessObject } from '../../shared/interfaces/data-access-object.in import { BasicDataAccessObject } from './basic-data-access-object.js'; export class DataAccessObjectIbmDb2 extends BasicDataAccessObject implements IDataAccessObject { - constructor(connection: ConnectionParams) { - super(connection); - } public async addRowInTable( tableName: string, @@ -218,7 +215,7 @@ export class DataAccessObjectIbmDb2 extends BasicDataAccessObject implements IDa const lastPage = Math.ceil(rowsCount / perPage); let rowsRO: FoundRowsDS; - if (autocompleteFields && autocompleteFields.value && autocompleteFields.fields.length > 0) { + if (autocompleteFields?.value && autocompleteFields.fields.length > 0) { const fields = autocompleteFields.fields.join(', '); const autocompleteQuery = `SELECT ${fields} FROM ${connectionSchema}.${tableName} WHERE ${fields} LIKE '${autocompleteFields.value}%' FETCH FIRST ${DAO_CONSTANTS.AUTOCOMPLETE_ROW_LIMIT} ROWS ONLY`; const rows = await connectionToDb.query(autocompleteQuery); @@ -438,7 +435,7 @@ ORDER BY `; try { const testResult = await connectionToDb.query(query); - if (testResult && testResult[0] && testResult[0]['1'] === 1) { + if (testResult?.[0] && testResult[0]['1'] === 1) { return { result: true, message: 'Successfully connected', @@ -617,7 +614,7 @@ ORDER BY FROM ${tableSchema}.${tableName} `; const countResult = await connectionToDb.query(countQuery); - const rowsCount = parseInt(countResult[0]['1']); + const rowsCount = parseInt(countResult[0]['1'], 10); return { rowsCount: rowsCount, large_dataset: false }; } @@ -631,7 +628,7 @@ ORDER BY `; const fastCountParams = [tableName, tableSchema]; const fastCountQueryResult = await connectionToDb.query(fastCountQuery, fastCountParams); - const fastCount = fastCountQueryResult[0]['CARD']; + const fastCount = fastCountQueryResult[0].CARD; return fastCount; } @@ -645,15 +642,11 @@ ORDER BY for await (const record of parser) { results.push(record); } - try { await Promise.allSettled( results.map(async (row) => { return await this.addRowInTable(tableName, row); }), ); - } catch (error) { - throw error; - } } public async executeRawQuery(query: string): Promise>> { @@ -691,7 +684,7 @@ ORDER BY const connectionCopy = { ...connection }; return new Promise(async (resolve, reject): Promise => { const cachedTnl = LRUStorage.getTunnelCache(connectionCopy); - if (cachedTnl && cachedTnl.database && cachedTnl.server && cachedTnl.client && cachedTnl.database.connected) { + if (cachedTnl?.database && cachedTnl.server && cachedTnl.client && cachedTnl.database.connected) { resolve(cachedTnl.database); return; } @@ -728,12 +721,4 @@ ORDER BY } }); } - - private sanitize(value: unknown): string { - if (typeof value === 'string') { - return value.replace(/'/g, "''"); - } else { - return String(value); - } - } } diff --git a/shared-code/src/data-access-layer/data-access-objects/data-access-object-mongodb.ts b/shared-code/src/data-access-layer/data-access-objects/data-access-object-mongodb.ts index eca9fbb6..b94e24f3 100644 --- a/shared-code/src/data-access-layer/data-access-objects/data-access-object-mongodb.ts +++ b/shared-code/src/data-access-layer/data-access-objects/data-access-object-mongodb.ts @@ -33,9 +33,6 @@ export type MongoClientDB = { }; export class DataAccessObjectMongo extends BasicDataAccessObject implements IDataAccessObject { - constructor(connection: ConnectionParams) { - super(connection); - } public async addRowInTable( tableName: string, @@ -256,19 +253,19 @@ export class DataAccessObjectMongo extends BasicDataAccessObject implements IDat acc[field] = new RegExp(String(value), 'i'); break; case FilterCriteriaEnum.gt: - acc[field]['$gt'] = value; + acc[field].$gt = value; break; case FilterCriteriaEnum.lt: - acc[field]['$lt'] = value; + acc[field].$lt = value; break; case FilterCriteriaEnum.gte: - acc[field]['$gte'] = value; + acc[field].$gte = value; break; case FilterCriteriaEnum.lte: - acc[field]['$lte'] = value; + acc[field].$lte = value; break; case FilterCriteriaEnum.icontains: - acc[field]['$not'] = new RegExp(String(value), 'i'); + acc[field].$not = new RegExp(String(value), 'i'); break; case FilterCriteriaEnum.startswith: acc[field] = new RegExp(`^${String(value)}`, 'i'); @@ -277,7 +274,7 @@ export class DataAccessObjectMongo extends BasicDataAccessObject implements IDat acc[field] = new RegExp(`${String(value)}$`, 'i'); break; case FilterCriteriaEnum.empty: - acc[field]['$exists'] = false; + acc[field].$exists = false; break; default: break; @@ -421,11 +418,7 @@ export class DataAccessObjectMongo extends BasicDataAccessObject implements IDat for await (const record of parser) { results.push(record); } - try { await collection.insertMany(results); - } catch (error) { - throw error; - } } public async getTableRowsStream( @@ -510,7 +503,7 @@ export class DataAccessObjectMongo extends BasicDataAccessObject implements IDat const connectionCopy = { ...connection }; return new Promise(async (resolve, reject): Promise => { const cachedTnl = LRUStorage.getTunnelCache(connectionCopy); - if (cachedTnl && cachedTnl.mongo && cachedTnl.server && cachedTnl.client) { + if (cachedTnl?.mongo && cachedTnl.server && cachedTnl.client) { resolve(cachedTnl.db); return; } diff --git a/shared-code/src/data-access-layer/data-access-objects/data-access-object-mssql.ts b/shared-code/src/data-access-layer/data-access-objects/data-access-object-mssql.ts index ec2a11e4..3384ca64 100644 --- a/shared-code/src/data-access-layer/data-access-objects/data-access-object-mssql.ts +++ b/shared-code/src/data-access-layer/data-access-objects/data-access-object-mssql.ts @@ -11,7 +11,6 @@ import { objectKeysToLowercase } from '../../helpers/object-kyes-to-lowercase.js import { renameObjectKeyName } from '../../helpers/rename-object-keyname.js'; import { tableSettingsFieldValidator } from '../../helpers/validation/table-settings-validator.js'; import { AutocompleteFieldsDS } from '../shared/data-structures/autocomplete-fields.ds.js'; -import { ConnectionParams } from '../shared/data-structures/connections-params.ds.js'; import { FilteringFieldsDS } from '../shared/data-structures/filtering-fields.ds.js'; import { ForeignKeyDS } from '../shared/data-structures/foreign-key.ds.js'; import { FoundRowsDS } from '../shared/data-structures/found-rows.ds.js'; @@ -28,9 +27,6 @@ import { IDataAccessObject } from '../../shared/interfaces/data-access-object.in import { BasicDataAccessObject } from './basic-data-access-object.js'; export class DataAccessObjectMssql extends BasicDataAccessObject implements IDataAccessObject { - constructor(connection: ConnectionParams) { - super(connection); - } public async addRowInTable( tableName: string, @@ -146,7 +142,7 @@ export class DataAccessObjectMssql extends BasicDataAccessObject implements IDat const tableNameWithoutSchema = receivedTableName; const tableNameWithSchema = tableSchema ? `${tableSchema}.[${receivedTableName}]` : receivedTableName; - if (autocompleteFields && autocompleteFields.value && autocompleteFields.fields.length > 0) { + if (autocompleteFields?.value && autocompleteFields.fields.length > 0) { const rows = await knex(tableNameWithSchema) .select(autocompleteFields.fields) .modify((builder) => { @@ -625,8 +621,6 @@ WHERE TABLE_TYPE = 'VIEW' for await (const record of parser) { results.push(record); } - - try { await knex.transaction(async (trx) => { for (const row of results) { for (const column of timestampColumnNames) { @@ -639,9 +633,6 @@ WHERE TABLE_TYPE = 'VIEW' await trx(tableWithSchema).insert(row); } }); - } catch (error) { - throw error; - } } public async executeRawQuery(query: string): Promise>> { @@ -751,6 +742,6 @@ WHERE TABLE_TYPE = 'VIEW' ORDER BY [TableName]`, [tableName], ); - return parseInt(fastCountQueryResult[0].RowCount); + return parseInt(fastCountQueryResult[0].RowCount, 10); } } diff --git a/shared-code/src/data-access-layer/data-access-objects/data-access-object-mysql.ts b/shared-code/src/data-access-layer/data-access-objects/data-access-object-mysql.ts index d9ff06de..c9fa9aad 100644 --- a/shared-code/src/data-access-layer/data-access-objects/data-access-object-mysql.ts +++ b/shared-code/src/data-access-layer/data-access-objects/data-access-object-mysql.ts @@ -5,7 +5,6 @@ import { DAO_CONSTANTS } from '../../helpers/data-access-objects-constants.js'; import { getPropertyValueByDescriptor } from '../../helpers/get-property-value-by-descriptor.js'; import { setPropertyValue } from '../../helpers/set-property-value.js'; import { AutocompleteFieldsDS } from '../shared/data-structures/autocomplete-fields.ds.js'; -import { ConnectionParams } from '../shared/data-structures/connections-params.ds.js'; import { FilteringFieldsDS } from '../shared/data-structures/filtering-fields.ds.js'; import { ForeignKeyDS } from '../shared/data-structures/foreign-key.ds.js'; import { FoundRowsDS } from '../shared/data-structures/found-rows.ds.js'; @@ -31,9 +30,6 @@ import { isMySqlDateOrTimeType, isMySQLDateStringByRegexp } from '../../helpers/ import { nanoid } from 'nanoid'; export class DataAccessObjectMysql extends BasicDataAccessObject implements IDataAccessObject { - constructor(connection: ConnectionParams) { - super(connection); - } public async addRowInTable( tableName: string, row: Record, @@ -240,7 +236,7 @@ export class DataAccessObjectMysql extends BasicDataAccessObject implements IDat return builder; }) .modify((builder) => { - if (filteringFields && filteringFields?.length) { + if (filteringFields?.length) { for (const filterObject of filteringFields) { const { field, criteria, value } = filterObject; const operators = { @@ -675,8 +671,6 @@ export class DataAccessObjectMysql extends BasicDataAccessObject implements IDat for await (const record of parser) { results.push(record); } - - try { await knex.transaction(async (trx) => { for (const row of results) { for (const column of timestampColumnNames) { @@ -690,9 +684,6 @@ export class DataAccessObjectMysql extends BasicDataAccessObject implements IDat await trx(tableName).insert(row); } }); - } catch (error) { - throw error; - } } public async executeRawQuery(query: string): Promise>> { @@ -761,7 +752,7 @@ export class DataAccessObjectMysql extends BasicDataAccessObject implements IDat databaseName: string, ): Promise { const fastCount = parseInt( - (await knex.raw(`SHOW TABLE STATUS IN ?? LIKE ?;`, [databaseName, tableName]))[0][0].Rows, + (await knex.raw(`SHOW TABLE STATUS IN ?? LIKE ?;`, [databaseName, tableName]))[0][0].Rows, 10 ); return fastCount; } diff --git a/shared-code/src/data-access-layer/data-access-objects/data-access-object-oracle.ts b/shared-code/src/data-access-layer/data-access-objects/data-access-object-oracle.ts index 27b76f96..9b5b43bd 100644 --- a/shared-code/src/data-access-layer/data-access-objects/data-access-object-oracle.ts +++ b/shared-code/src/data-access-layer/data-access-objects/data-access-object-oracle.ts @@ -16,7 +16,6 @@ import { objectKeysToLowercase } from '../../helpers/object-kyes-to-lowercase.js import { renameObjectKeyName } from '../../helpers/rename-object-keyname.js'; import { tableSettingsFieldValidator } from '../../helpers/validation/table-settings-validator.js'; import { AutocompleteFieldsDS } from '../shared/data-structures/autocomplete-fields.ds.js'; -import { ConnectionParams } from '../shared/data-structures/connections-params.ds.js'; import { FilteringFieldsDS } from '../shared/data-structures/filtering-fields.ds.js'; import { ForeignKeyDS } from '../shared/data-structures/foreign-key.ds.js'; import { FoundRowsDS } from '../shared/data-structures/found-rows.ds.js'; @@ -39,9 +38,6 @@ type RefererencedConstraint = { }; export class DataAccessObjectOracle extends BasicDataAccessObject implements IDataAccessObject { - constructor(connection: ConnectionParams) { - super(connection); - } public async addRowInTable( tableName: string, @@ -353,7 +349,7 @@ export class DataAccessObjectOracle extends BasicDataAccessObject implements IDa return { data: rows.map((row) => { - delete row['ROWNUM_']; + delete row.ROWNUM_; return row; }), pagination: { @@ -388,13 +384,13 @@ export class DataAccessObjectOracle extends BasicDataAccessObject implements IDa if (!fastCountQueryResult[0]) { return null; } - const fastCount = fastCountQueryResult[0]['NUM_ROWS']; + const fastCount = fastCountQueryResult[0].NUM_ROWS; return fastCount; } public async slowCountWithTimeOut(knex: Knex, tableName: string, tableSchema: string) { const count = (await knex(tableName).withSchema(tableSchema).count('*')) as any; - const rowsCount = parseInt(count[0]['COUNT(*)']); + const rowsCount = parseInt(count[0]['COUNT(*)'], 10); return rowsCount; } @@ -827,8 +823,6 @@ export class DataAccessObjectOracle extends BasicDataAccessObject implements IDa for await (const record of parser) { results.push(record); } - - try { await knex.transaction(async (trx) => { for (const row of results) { for (const column of timestampColumnNames) { @@ -841,9 +835,6 @@ export class DataAccessObjectOracle extends BasicDataAccessObject implements IDa await trx(tableName).withSchema(tableSchema).insert(row); } }); - } catch (error) { - throw error; - } } public async executeRawQuery(query: string): Promise>> { diff --git a/shared-code/src/data-access-layer/data-access-objects/data-access-object-postgres.ts b/shared-code/src/data-access-layer/data-access-objects/data-access-object-postgres.ts index 53ca9515..94b78ed0 100644 --- a/shared-code/src/data-access-layer/data-access-objects/data-access-object-postgres.ts +++ b/shared-code/src/data-access-layer/data-access-objects/data-access-object-postgres.ts @@ -8,7 +8,6 @@ import { ERROR_MESSAGES } from '../../helpers/errors/error-messages.js'; import { isPostgresDateOrTimeType, isPostgresDateStringByRegexp } from '../../helpers/is-database-date.js'; import { tableSettingsFieldValidator } from '../../helpers/validation/table-settings-validator.js'; import { AutocompleteFieldsDS } from '../shared/data-structures/autocomplete-fields.ds.js'; -import { ConnectionParams } from '../shared/data-structures/connections-params.ds.js'; import { FilteringFieldsDS } from '../shared/data-structures/filtering-fields.ds.js'; import { ForeignKeyDS } from '../shared/data-structures/foreign-key.ds.js'; import { FoundRowsDS } from '../shared/data-structures/found-rows.ds.js'; @@ -25,9 +24,6 @@ import { BasicDataAccessObject } from './basic-data-access-object.js'; import { nanoid } from 'nanoid'; export class DataAccessObjectPostgres extends BasicDataAccessObject implements IDataAccessObject { - constructor(connection: ConnectionParams) { - super(connection); - } public async addRowInTable( tableName: string, @@ -404,7 +400,7 @@ export class DataAccessObjectPostgres extends BasicDataAccessObject implements I customTypeInTableName, ); let enumLabelRows = []; - if (enumLabelQueryResult && enumLabelQueryResult.rows && enumLabelQueryResult.rows.length > 0) { + if (enumLabelQueryResult?.rows && enumLabelQueryResult.rows.length > 0) { enumLabelRows = enumLabelQueryResult.rows.map((el) => el.enumlabel); } if (enumLabelRows.length > 0) { @@ -696,8 +692,6 @@ export class DataAccessObjectPostgres extends BasicDataAccessObject implements I for await (const record of parser) { results.push(record); } - - try { await knex.transaction(async (trx) => { for (const row of results) { for (const column of timestampColumnNames) { @@ -712,9 +706,6 @@ export class DataAccessObjectPostgres extends BasicDataAccessObject implements I .insert(row); } }); - } catch (error) { - throw error; - } } public async executeRawQuery(query: string): Promise>> { @@ -767,7 +758,7 @@ export class DataAccessObjectPostgres extends BasicDataAccessObject implements I try { const count = (await countRowsQB.count('*')) as any; - const slowCount = parseInt(count[0].count); + const slowCount = parseInt(count[0].count, 10); resolve(slowCount); } catch (_error) { resolve(null); @@ -779,7 +770,7 @@ export class DataAccessObjectPostgres extends BasicDataAccessObject implements I const count = (await knex(tableName) .withSchema(this.connection.schema ?? 'public') .count('*')) as any; - const slowCount = parseInt(count[0].count); + const slowCount = parseInt(count[0].count, 10); return slowCount; } @@ -800,7 +791,7 @@ export class DataAccessObjectPostgres extends BasicDataAccessObject implements I WHERE oid = '??.??'::regclass;`, [tableSchema, tableName, tableSchema, tableName], ); - return parseInt(fastCount); + return parseInt(fastCount, 10); } private attachSchemaNameToTableName(tableName: string): string { diff --git a/shared-code/src/data-access-layer/data-access-objects/data-access-object-redis.ts b/shared-code/src/data-access-layer/data-access-objects/data-access-object-redis.ts index 22a94053..b035326a 100644 --- a/shared-code/src/data-access-layer/data-access-objects/data-access-object-redis.ts +++ b/shared-code/src/data-access-layer/data-access-objects/data-access-object-redis.ts @@ -40,9 +40,6 @@ interface RedisTableMetadata { } export class DataAccessObjectRedis extends BasicDataAccessObject implements IDataAccessObject { - constructor(connection: ConnectionParams) { - super(connection); - } public async addRowInTable( tableName: string, @@ -259,7 +256,6 @@ export class DataAccessObjectRedis extends BasicDataAccessObject implements IDat } } } catch (_error) { - continue; } } return results; @@ -436,7 +432,6 @@ export class DataAccessObjectRedis extends BasicDataAccessObject implements IDat results.push(row); } } catch (_error) { - continue; } } return results; @@ -633,7 +628,6 @@ export class DataAccessObjectRedis extends BasicDataAccessObject implements IDat const type = await redisClient.type(key); keyTypes.push({ key, type }); } catch (_error) { - continue; } } @@ -730,7 +724,6 @@ export class DataAccessObjectRedis extends BasicDataAccessObject implements IDat allRows.push(rowData); } } catch (_error) { - continue; } } } @@ -834,7 +827,6 @@ export class DataAccessObjectRedis extends BasicDataAccessObject implements IDat standaloneKeys.push({ key, type: keyType }); // } } catch (_error) { - continue; } } } @@ -959,7 +951,6 @@ export class DataAccessObjectRedis extends BasicDataAccessObject implements IDat fieldTypes.set('value', keyType); } } catch (_error) { - continue; } } @@ -1182,7 +1173,6 @@ export class DataAccessObjectRedis extends BasicDataAccessObject implements IDat const updatedRow = await this.updateRowInTable(tableName, newValues, primaryKey); results.push(updatedRow); } catch (_error) { - continue; } } @@ -1197,7 +1187,6 @@ export class DataAccessObjectRedis extends BasicDataAccessObject implements IDat await this.deleteRowInTable(tableName, primaryKey); deletedCount++; } catch (_error) { - continue; } } @@ -1277,15 +1266,11 @@ export class DataAccessObjectRedis extends BasicDataAccessObject implements IDat for await (const record of parser) { results.push(record); } - try { await Promise.allSettled( results.map(async (row) => { return await this.addRowInTable(tableName, row); }), ); - } catch (error) { - throw error; - } } public async executeRawQuery(query: string, _tableName: string): Promise>> { @@ -1387,7 +1372,6 @@ export class DataAccessObjectRedis extends BasicDataAccessObject implements IDat stringKeys.push(key); } } catch (_error) { - continue; } } @@ -1567,7 +1551,7 @@ export class DataAccessObjectRedis extends BasicDataAccessObject implements IDat if (shouldUseTLS) { socketConfig.tls = true; - socketConfig.rejectUnauthorized = this.connection.ssl === false ? false : true; + socketConfig.rejectUnauthorized = this.connection.ssl !==false; if (this.connection.cert) { socketConfig.ca = this.connection.cert; @@ -1602,7 +1586,7 @@ export class DataAccessObjectRedis extends BasicDataAccessObject implements IDat const connectionCopy = { ...connection }; return new Promise(async (resolve, reject): Promise => { const cachedTnl = LRUStorage.getTunnelCache(connectionCopy); - if (cachedTnl && cachedTnl.redis && cachedTnl.server && cachedTnl.client) { + if (cachedTnl?.redis && cachedTnl.server && cachedTnl.client) { resolve(cachedTnl.redis); return; } diff --git a/shared-code/src/helpers/check-field-autoincrement.ts b/shared-code/src/helpers/check-field-autoincrement.ts index 0cf3e780..a46db9d3 100644 --- a/shared-code/src/helpers/check-field-autoincrement.ts +++ b/shared-code/src/helpers/check-field-autoincrement.ts @@ -1,13 +1,13 @@ export function checkFieldAutoincrement(defaultValue: string, extra: string = ''): boolean { let result = false; if ( - (defaultValue !== null && defaultValue?.toLowerCase().includes('nextval')) || - (defaultValue !== null && defaultValue?.toLowerCase().includes('generate')) || - (defaultValue !== null && defaultValue?.toLowerCase().includes('autoincrement')) || - (defaultValue !== null && defaultValue?.toLowerCase().includes('auto_increment')) || - (defaultValue !== null && defaultValue?.toLowerCase().includes('sys_guid()')) || - (extra !== null && extra.toLowerCase().includes('auto_increment')) || - (extra !== null && extra.toLowerCase().includes('autoincrement')) + (defaultValue?.toLowerCase().includes('nextval')) || + (defaultValue?.toLowerCase().includes('generate')) || + (defaultValue?.toLowerCase().includes('autoincrement')) || + (defaultValue?.toLowerCase().includes('auto_increment')) || + (defaultValue?.toLowerCase().includes('sys_guid()')) || + (extra?.toLowerCase().includes('auto_increment')) || + (extra?.toLowerCase().includes('autoincrement')) ) { result = true; } diff --git a/shared-code/src/helpers/rename-object-keyname.ts b/shared-code/src/helpers/rename-object-keyname.ts index 33260706..da81012f 100644 --- a/shared-code/src/helpers/rename-object-keyname.ts +++ b/shared-code/src/helpers/rename-object-keyname.ts @@ -4,7 +4,7 @@ interface RenamableObject { } export function renameObjectKeyName(obj: RenamableObject, oldKey: string, newKey: string): void { - if (oldKey === newKey || !obj.hasOwnProperty(oldKey)) { + if (oldKey === newKey || !Object.hasOwn(obj, oldKey)) { return; } obj[newKey] = obj[oldKey]; diff --git a/shared-code/src/helpers/set-property-value.ts b/shared-code/src/helpers/set-property-value.ts index 9f503094..ca5abc1c 100644 --- a/shared-code/src/helpers/set-property-value.ts +++ b/shared-code/src/helpers/set-property-value.ts @@ -1,6 +1,5 @@ -export function setPropertyValue(obj: TObj, propName: keyof TObj, value: TVal): void { - if (Object.prototype.hasOwnProperty.call(obj, propName)) { - // eslint-disable-next-line security/detect-object-injection - (obj as any)[propName] = value; +export function setPropertyValue(obj: TObj, propName: keyof TObj, value: TObj[keyof TObj]): void { + if (Object.hasOwn(obj, propName)) { + obj[propName] = value; } } diff --git a/shared-code/src/knex-manager/knex-manager.ts b/shared-code/src/knex-manager/knex-manager.ts index e228497f..c011a8df 100644 --- a/shared-code/src/knex-manager/knex-manager.ts +++ b/shared-code/src/knex-manager/knex-manager.ts @@ -84,7 +84,7 @@ export class KnexManager { const connectionCopy = { ...connection }; return new Promise>(async (resolve, reject): Promise> => { const cachedTnl = LRUStorage.getTunnelCache(connectionCopy); - if (cachedTnl && cachedTnl.knex && cachedTnl.server && cachedTnl.client) { + if (cachedTnl?.knex && cachedTnl.server && cachedTnl.client) { resolve(cachedTnl.knex); return; }