0

I've got a strange error where during a test I need to combine two objects to use as the style of a component, replicating the logic of the component itself as per the code below.

var styles = { "height": 20 }
var expectedStyles = (Object as any).assign(styles, { "cursor": "pointer" });

However in the testing console this throws the following error: "TypeError: Cannot add property cursor, object is not extensible at Function.assign (anonymous)".

There are no errors in the website when using this component and it functions exactly as it should so this error only occurs in the testing and changing the function around to different variations such as (Object as any).assign({}, styles, { "cursor": "pointer" }); doesn't make any difference.

Also tried the suggestions here and here but no luck, any idea why this might error only in a testing environment?

James Morrison
  • 1,954
  • 2
  • 21
  • 48

1 Answers1

0

Most likely a bug, still an error when using Enzyme.mount() however Enzyme.shallow() works as expected

James Morrison
  • 1,954
  • 2
  • 21
  • 48