Skip to content

Sharing Variables in Nested Describes #5741

Closed Answered by tallpaul-embark
tallpaul-embark asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks @sheremet-va and @hi-ogawa for your answers. I think what I needed to wrap my head around was the spying was not just for looking an incoming values or if a function was called, but also for mocking values.

I know this is not a great set of tests. I just was playing with how can I get different mocked values back from

import * as authentication from 'services/auth';
import { describe, expect, it, vi, beforeEach } from 'vitest';

describe('urqlAuth', () => {
  describe('Given on page load that a user is authenticated', () => {
    const mockJwtPayload = { sub: 'userUuid', exp: 1715049540 };
    const mockToken = 'mockToken';

    beforeEach(() => {
      vi.spyOn(authentication, 'va…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@tallpaul-embark
Comment options

Comment options

You must be logged in to vote
1 reply
@tallpaul-embark
Comment options

Comment options

You must be logged in to vote
1 reply
@sheremet-va
Comment options

Answer selected by tallpaul-embark
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants