-
Notifications
You must be signed in to change notification settings - Fork 397
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(ssr): add tests for
@wire
errors (#4915)
- Loading branch information
1 parent
08ec091
commit 7e27944
Showing
42 changed files
with
215 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...rver/src/__tests__/fixtures/wire/errors/throws-when-computed-prop-is-expression/error.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
LWC1200: Computed property in @wire config must be a constant or primitive literal. |
Empty file.
3 changes: 3 additions & 0 deletions
3
...erver/src/__tests__/fixtures/wire/errors/throws-when-computed-prop-is-expression/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const tagName = 'x-wire'; | ||
export { default } from 'x/wire'; | ||
export * from 'x/wire'; |
13 changes: 13 additions & 0 deletions
13
...fixtures/wire/errors/throws-when-computed-prop-is-expression/modules/x/adapter/adapter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export class Adapter { | ||
constructor(dataCallback) { | ||
this.callback = dataCallback; | ||
} | ||
|
||
connect() {} | ||
|
||
update() { | ||
this.callback(true); | ||
} | ||
|
||
disconnect() {} | ||
} |
8 changes: 8 additions & 0 deletions
8
...sts__/fixtures/wire/errors/throws-when-computed-prop-is-expression/modules/x/wire/wire.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { wire, LightningElement } from "lwc"; | ||
import { Adapter } from "x/adapter"; | ||
const symbol = Symbol.for("key"); | ||
export default class Test extends LightningElement { | ||
// accidentally an array expression = oops! | ||
@wire(Adapter, { [[symbol]]: "$prop1", key2: ["fixed", "array"] }) | ||
wiredFoo; | ||
} |
1 change: 1 addition & 0 deletions
1
...er/src/__tests__/fixtures/wire/errors/throws-when-computed-prop-is-let-variable/error.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
LWC1200: Computed property in @wire config must be a constant or primitive literal. |
Empty file.
3 changes: 3 additions & 0 deletions
3
...ver/src/__tests__/fixtures/wire/errors/throws-when-computed-prop-is-let-variable/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const tagName = 'x-wire'; | ||
export { default } from 'x/wire'; | ||
export * from 'x/wire'; |
13 changes: 13 additions & 0 deletions
13
...xtures/wire/errors/throws-when-computed-prop-is-let-variable/modules/x/adapter/adapter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export class Adapter { | ||
constructor(dataCallback) { | ||
this.callback = dataCallback; | ||
} | ||
|
||
connect() {} | ||
|
||
update() { | ||
this.callback(true); | ||
} | ||
|
||
disconnect() {} | ||
} |
7 changes: 7 additions & 0 deletions
7
...s__/fixtures/wire/errors/throws-when-computed-prop-is-let-variable/modules/x/wire/wire.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { wire, LightningElement } from "lwc"; | ||
import { Adapter } from "x/adapter"; | ||
let key1 = 'key1' | ||
export default class Test extends LightningElement { | ||
@wire(Adapter, { [key1]: "$prop1", key2: ["fixed", "array"] }) | ||
wiredFoo; | ||
} |
1 change: 1 addition & 0 deletions
1
.../src/__tests__/fixtures/wire/errors/throws-when-computed-prop-is-regexp-literal/error.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
LWC1200: Computed property in @wire config must be a constant or primitive literal. |
Empty file.
3 changes: 3 additions & 0 deletions
3
...r/src/__tests__/fixtures/wire/errors/throws-when-computed-prop-is-regexp-literal/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const tagName = 'x-wire'; | ||
export { default } from 'x/wire'; | ||
export * from 'x/wire'; |
13 changes: 13 additions & 0 deletions
13
...ures/wire/errors/throws-when-computed-prop-is-regexp-literal/modules/x/adapter/adapter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export class Adapter { | ||
constructor(dataCallback) { | ||
this.callback = dataCallback; | ||
} | ||
|
||
connect() {} | ||
|
||
update() { | ||
this.callback(true); | ||
} | ||
|
||
disconnect() {} | ||
} |
6 changes: 6 additions & 0 deletions
6
..._/fixtures/wire/errors/throws-when-computed-prop-is-regexp-literal/modules/x/wire/wire.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { wire, LightningElement } from "lwc"; | ||
import { Adapter } from "x/adapter"; | ||
export default class Test extends LightningElement { | ||
@wire(Adapter, { [/key1/]: "$prop1", key2: ["fixed", "array"] }) | ||
wiredFoo; | ||
} |
1 change: 1 addition & 0 deletions
1
...rc/__tests__/fixtures/wire/errors/throws-when-computed-prop-is-template-literal/error.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
LWC1199: Cannot use a template literal as a computed property key. Instead, use a string or extract the value to a constant. |
Empty file.
3 changes: 3 additions & 0 deletions
3
...src/__tests__/fixtures/wire/errors/throws-when-computed-prop-is-template-literal/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const tagName = 'x-wire'; | ||
export { default } from 'x/wire'; | ||
export * from 'x/wire'; |
13 changes: 13 additions & 0 deletions
13
...es/wire/errors/throws-when-computed-prop-is-template-literal/modules/x/adapter/adapter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export class Adapter { | ||
constructor(dataCallback) { | ||
this.callback = dataCallback; | ||
} | ||
|
||
connect() {} | ||
|
||
update() { | ||
this.callback(true); | ||
} | ||
|
||
disconnect() {} | ||
} |
6 changes: 6 additions & 0 deletions
6
...fixtures/wire/errors/throws-when-computed-prop-is-template-literal/modules/x/wire/wire.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { wire, LightningElement } from "lwc"; | ||
import { Adapter } from "x/adapter"; | ||
export default class Test extends LightningElement { | ||
@wire(Adapter, { [`key1`]: "$prop1", key2: ["fixed", "array"] }) | ||
wiredFoo; | ||
} |
1 change: 1 addition & 0 deletions
1
...-server/src/__tests__/fixtures/wire/errors/throws-when-using-2-wired-decorators/error.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
LWC1105: Method or property can only have 1 @wire decorator |
Empty file.
3 changes: 3 additions & 0 deletions
3
...e-server/src/__tests__/fixtures/wire/errors/throws-when-using-2-wired-decorators/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const tagName = 'x-wire'; | ||
export { default } from 'x/wire'; | ||
export * from 'x/wire'; |
13 changes: 13 additions & 0 deletions
13
...__/fixtures/wire/errors/throws-when-using-2-wired-decorators/modules/x/adapter/adapter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export class Adapter { | ||
constructor(dataCallback) { | ||
this.callback = dataCallback; | ||
} | ||
|
||
connect() {} | ||
|
||
update() { | ||
this.callback(true); | ||
} | ||
|
||
disconnect() {} | ||
} |
7 changes: 7 additions & 0 deletions
7
..._tests__/fixtures/wire/errors/throws-when-using-2-wired-decorators/modules/x/wire/wire.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { wire, LightningElement } from "lwc"; | ||
import { Adapter } from "x/adapter"; | ||
export default class Test extends LightningElement { | ||
@wire(Adapter, { key1: "$prop1", key2: ["fixed", "array"] }) | ||
@wire(Adapter, { key1: "$prop1", key2: ["fixed", "array"] }) | ||
multipleWire; | ||
} |
1 change: 1 addition & 0 deletions
1
...c/__tests__/fixtures/wire/errors/throws-when-wired-method-is-combined-with-@api/error.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
LWC1095: @wire method or property cannot be used with @api |
Empty file.
3 changes: 3 additions & 0 deletions
3
...rc/__tests__/fixtures/wire/errors/throws-when-wired-method-is-combined-with-@api/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const tagName = 'x-wire'; | ||
export { default } from 'x/wire'; | ||
export * from 'x/wire'; |
13 changes: 13 additions & 0 deletions
13
...s/wire/errors/throws-when-wired-method-is-combined-with-@api/modules/x/adapter/adapter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export class Adapter { | ||
constructor(dataCallback) { | ||
this.callback = dataCallback; | ||
} | ||
|
||
connect() {} | ||
|
||
update() { | ||
this.callback(true); | ||
} | ||
|
||
disconnect() {} | ||
} |
7 changes: 7 additions & 0 deletions
7
...ixtures/wire/errors/throws-when-wired-method-is-combined-with-@api/modules/x/wire/wire.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { api, wire, LightningElement } from "lwc"; | ||
import { Adapter } from "x/adapter"; | ||
export default class Test extends LightningElement { | ||
@api | ||
@wire(Adapter, { key1: "$prop1", key2: ["fixed"] }) | ||
wiredWithApi() {} | ||
} |
1 change: 1 addition & 0 deletions
1
...__tests__/fixtures/wire/errors/throws-when-wired-property-is-combined-with-@api/error.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
LWC1095: @wire method or property cannot be used with @api |
Empty file.
3 changes: 3 additions & 0 deletions
3
.../__tests__/fixtures/wire/errors/throws-when-wired-property-is-combined-with-@api/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const tagName = 'x-wire'; | ||
export { default } from 'x/wire'; | ||
export * from 'x/wire'; |
13 changes: 13 additions & 0 deletions
13
...wire/errors/throws-when-wired-property-is-combined-with-@api/modules/x/adapter/adapter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export class Adapter { | ||
constructor(dataCallback) { | ||
this.callback = dataCallback; | ||
} | ||
|
||
connect() {} | ||
|
||
update() { | ||
this.callback(true); | ||
} | ||
|
||
disconnect() {} | ||
} |
7 changes: 7 additions & 0 deletions
7
...tures/wire/errors/throws-when-wired-property-is-combined-with-@api/modules/x/wire/wire.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { api, wire, LightningElement } from "lwc"; | ||
import { Adapter } from "x/adapter"; | ||
export default class Test extends LightningElement { | ||
@api | ||
@wire(Adapter, { key1: "$prop1", key2: ["fixed", "array"] }) | ||
wiredPropWithApi; | ||
} |
1 change: 1 addition & 0 deletions
1
...tests__/fixtures/wire/errors/throws-when-wired-property-is-combined-with-@track/error.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
LWC1095: @wire method or property cannot be used with @track |
Empty file.
3 changes: 3 additions & 0 deletions
3
..._tests__/fixtures/wire/errors/throws-when-wired-property-is-combined-with-@track/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const tagName = 'x-wire'; | ||
export { default } from 'x/wire'; | ||
export * from 'x/wire'; |
13 changes: 13 additions & 0 deletions
13
...re/errors/throws-when-wired-property-is-combined-with-@track/modules/x/adapter/adapter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export class Adapter { | ||
constructor(dataCallback) { | ||
this.callback = dataCallback; | ||
} | ||
|
||
connect() {} | ||
|
||
update() { | ||
this.callback(true); | ||
} | ||
|
||
disconnect() {} | ||
} |
7 changes: 7 additions & 0 deletions
7
...res/wire/errors/throws-when-wired-property-is-combined-with-@track/modules/x/wire/wire.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { track, wire, LightningElement } from "lwc"; | ||
import { Adapter } from "x/adapter"; | ||
export default class Test extends LightningElement { | ||
@track | ||
@wire(Adapter, { key1: "$prop1", key2: ["fixed", "array"] }) | ||
wiredWithTrack; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters