Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add uiGraphQLApi module #310

Merged
merged 3 commits into from
Apr 24, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) 2018, salesforce.com, inc.
scarrawaySF marked this conversation as resolved.
Show resolved Hide resolved
* 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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this required? errors: undefined. The default value for unset object keys is undefined

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really sure - but it's what our stub in lightning-components has

}

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();