Some checks failed
Node.js CI / build (push) Failing after 2s
Node.js CI / e2e-tests (+(a11y|security|bugs)/**/*cy.js) (push) Failing after 2s
Node.js CI / e2e-tests (features/**/!(o|d|m)*.cy.js) (push) Failing after 2s
Node.js CI / e2e-tests (features/**/+(o|d)*.cy.js) (push) Failing after 2s
Node.js CI / e2e-tests (features/**/m*.cy.js) (push) Failing after 2s
CodeQL / Analyze (javascript) (push) Failing after 2m49s
Security scan for docker image / build (push) Failing after 54s
46 lines
1.1 KiB
JavaScript
Executable File
46 lines
1.1 KiB
JavaScript
Executable File
import System from "core/system"
|
|
|
|
describe("wrapSelectors", () => {
|
|
it("should wrap correctly when registering multiple plugins targeting the same selector", function() {
|
|
const probeBase = {
|
|
statePlugins: {
|
|
probe: {
|
|
selectors: {
|
|
selectProbe: () => {
|
|
return "base"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
const probeWrap1 = {
|
|
statePlugins: {
|
|
probe: {
|
|
wrapSelectors: {
|
|
selectProbe: (oriSelector) => (state, ...args) => {
|
|
const selectedValue = oriSelector(state, ...args)
|
|
return `${selectedValue}wrap1`
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
const probeWrap2 = {
|
|
statePlugins: {
|
|
probe: {
|
|
wrapSelectors: {
|
|
selectProbe: (oriSelector) => (state, ...args) => {
|
|
const selectedValue = oriSelector(state, ...args)
|
|
return `${selectedValue}wrap2`
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
const system = new System({ plugins: [probeBase, probeWrap1, probeWrap2] })
|
|
|
|
expect(system.getSystem().probeSelectors.selectProbe()).toEqual("basewrap1wrap2")
|
|
})
|
|
})
|