From 494b4a18c97f393ac639c7bebd806e83725ac514 Mon Sep 17 00:00:00 2001 From: Stephen Carraway <57263085+scarrawaySF@users.noreply.github.com> Date: Mon, 24 Apr 2023 12:31:26 -0400 Subject: [PATCH] feat: add uiGraphQLApi module (#310) * feat: add uiGraphQLApi module * fix format * Update src/lightning-stubs/uiGraphQLApi/uiGraphQLApi.js Co-authored-by: Ravi Jayaramappa --------- Co-authored-by: Ravi Jayaramappa --- .../uiGraphQLApi/uiGraphQLApi.js | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/lightning-stubs/uiGraphQLApi/uiGraphQLApi.js 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();