import DataProvider from "~/services/data/dataProvider";
import {useAccessesProvider} from "~/composables/data/useAccessesProvider";
jest.mock('~/services/data/dataProvider')

let useMyAccessesProviderMount:any
const dataproviderMock = DataProvider as jest.Mocked<typeof DataProvider>

beforeAll(() => {
  useMyAccessesProviderMount = useAccessesProvider(dataproviderMock.prototype)
})

describe('getPhysicalByFullName()', () => {
  it('should return [] if no research params', async () => {
    const result = await useMyAccessesProviderMount.getPhysicalByFullName()
    expect(result).toHaveLength(0)
  })

  it('should return an array of results if there is research param', async () => {
    dataproviderMock.prototype.invoke = jest.fn().mockReturnValue({data:['foo bar']})
    const result = await useMyAccessesProviderMount.getPhysicalByFullName('foo bar')
    expect(result).toStrictEqual(['foo bar'])
  })
})
