import { getFilterObjPath } from './getFilterObjPath'

describe('getFilterObjPath', () => {
  it("resolves to 'viewer' for the view page with no viewboxId (existing correct case)", () => {
    expect(getFilterObjPath('view', undefined)).toEqual('viewer')
  })

  it("resolves to 'editor' for the editor page with no viewboxId", () => {
    expect(getFilterObjPath('editor', undefined)).toEqual('editor')
  })

  it("resolves to 'editor' for the home page with no viewboxId (existing home/editor grouping)", () => {
    expect(getFilterObjPath('home', undefined)).toEqual('editor')
  })

  it("resolves to 'viewboxes.<id>' when viewboxId is set on the view page - the actual bug (previously returned 'viewer')", () => {
    expect(getFilterObjPath('view', 42)).toEqual('viewboxes.42')
  })

  it("resolves to 'viewboxes.<id>' when viewboxId is set on the editor page (already correct today)", () => {
    expect(getFilterObjPath('editor', 42)).toEqual('viewboxes.42')
  })

  it("resolves to 'viewboxes.<id>' when viewboxId is set on the home page (already correct today)", () => {
    expect(getFilterObjPath('home', 42)).toEqual('viewboxes.42')
  })

  it('resolves to an empty string for an unrecognized rootParam (matches existing fallthrough)', () => {
    expect(getFilterObjPath('', undefined)).toEqual('')
  })
})
