Skip to content

Conversation

@taeold
Copy link
Contributor

@taeold taeold commented Oct 4, 2021

Change allows users to pass app property in the mocked callable context, e.g.

export myFunc = functions.https.onCall((data, context) => {
  if (context.app == undefined) {
    throw new functions.https.HttpsError(
        'failed-precondition',
        'The function must be called from an App Check verified app.')
  }
});

Before

wrap(myFunc)('data', { app: { appId: 'my-app-123' }});
// => Options object {"auth":{"uid":""},"app":{}} has invalid key "app"

After

wrap(myFunc)('data', { app: { appId: 'my-app-123' }});
// no error

The diff on main.spec.ts looks terrible - I'm just adding a few test cases for callable functions, and indenting the ones that existed before.

Fixes #122

@taeold taeold requested review from colerogers and inlined October 4, 2021 22:07
@taeold taeold merged commit 1e3ac7c into master Oct 6, 2021
taeold added a commit that referenced this pull request Oct 6, 2021
taeold added a commit that referenced this pull request Oct 6, 2021
taeold added a commit that referenced this pull request Oct 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Impossible to test wrapped functions with App check

4 participants