repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
aws-solutions/machine-to-cloud-connectivity-framework
source/ui/src/util/__test__/utils.getAmplifyConfiguration.test.ts
<reponame>aws-solutions/machine-to-cloud-connectivity-framework // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { AmplifyConfigurationInput } from '../types'; import { getAmplifyConfiguration } from '../utils'; test('Test getAmplifyConfiguration() fu...
aws-solutions/machine-to-cloud-connectivity-framework
source/ui/src/components/PageNotFound.tsx
<filename>source/ui/src/components/PageNotFound.tsx // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { I18n } from '@aws-amplify/core'; import Container from 'react-bootstrap/Container'; import Row from 'react-bootstrap/Row'; import Col from 'react-boo...
aws-solutions/machine-to-cloud-connectivity-framework
source/ui/src/views/__test__/Dashboard.test.tsx
<reponame>aws-solutions/machine-to-cloud-connectivity-framework // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { API } from '@aws-amplify/api'; import { I18n } from '@aws-amplify/core'; import { fireEvent, queryByAttribute, render, screen, waitFor } ...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/greengrass-deployer/test/connection-update.test.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { consoleErrorSpy, mockDynamoDbHandler, mockGreengrassV2Handler, mockIoTHandler, mockIoTSiteWiseHandler, mockValues, sendAnonymousMetricsSpy, sleepSpy } from './mock'; import { handler } ...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/lib/test/s3-handler.test.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { mockAwsS3 } from './mock'; import S3Handler from '../aws-handlers/s3-handler'; const body = 'mock-body'; const bodyResponse = { Body: body }; const contentType = 'text/plain'; const destinationBucket ...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/connection-builder/api-get-request.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import DynamoDBHandler from '../lib/aws-handlers/dynamodb-handler'; import GreengrassV2Handler from '../lib/aws-handlers/greengrass-v2-handler'; import { LambdaError } from '../lib/errors'; import { APIResponse...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/lib/test/dynamodb-handler.test.ts
<reponame>aws-solutions/machine-to-cloud-connectivity-framework // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { mockAwsDynamoDB } from './mock'; import DynamoDBHandler from '../aws-handlers/dynamodb-handler'; import { LambdaError } from '../errors';...
aws-solutions/machine-to-cloud-connectivity-framework
source/infrastructure/lib/data-flow/kinesis-data-stream.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { KinesisStreamsToKinesisFirehoseToS3 } from '@aws-solutions-constructs/aws-kinesisstreams-kinesisfirehose-s3'; import { Bucket } from 'aws-cdk-lib/aws-s3'; import { NagSuppressions } from 'cdk-nag'; imp...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/lib/aws-handlers/timestream-handler.ts
<reponame>aws-solutions/machine-to-cloud-connectivity-framework<filename>source/lambda/lib/aws-handlers/timestream-handler.ts // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import TimestreamWrite from 'aws-sdk/clients/timestreamwrite'; import Logger, { Logg...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/timestream-writer/test/jest-environment-variables.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 process.env.LOGGING_LEVEL = 'ERROR'; process.env.TIMESTREAM_DATABASE = 'mock-timestream-database'; process.env.TIMESTREAM_TABLE = 'mock-timestream-table';
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/lib/test/jest-environment-variables.ts
<filename>source/lambda/lib/test/jest-environment-variables.ts<gh_stars>1-10 // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 process.env = { ARTIFACT_BUCKET: 'mock-artifact-bucket', CONNECTION_DYNAMODB_TABLE: 'connection-table', GREENGRASS_CORE_DEVICES...
aws-solutions/machine-to-cloud-connectivity-framework
source/infrastructure/lib/backend/api.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { Aws, RemovalPolicy } from 'aws-cdk-lib'; import { AccessLogFormat, AuthorizationType, ContentHandling, Deployment, EndpointType, Integration, IntegrationProps, IntegrationType, LogGro...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/lib/utils.ts
<filename>source/lambda/lib/utils.ts // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import axios from 'axios'; import { customAlphabet } from 'nanoid'; import { LambdaError } from './errors'; import { AnonymousMetricData, AwsSdkOptions } from './types/utils...
aws-solutions/machine-to-cloud-connectivity-framework
source/ui/src/components/__test__/Header.test.tsx
<filename>source/ui/src/components/__test__/Header.test.tsx<gh_stars>1-10 // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { I18n } from '@aws-amplify/core'; import { render } from '@testing-library/react'; import { MemoryRouter } from 'react-router-do...
aws-solutions/machine-to-cloud-connectivity-framework
source/ui/src/util/__test__/validations.validateConnectionDefinition.test.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { I18n } from '@aws-amplify/core'; import { ConnectionControl, ConnectionDefinition, MachineProtocol, OpcDaDefinition, OpcUaDefinition } from '../types'; import { validateConnectionDefinition } from '../...
aws-solutions/machine-to-cloud-connectivity-framework
source/infrastructure/lib/frontend/ui.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { CloudFrontToS3 } from '@aws-solutions-constructs/aws-cloudfront-s3'; import { Aws, Duration, RemovalPolicy, Stack } from 'aws-cdk-lib'; import { CfnIdentityPool, CfnIdentityPoolRoleAttachment, Cf...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/lib/test/errors.test.ts
<reponame>aws-solutions/machine-to-cloud-connectivity-framework // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // PREPARE import { LambdaError } from '../errors'; test('Test to throw LambdaError with the default parameters', () => { try { throw new L...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/lib/types/greengrass-v2-handler-types.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { ConnectionControl, ConnectionDefinition, MachineProtocol } from './solution-common-types'; import { ComponentDependencyType, CoreDeviceStatus } from 'aws-sdk/clients/greengrassv2'; export { DeploymentS...
aws-solutions/machine-to-cloud-connectivity-framework
source/ui/src/views/__test__/OpcUaForm.test.tsx
<reponame>aws-solutions/machine-to-cloud-connectivity-framework // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { I18n } from '@aws-amplify/core'; import { render } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; im...
aws-solutions/machine-to-cloud-connectivity-framework
source/ui/src/views/connection/OpcUaForm.tsx
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { I18n } from '@aws-amplify/core'; import Form from 'react-bootstrap/Form'; import { FormProps } from '../../util/types'; /** * Renders the OPC UA form. * @param props The properties for the OPC UA fo...
aws-solutions/machine-to-cloud-connectivity-framework
source/infrastructure/test/machine-to-cloud-connectivity.test.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import '@aws-cdk/assert/jest'; import { SynthUtils } from '@aws-cdk/assert'; import { App } from 'aws-cdk-lib'; import { MachineToCloudConnectivityFrameworkStack } from '../lib/machine-to-cloud-connectivity-sta...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/custom-resource/test/general-custom-resources.test.ts
<filename>source/lambda/custom-resource/test/general-custom-resources.test.ts // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { buildResponseBody, consoleErrorSpy, mockAxios, mockIoTHandler, mockValues, sendAnonymousMetricsSpy } from './mo...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/lib/validations.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { LambdaError } from './errors'; import { GreengrassCoreDeviceControl, PostGreengrassRequestBodyInput } from './types/connection-builder-types'; import { CreatedBy } from './types/dynamodb-handler-types'...
aws-solutions/machine-to-cloud-connectivity-framework
source/ui/src/components/Loading.tsx
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import ProgressBar from 'react-bootstrap/ProgressBar'; import Spinner from 'react-bootstrap/Spinner'; import EmptyCol from './EmptyCol'; type LoadingProp = { loading: boolean; }; /** * Renders loading bar....
aws-solutions/machine-to-cloud-connectivity-framework
source/ui/src/views/connection/connection-form-utils.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { I18n } from '@aws-amplify/core'; import { requestApi } from '../../util/apis'; import { ConnectionControl, ConnectionDefinition, FormControlElement, GetConnectionResponse, KeyStringValue, M...
aws-solutions/machine-to-cloud-connectivity-framework
source/ui/src/util/__test__/validations.validateGreengrassCoreDeviceName.test.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { validateGreengrassCoreDeviceName } from '../validations'; test('Name is not string', () => { // eslint-disable-next-line @typescript-eslint/no-explicit-any expect(validateGreengrassCoreDeviceName(...
aws-solutions/machine-to-cloud-connectivity-framework
source/ui/src/views/greengrass/greengrass-core-device-form-utils.ts
<filename>source/ui/src/views/greengrass/greengrass-core-device-form-utils.ts<gh_stars>1-10 // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import React from 'react'; import { CreatedBy, FormControlElement, GreengrassCoreDeviceDomIds, UserGreengrassCoreDevic...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/lib/types/message-consumer-types.ts
<reponame>aws-solutions/machine-to-cloud-connectivity-framework<gh_stars>1-10 // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { LogType } from './solution-common-types'; export interface EventMessage { Records: SqsRecord[]; } export interface SqsR...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/timestream-writer/test/mock.ts
<reponame>aws-solutions/machine-to-cloud-connectivity-framework // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 export const mockTimestreamHandler = { write: jest.fn() }; jest.mock('../../lib/aws-handlers/timestream-handler', () => jest.fn(() => ({ ...mock...
aws-solutions/machine-to-cloud-connectivity-framework
source/ui/src/views/__test__/GreengrassCoreDeviceForm.test.tsx
<gh_stars>1-10 // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { API } from '@aws-amplify/api'; import { I18n } from '@aws-amplify/core'; import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; imp...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/timestream-writer/index.ts
<gh_stars>1-10 // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import TimestreamWrite from 'aws-sdk/clients/timestreamwrite'; import TimestreamHandler from '../lib/aws-handlers/timestream-handler'; import { LambdaError } from '../lib/errors'; import Logger, ...
aws-solutions/machine-to-cloud-connectivity-framework
source/ui/src/components/__test__/MessageModal.test.tsx
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import '@testing-library/jest-dom/extend-expect'; import { I18n } from '@aws-amplify/core'; import { fireEvent, queryByAttribute, render, screen, waitFor } from '@testing-library/react'; import MessageModal fro...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/lib/test/utils.test.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { mockAxios, mockNanoId, UPPER_ALPHA_NUMERIC } from './mock'; import { LambdaError } from '../errors'; import { ConnectionControl } from '../types/solution-common-types'; import { getAwsSdkOptions, g...
aws-solutions/machine-to-cloud-connectivity-framework
source/infrastructure/lib/common-resource/common-resources.ts
<reponame>aws-solutions/machine-to-cloud-connectivity-framework<gh_stars>1-10 // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { ArnFormat, RemovalPolicy, Stack } from 'aws-cdk-lib'; import { AnyPrincipal, Effect, PolicyDocument, PolicyStatement } from...
aws-solutions/machine-to-cloud-connectivity-framework
source/infrastructure/lib/data-flow/timestream.ts
<filename>source/infrastructure/lib/data-flow/timestream.ts<gh_stars>1-10 // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { KinesisStreamsToLambda } from '@aws-solutions-constructs/aws-kinesisstreams-lambda'; import { CfnCondition, CfnDeletionPolicy, ...
aws-solutions/machine-to-cloud-connectivity-framework
source/infrastructure/test/common-resources.test.ts
<reponame>aws-solutions/machine-to-cloud-connectivity-framework // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import '@aws-cdk/assert/jest'; import { SynthUtils } from '@aws-cdk/assert'; import { Stack } from 'aws-cdk-lib'; import { CommonResourcesConstruc...
aws-solutions/machine-to-cloud-connectivity-framework
source/ui/src/util/__test__/utils.copyObject.test.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { copyObject } from '../utils'; type UnknownRecord = Record<string, unknown>; type UnknownArrayRecord = Record<string, unknown[]>; test('Test copyObject() function', () => { expect(copyObject({})).to...
aws-solutions/machine-to-cloud-connectivity-framework
source/ui/src/views/greengrass/GreengrassCoreDeviceForm.tsx
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { I18n, Logger } from '@aws-amplify/core'; import React, { FormEvent, useState } from 'react'; import Alert from 'react-bootstrap/Alert'; import Button from 'react-bootstrap/Button'; import ButtonGroup f...
aws-solutions/machine-to-cloud-connectivity-framework
source/ui/src/util/__test__/apis.test.ts
<filename>source/ui/src/util/__test__/apis.test.ts // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { API } from '@aws-amplify/api'; import { requestApi } from '../apis'; import { API_NAME } from '../utils'; const mockAPI = { get: jest.fn(), post:...
aws-solutions/machine-to-cloud-connectivity-framework
source/ui/src/util/__test__/utils.copyArray.test.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { copyArray } from '../utils'; test('Test copyArray() function', () => { expect(copyArray([])).toEqual([]); // eslint-disable-next-line @typescript-eslint/no-explicit-any expect(() => copyArray('i...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/greengrass-deployer/test/invalid-inputs.test.ts
<reponame>aws-solutions/machine-to-cloud-connectivity-framework<gh_stars>1-10 // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { mockDynamoDbHandler, mockValues } from './mock'; import { handler } from '../index'; import { LambdaError } from '../../lib...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/lib/errors.ts
<filename>source/lambda/lib/errors.ts // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 interface ErrorInput { message: string; name?: string; statusCode?: number; } /** * `LambdaError` to throw when an error happens on the Lambda functions * @param e...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/timestream-writer/test/index.test.ts
<filename>source/lambda/timestream-writer/test/index.test.ts // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { consoleErrorSpy, mockTimestreamHandler } from './mock'; import { handler, parseToTimestream } from '../index'; import { LambdaError } from '...
aws-solutions/machine-to-cloud-connectivity-framework
source/ui/src/util/__test__/utils.getErrorMessage.test.ts
<gh_stars>1-10 // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { getErrorMessage } from '../utils'; test('Test to return `error.response.data.errorMessage`', () => { const errorMessage = 'Error from error.response.data.errorMessage'; const error ...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/lib/types/solution-common-types.ts
<filename>source/lambda/lib/types/solution-common-types.ts<gh_stars>1-10 // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { CapabilityConfigurationSource } from './iot-sitewise-handler-types'; export enum ConnectionControl { DEPLOY = 'deploy', STA...
aws-solutions/machine-to-cloud-connectivity-framework
source/infrastructure/test/greengrass.test.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import '@aws-cdk/assert/jest'; import { SynthUtils } from '@aws-cdk/assert'; import { Stack } from 'aws-cdk-lib'; import { Bucket, CfnBucket } from 'aws-cdk-lib/aws-s3'; import { GreengrassConstruct } from '../...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/lib/aws-handlers/lambda-handler.ts
<gh_stars>1-10 // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import Lambda from 'aws-sdk/clients/lambda'; import { LambdaError } from '../errors'; import Logger, { LoggingLevel } from '../logger'; import { ConnectionDefinition } from '../types/solution-com...
aws-solutions/machine-to-cloud-connectivity-framework
source/ui/src/views/connection/Dashboard.tsx
<filename>source/ui/src/views/connection/Dashboard.tsx // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { I18n, Logger } from '@aws-amplify/core'; import { useState } from 'react'; import Alert from 'react-bootstrap/Alert'; import Breadcrumb from 'reac...
aws-solutions/machine-to-cloud-connectivity-framework
source/infrastructure/lib/backend/connection-builder.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { LambdaToDynamoDB } from '@aws-solutions-constructs/aws-lambda-dynamodb'; import { ArnFormat, CfnDeletionPolicy, Duration, Fn, Stack } from 'aws-cdk-lib'; import { AttributeType, BillingMode, CfnTable, ...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/lib/test/validations-greengrass-core-device.test.ts
<gh_stars>1-10 // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // PREPARE import { LambdaError } from '../errors'; import { GreengrassCoreDeviceControl } from '../types/connection-builder-types'; import { CreatedBy } from '../types/dynamodb-handler-types'; i...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/lib/types/connection-builder-types.ts
<filename>source/lambda/lib/types/connection-builder-types.ts // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { CreatedBy, GetConnectionResponse, GetConnectionsResponse, GetGreengrassCoreDevicesResponse, GetLogsResponse } from './dynamodb-ha...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/lib/types/utils-types.ts
<gh_stars>1-10 // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { GreengrassCoreDeviceEventTypes } from './connection-builder-types'; import { StackEventTypes } from './custom-resource-types'; import { CreatedBy } from './dynamodb-handler-types'; impor...
aws-solutions/machine-to-cloud-connectivity-framework
source/ui/src/components/__test__/Loading.test.tsx
<filename>source/ui/src/components/__test__/Loading.test.tsx // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { render } from '@testing-library/react'; import { LoadingProgressBar, LoadingSpinner } from '../Loading'; test('renders the loading bar comp...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/lib/aws-handlers/iot-handler.ts
<reponame>aws-solutions/machine-to-cloud-connectivity-framework // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import Iot from 'aws-sdk/clients/iot'; import IotData from 'aws-sdk/clients/iotdata'; import Logger, { LoggingLevel } from '../logger'; import { I...
aws-solutions/machine-to-cloud-connectivity-framework
source/ui/src/util/Types.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import React from 'react'; export type ErrorMessage = { errorMessage: string }; export type FormControlElement = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement; export type KeyStringValue = Record<...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/connection-builder/index.ts
<reponame>aws-solutions/machine-to-cloud-connectivity-framework<filename>source/lambda/connection-builder/index.ts // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { handleGetRequest } from './api-get-request'; import { handlePostRequest } from './api-...
aws-solutions/machine-to-cloud-connectivity-framework
source/ui/src/views/connection/ConnectionLogsModal.tsx
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { I18n } from '@aws-amplify/core'; import { useState } from 'react'; import Button from 'react-bootstrap/Button'; import Col from 'react-bootstrap/Col'; import Form from 'react-bootstrap/Form'; import Ju...
aws-solutions/machine-to-cloud-connectivity-framework
source/ui/src/views/__test__/ConnectionForm.test.tsx
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { API } from '@aws-amplify/api'; import { I18n } from '@aws-amplify/core'; import { queryByAttribute, render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; ...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/lib/types/index.ts
<gh_stars>1-10 // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 export * as ConnectionBuilderTypes from './connection-builder-types'; export * as CustomResourceTypes from './custom-resource-types'; export * as DynamoDBHandlerTypes from './dynamodb-handler-typ...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/custom-resource/test/mock.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import fs from 'fs'; import { CustomResourceResponse, EventRequest, LambdaContext, RequestTypes, ResourceTypes } from '../../lib/types/custom-resource-types'; import * as utils from '../../lib/utils';...
aws-solutions/machine-to-cloud-connectivity-framework
source/infrastructure/test/connection-builder.test.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import '@aws-cdk/assert/jest'; import { SynthUtils } from '@aws-cdk/assert'; import { Stack } from 'aws-cdk-lib'; import { Effect, PolicyDocument, PolicyStatement } from 'aws-cdk-lib/aws-iam'; import { Bucket }...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/greengrass-deployer/test/deployment-status.test.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { consoleErrorSpy, mockDynamoDbHandler, mockGreengrassV2Handler, mockIoTHandler, mockIoTSiteWiseHandler, mockValues, sendAnonymousMetricsSpy, sleepSpy } from './mock'; import { handler } ...
aws-solutions/machine-to-cloud-connectivity-framework
source/ui/src/views/connection/OpcDaForm.tsx
<gh_stars>1-10 // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { I18n } from '@aws-amplify/core'; import Card from 'react-bootstrap/Card'; import Form from 'react-bootstrap/Form'; import { FormProps } from '../../util/types'; /** * Renders the OPC D...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/sqs-message-consumer/test/index.test.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { consoleErrorSpy, consoleWarnSpy, mockBatchWrite } from './mock'; import { handler } from '../index'; import { BatchPutRequest, EventMessage, SqsRecord } from '../../lib/types/message-consumer-types'; i...
aws-solutions/machine-to-cloud-connectivity-framework
source/infrastructure/test/ui.test.ts
<reponame>aws-solutions/machine-to-cloud-connectivity-framework<filename>source/infrastructure/test/ui.test.ts<gh_stars>1-10 // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import '@aws-cdk/assert/jest'; import { SynthUtils } from '@aws-cdk/assert'; import {...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/sqs-message-consumer/test/jest-environment-variables.ts
<filename>source/lambda/sqs-message-consumer/test/jest-environment-variables.ts // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 process.env.LOGGING_LEVEL = 'WARN'; process.env.LOGS_DYNAMODB_TABLE = 'mock-logs-table';
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/lib/test/iot-handler.test.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import Iot from 'aws-sdk/clients/iot'; import { mockAwsIoT, mockAwsIoTData } from './mock'; import IoTHandler from '../aws-handlers/iot-handler'; import { IoTMessageTypes } from '../types/iot-handler-types'; d...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/lib/test/greengrass-v2-handler.test.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { mockAwsGreengrassV2 } from './mock'; import { GreengrassV2ComponentBuilder } from '../aws-handlers/greengrass-v2-component-builder'; import GreengrassV2Handler from '../aws-handlers/greengrass-v2-handl...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/connection-builder/test/api-post-greengrass-request.test.ts
<filename>source/lambda/connection-builder/test/api-post-greengrass-request.test.ts // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { consoleErrorSpy, mockDynamoDbHandler, mockGreengrassV2Handler, mockIoTHandler, mockIoTSiteWiseHandler, mo...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/custom-resource/test/ui-custom-resource.test.ts
<filename>source/lambda/custom-resource/test/ui-custom-resource.test.ts // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { buildResponseBody, mockAxios, mockS3Handler, mockValues } from './mock'; import { handler } from '../index'; import { CopyUiAss...
aws-solutions/machine-to-cloud-connectivity-framework
source/infrastructure/test/api.test.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import '@aws-cdk/assert/jest'; import { SynthUtils } from '@aws-cdk/assert'; import { Stack } from 'aws-cdk-lib'; import { Code, Function as LambdaFunction, Runtime } from 'aws-cdk-lib/aws-lambda'; import { Buc...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/lib/aws-handlers/greengrass-v2-handler.ts
<gh_stars>1-10 // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import GreengrassV2, { ComponentDeploymentSpecifications, CreateComponentVersionResponse, CreateDeploymentResponse } from 'aws-sdk/clients/greengrassv2'; import { GreengrassV2ComponentBuild...
aws-solutions/machine-to-cloud-connectivity-framework
source/ui/src/util/__test__/utils.signOut.test.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import Auth from '@aws-amplify/auth'; import { Logger } from '@aws-amplify/core'; import { signOut } from '../utils'; const { location } = window; const authSpy = jest.spyOn(Auth, 'signOut'); const loggerSpy =...
aws-solutions/machine-to-cloud-connectivity-framework
source/infrastructure/test/timestream.test.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import '@aws-cdk/assert/jest'; import { SynthUtils } from '@aws-cdk/assert'; import { CfnCondition, Stack } from 'aws-cdk-lib'; import { Template } from 'aws-cdk-lib/assertions'; import { Bucket } from 'aws-cdk...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/connection-builder/test/api-get-request.test.ts
<reponame>aws-solutions/machine-to-cloud-connectivity-framework // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { consoleErrorSpy, mockDynamoDbHandler, mockGreengrassV2Handler, mockValue } from './mock'; import { handler } from '../index'; describe('...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/lib/aws-handlers/dynamodb-handler.ts
<reponame>aws-solutions/machine-to-cloud-connectivity-framework<filename>source/lambda/lib/aws-handlers/dynamodb-handler.ts // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { DocumentClient } from 'aws-sdk/clients/dynamodb'; import { LambdaError } from...
aws-solutions/machine-to-cloud-connectivity-framework
source/lambda/greengrass-deployer/test/connection-delete.test.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { consoleErrorSpy, mockDynamoDbHandler, mockGreengrassV2Handler, mockIoTHandler, mockIoTSiteWiseHandler, mockValues, sendAnonymousMetricsSpy, sleepSpy } from './mock'; import { handler } ...
aws-solutions/machine-to-cloud-connectivity-framework
source/ui/src/util/__test__/utils.buildConnectionDefinition.test.ts
<gh_stars>1-10 // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { ConnectionControl, ConnectionDefinition, MachineProtocol } from '../types'; import { buildConnectionDefinition } from '../utils'; const params: ConnectionDefinition = { control: Conne...
aws-solutions/machine-to-cloud-connectivity-framework
source/ui/src/util/apis.ts
<reponame>aws-solutions/machine-to-cloud-connectivity-framework // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { API } from '@aws-amplify/api'; import { ApiProps } from './types'; import { API_NAME } from './utils'; /** * Requests API to the backen...
Calvin-LL/webpack-image-resize-loader
test/unit/getFormat.test.ts
<filename>test/unit/getFormat.test.ts import getFormat from "../../src/helpers/getFormat"; it("should parse png format", () => { expect(getFormat("image.png")).toBe("png"); expect(getFormat("image.PNG")).toBe("png"); }); it("should parse jpeg format", () => { expect(getFormat("image.JPG")).toBe("jpeg"); expec...
Calvin-LL/webpack-image-resize-loader
test/e2e/format-option.test.ts
<gh_stars>10-100 import { toMatchImageSnapshot } from "jest-image-snapshot"; import WIRLWebpackTestCompiler from "./helpers/WIRLWebpackTestCompiler"; expect.extend({ toMatchImageSnapshot }); describe.each([4, 5] as const)('v%d "format" option', (webpackVersion) => { it("should work with jpeg", async () => { co...
Calvin-LL/webpack-image-resize-loader
test/e2e/validate-options.test.ts
import webpack from "webpack"; import WIRLWebpackTestCompiler from "./helpers/WIRLWebpackTestCompiler"; describe.each([4, 5] as const)("v%d validate options", (webpackVersion) => { const tests = { width: { success: [10], failure: [true, 0, 0.1], }, height: { success: [10], failur...
robertoachar/docker-mean
frontend/src/app/users/user-form/user-form.component.ts
<reponame>robertoachar/docker-mean<gh_stars>1-10 import { Component, Input } from '@angular/core'; import { IUser } from '../user.interface'; @Component({ selector: 'app-user-form', templateUrl: 'user-form.component.html' }) export class UserFormComponent { @Input() user: IUser = {} as any; }
robertoachar/docker-mean
frontend/src/app/core/modal/modal.service.ts
<gh_stars>1-10 import { Injectable } from '@angular/core'; declare var $: any; @Injectable() export class ModalService { hide(id: String): void { this.modal(id, 'hide'); } show(id: String): void { this.modal(id, 'show'); } private modal(id: String, action: String): void { const component: Stri...
robertoachar/docker-mean
frontend/src/app/users/user.interface.ts
export interface IUser { _id: string; firstname: string; lastname: string; }
robertoachar/docker-mean
frontend/src/app/users/user.service.ts
import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { environment } from '../../environments/environment'; import { IUser } from './user.interface'; import { Observable } from 'rxjs/Observable'; @Injectable() export class UserService { constructor(private http: Http...
robertoachar/docker-mean
frontend/src/app/core/core.module.ts
import { NgModule } from '@angular/core'; import { MessageService } from './message.service'; import { ModalService } from './modal/modal.service'; import { ModalComponent } from './modal/modal.component'; @NgModule({ imports: [], exports: [ModalComponent], declarations: [ModalComponent], providers: [MessageS...
robertoachar/docker-mean
frontend/src/app/app.routing.ts
import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { PageNotFoundComponent } from './page-not-found.component'; import { UserListComponent } from './users/user-list/user-list.component'; import { UserFormComponent } from './users/user-form/user-form.component'; co...
robertoachar/docker-mean
frontend/src/app/core/modal/modal.component.ts
import { Component, EventEmitter, Input, Output } from '@angular/core'; @Component({ selector: 'app-modal', templateUrl: 'modal.component.html' }) export class ModalComponent { @Input() unique: string = undefined; @Input() title: string = undefined; @Output() onCancel: EventEmitter<any> = new EventEmitter()...
robertoachar/docker-mean
frontend/src/app/core/message.service.ts
import { Injectable } from '@angular/core'; declare var toastr: any; @Injectable() export class MessageService { options: any = { closeButton: true, positionClass: 'toast-bottom-center', progressBar: true, timeOut: '3000' }; error(message: string): void { toastr.error(message, 'Error', this...
robertoachar/docker-mean
frontend/src/app/users/user.module.ts
import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { RouterModule } from '@angular/router'; import { CoreModule } from '../core/core.module'; import { UserService } from './user.service'; import { UserFormComponent } from './us...
robertoachar/docker-mean
frontend/src/app/users/user-list/user-list.component.ts
import { Component, OnInit } from '@angular/core'; import { IUser } from '../user.interface'; import { UserService } from '../user.service'; import { ModalService } from '../../core/modal/modal.service'; import { MessageService } from '../../core/message.service'; @Component({ templateUrl: 'user-list.component.html...
patrickkempff/react-native-template-tuil
template/src/app/components/example/index.tsx
<reponame>patrickkempff/react-native-template-tuil /** * Sample React Native App * https://github.com/facebook/react-native * * Generated with the TypeScript template * https://github.com/patrickkempff/react-native-template-tuil * * @format */ import React, { Component } from 'react' import { StyleSheet, View,...
patrickkempff/react-native-template-tuil
template/src/domains/example/welcome.spec.tsx
import 'react-native' import React from 'react' import Welcome from './welcome' // Note: test renderer must be required after react-native. import renderer from 'react-test-renderer' it('renders correctly', () => { renderer.create(<Welcome />) })
patrickkempff/react-native-template-tuil
template/src/app/root.tsx
<reponame>patrickkempff/react-native-template-tuil import React, { Component } from 'react' import Welcome from '@domains/example/welcome' export default class Root extends Component { render() { return <Welcome /> } }
patrickkempff/react-native-template-tuil
template/src/app/utils/example/index.ts
<reponame>patrickkempff/react-native-template-tuil /* This is an example test please check the ./mock/jest on how to mock a specific module for jest unit testing */ //@ts-ignore for non existing mocked module import weatherProvider from 'weather' export default function IsItRaining(): boolean { return weatherProvide...
patrickkempff/react-native-template-tuil
template/jest/mock.ts
/* This is the file where you can mock specific modules for jest testing */ export default {} jest.mock( 'weather', () => ({ doesItRain: jest.fn().mockReturnValue(true) }), { virtual: true } )
patrickkempff/react-native-template-tuil
template/src/app/utils/example/index.spec.ts
import IsItRaining from './index' describe('test the does it rain functionality', () => { it('should return true', () => { let result = IsItRaining() expect(result).toBe(true) }) })
gz65555/engine-1
packages/core/src/Camera.ts
import { BoundingFrustum, MathUtil, Matrix, Ray, Vector2, Vector3, Vector4 } from "@oasis-engine/math"; import { Logger } from "./base"; import { deepClone, ignoreClone } from "./clone/CloneManager"; import { Component } from "./Component"; import { dependencies } from "./ComponentsDependencies"; import { Entity } from...
gz65555/engine-1
packages/core/src/shader/ShaderProgram.ts
import { Vector2, Vector3, Vector4 } from "@oasis-engine/math"; import { Logger } from "../base/Logger"; import { Camera } from "../Camera"; import { Engine } from "../Engine"; import { Material } from "../material/Material"; import { Renderer } from "../Renderer"; import { IHardwareRenderer } from "../renderingHardwar...