import {describe, expect, test, beforeEach} from "vitest";
import CaseOfUsersInService from '@useCases/CaseOfUsersInService.js'
import {serviceOfUsers, serviceOfServices, store} from './MockData.js'
import {appUser} from '@mocks/users.js'


describe('tests for caseOfUsersInService', () => {

  beforeEach( async() => {
    await store.dispatch('services/resetStore')
    await store.dispatch('users/resetStore')
  })

  const caseOfUsersInService = new CaseOfUsersInService(serviceOfUsers, serviceOfServices)

  test('init', () => {
    expect(caseOfUsersInService).toBeDefined()
  })

  test('fetchUsersByService', async () => {
    await caseOfUsersInService.fetchUsersByService()
    const storeUsers = store.getters['users/siteUsers']
    expect(storeUsers).toEqual([appUser])
  })

  // test('fetchUsersWithoutService', async () => {
  //   await caseOfUsersInService.fetchUsersWithoutService()
  //   const storeUsers = store.getters['users/usersWithoutSite']
  //   expect(storeUsers).toEqual([appUser])
  // })
})
