Skip to content

Commit c657af2

Browse files
mburr-salesforcescarrawaySFravijayaramappa
authored
feat: backport GraphQL stub to summer23 (#316)
* feat: add uiGraphQLApi module (#310) * 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]> * fix: fix initial emit for GraphQL adapters (#315) --------- Co-authored-by: Stephen Carraway <[email protected]> Co-authored-by: Ravi Jayaramappa <[email protected]>
1 parent f6c1209 commit c657af2

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright (c) 2023, salesforce.com, inc.
3+
* All rights reserved.
4+
* SPDX-License-Identifier: MIT
5+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6+
*/
7+
import { createTestWireAdapter } from '@salesforce/wire-service-jest-util';
8+
9+
export class graphql extends createTestWireAdapter() {
10+
static emit(value, filterFn) {
11+
super.emit({ data: value, errors: undefined }, filterFn);
12+
}
13+
14+
static emitErrors(errors, filterFn) {
15+
super.emit({ data: undefined, errors }, filterFn);
16+
}
17+
18+
constructor(dataCallback) {
19+
super(dataCallback);
20+
21+
graphql.emit(undefined);
22+
}
23+
}
24+
25+
export const gql = jest.fn();
26+
export const refreshGraphQL = jest.fn();

0 commit comments

Comments
 (0)