SolidJSS
SolidJSโ€ข3y agoโ€ข
13 replies
Michael P. Jung

Testing code without a render function

I was writing some utility functions using SolidJS primitives and ran into the issue that memos don't update. This is the minimal vitest where I could reproduce the issue:
test('memo', () => {
  createRoot(() => {
    const [signal, setSignal] = createSignal(false)
    const memo = createMemo(() => signal())
    expect(memo()).eq(false)
    setSignal(true)
    expect(memo()).eq(true)
  })
})

Am I missing something?
Was this page helpful?