invalid-lhs-in-assignment.js 393 B

123456789101112
  1. test("assignment to function call", () => {
  2. expect(() => {
  3. function foo() {}
  4. foo() = "foo";
  5. }).toThrowWithMessage(ReferenceError, "Invalid left-hand side in assignment");
  6. });
  7. test("assignment to inline function call", () => {
  8. expect(() => {
  9. (function () {})() = "foo";
  10. }).toThrowWithMessage(ReferenceError, "Invalid left-hand side in assignment");
  11. });