diff --git a/src/lightning-stubs/uiGraphQLApi/uiGraphQLApi.js b/src/lightning-stubs/uiGraphQLApi/uiGraphQLApi.js new file mode 100644 index 00000000..a40b4304 --- /dev/null +++ b/src/lightning-stubs/uiGraphQLApi/uiGraphQLApi.js @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2023, salesforce.com, inc. + * All rights reserved. + * SPDX-License-Identifier: MIT + * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT + */ +import { createTestWireAdapter } from '@salesforce/wire-service-jest-util'; + +export class graphql extends createTestWireAdapter() { + static emit(value, filterFn) { + super.emit({ data: value, errors: undefined }, filterFn); + } + + static emitErrors(errors, filterFn) { + super.emit({ data: undefined, errors }, filterFn); + } + + constructor(dataCallback) { + super(dataCallback); + + graphql.emit({ data: undefined, errors: undefined }); + } +} + +export const gql = jest.fn(); +export const refreshGraphQL = jest.fn();