import Skypager from '../src'

describe('The Skypager Portfolio', function() {
  it('has a helpers registry', function() {
    Skypager.should.have.property('helpers')
      .that.is.an('object')
      .that.has.property('lookup')
  })

  it('has the skypager-project helpers by default', function() {
    Skypager.should.have.property('helpers')
      .that.is.an('object')
      .that.has.property('available')
      .that.is.an('array')

    Skypager.helpers.available.should.include('project-type')
  })

  it('can load projects', function() {
    const project = Skypager.load(process.cwd(), {
      sync: false,
    })
    
    should.exist(project)
    project.should.have.property('portfolio', Skypager)
    project.should.have.property('framework', Skypager.constructor)
  })

  it('caches the loading of projects', function() {
    const project = Skypager.load(process.cwd())
    Skypager.load(process.cwd()).should.have.property('instanceId', project.instanceId)
  })
})
