Skip to content

A TypeError occurred when mocks BatchResponseContent via jest.spyOn() #514

@karamem0

Description

@karamem0

Bug Report

Prerequisites

  • Can you reproduce the problem?
  • Are you running the latest version?
  • Are you reporting to the correct repository?
  • Did you perform a cursory search?

For more information, see the CONTRIBUTING guide.

Description

Test failed when I upgraded SDK version from 2.2.1 to 3.0.0.

Console Errors: TypeError: Cannot redefine property: BatchResponseContent

Screenshots:
Screenshots

Steps to Reproduce

  1. Create a new project. npm init
  2. Install packages.
  1. Write a test script. index.test.ts
import * as microsoftGraph from '@microsoft/microsoft-graph-client';
it('test', () => {
    jest.spyOn(microsoftGraph, 'BatchResponseContent');
});

Expected behavior: Test passed.

Actual behavior: Test failed because cannot mock BatchResponseContent.

Additional Context

It works with @microsoft/[email protected]. Was it any changes?

Usage Information

Request ID - Value of the requestId field if you are receiving a Graph API error response

SDK Version - 3.0.0

  • Node (Check, if using Node version of SDK)

Node Version - 14.17.6

  • Browser (Check, if using Browser version of SDK)

Browser Name - [The name of Browser that you are using for SDK]

Version - [The version of the browser you are using]

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions