Skip to content

Commit

Permalink
feat: backport GraphQL stub to summer23 (#316)
Browse files Browse the repository at this point in the history
* feat: add uiGraphQLApi module (#310)

* feat: add uiGraphQLApi module

* fix format

* Update src/lightning-stubs/uiGraphQLApi/uiGraphQLApi.js

Co-authored-by: Ravi Jayaramappa <ravi.jayaramappa@salesforce.com>

---------

Co-authored-by: Ravi Jayaramappa <ravi.jayaramappa@salesforce.com>

* fix: fix initial emit for GraphQL adapters (#315)

---------

Co-authored-by: Stephen Carraway <57263085+scarrawaySF@users.noreply.github.com>
Co-authored-by: Ravi Jayaramappa <ravi.jayaramappa@salesforce.com>
  • Loading branch information
3 people authored May 30, 2023
1 parent f6c1209 commit c657af2
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/lightning-stubs/uiGraphQLApi/uiGraphQLApi.js
Original file line number Diff line number Diff line change
@@ -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(undefined);
}
}

export const gql = jest.fn();
export const refreshGraphQL = jest.fn();

0 comments on commit c657af2

Please sign in to comment.