Skip to content

Commit

Permalink
feat: add uiGraphQLApi module (#310)
Browse files Browse the repository at this point in the history
* feat: add uiGraphQLApi module

* fix format

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

Co-authored-by: Ravi Jayaramappa <[email protected]>

---------

Co-authored-by: Ravi Jayaramappa <[email protected]>
  • Loading branch information
scarrawaySF and ravijayaramappa authored Apr 24, 2023
1 parent f6c1209 commit 494b4a1
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({ data: undefined, errors: undefined });
}
}

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

0 comments on commit 494b4a1

Please sign in to comment.