{"size": 1079, "ext": "js", "max_stars_repo_path": "repos/docker-lib/src/image/__tests__/inspect.js", "max_stars_repo_name": "keg-hub/keg-cli", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "repos/docker-lib/src/image/__tests__/inspect.js", "max_issues_repo_name": "keg-hub/keg-cli", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "repos/docker-lib/src/image/__tests__/inspect.js", "max_forks_repo_name": "keg-hub/keg-cli", "max_forks_repo_forks_event_min_datetime": "2021-12-02T02:09:11.000Z", "max_forks_repo_forks_event_max_datetime": "2021-12-02T02:09:11.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 27.6666666667, "max_line_length": 70, "alphanum_fraction": 0.6339202966}
const { get } = require('@keg-hub/jsutils')
const { dockerCmds } = require('../../__mocks__')
const { inspect:inspectCmd } = dockerCmds

jest.setMock('../../cmds/inspect', { inspect: inspectCmd })

const { inspect } = require('../inspect')

describe('inspect', () => {

  afterAll(() => jest.resetAllMocks())

  afterEach(() => {
    inspectCmd.mockClear()
  })

  it('Should call the docker inspect command', async () => {
    expect(inspectCmd).not.toHaveBeenCalled()
    await inspect()
    expect(inspectCmd).toHaveBeenCalled()
  })

  it('Should set the type to image', async () => {
    await inspect()
    const noArgs = get(inspectCmd.mock, 'calls.0.0')
    expect(noArgs.type).toBe('image')

    await inspect({ type: 'test' })
    const argTypeTest = get(inspectCmd.mock, 'calls.1.0')
    expect(argTypeTest.type).toBe('image')
  })

  it('should all other arguments to the inspect method', async () => {
    await inspect({ testArg: 'I am a test arg' })
    const testArg = get(inspectCmd.mock, 'calls.0.0.testArg')
    expect(testArg).toBe('I am a test arg')
  })

})