From 7f09e2c6407b16bd53084d65820f44d0cb6a210c Mon Sep 17 00:00:00 2001 From: Matheus Cardoso Date: Tue, 21 Jan 2025 18:35:01 -0300 Subject: [PATCH] test(lwc1097): @wire expects a function identifier as first parameter (#5147) --- .../actual.js | 4 ++++ .../error.json | 10 ++++++++++ .../expected.js | 0 3 files changed, 14 insertions(+) create mode 100644 packages/@lwc/babel-plugin-component/src/__tests__/fixtures/wire-decorator/decorator-expects-a-function-identifier-as-first-parameter/actual.js create mode 100644 packages/@lwc/babel-plugin-component/src/__tests__/fixtures/wire-decorator/decorator-expects-a-function-identifier-as-first-parameter/error.json create mode 100644 packages/@lwc/babel-plugin-component/src/__tests__/fixtures/wire-decorator/decorator-expects-a-function-identifier-as-first-parameter/expected.js diff --git a/packages/@lwc/babel-plugin-component/src/__tests__/fixtures/wire-decorator/decorator-expects-a-function-identifier-as-first-parameter/actual.js b/packages/@lwc/babel-plugin-component/src/__tests__/fixtures/wire-decorator/decorator-expects-a-function-identifier-as-first-parameter/actual.js new file mode 100644 index 0000000000..3dd1ab0245 --- /dev/null +++ b/packages/@lwc/babel-plugin-component/src/__tests__/fixtures/wire-decorator/decorator-expects-a-function-identifier-as-first-parameter/actual.js @@ -0,0 +1,4 @@ +import { wire, LightningElement } from "lwc"; +export default class Test extends LightningElement { + @wire(function adapter() {}, {}) wiredProp; +} diff --git a/packages/@lwc/babel-plugin-component/src/__tests__/fixtures/wire-decorator/decorator-expects-a-function-identifier-as-first-parameter/error.json b/packages/@lwc/babel-plugin-component/src/__tests__/fixtures/wire-decorator/decorator-expects-a-function-identifier-as-first-parameter/error.json new file mode 100644 index 0000000000..c4bf85e529 --- /dev/null +++ b/packages/@lwc/babel-plugin-component/src/__tests__/fixtures/wire-decorator/decorator-expects-a-function-identifier-as-first-parameter/error.json @@ -0,0 +1,10 @@ +{ + "message": "LWC1097: @wire expects a function identifier as first parameter.", + "loc": { + "line": 3, + "column": 8, + "start": 107, + "length": 21 + }, + "filename": "test.js" +} \ No newline at end of file diff --git a/packages/@lwc/babel-plugin-component/src/__tests__/fixtures/wire-decorator/decorator-expects-a-function-identifier-as-first-parameter/expected.js b/packages/@lwc/babel-plugin-component/src/__tests__/fixtures/wire-decorator/decorator-expects-a-function-identifier-as-first-parameter/expected.js new file mode 100644 index 0000000000..e69de29bb2