{"size": 847, "ext": "js", "max_stars_repo_path": "test/test.js", "max_stars_repo_name": "AtuelGL/fdk-aac.js", "max_stars_repo_stars_event_min_datetime": "2019-07-08T13:47:56.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T19:15:47.000Z", "max_issues_repo_path": "test/test.js", "max_issues_repo_name": "AtuelGL/fdk-aac.js", "max_issues_repo_issues_event_min_datetime": "2021-03-17T12:07:20.000Z", "max_issues_repo_issues_event_max_datetime": "2021-12-03T22:06:24.000Z", "max_forks_repo_path": "test/test.js", "max_forks_repo_name": "AtuelGL/fdk-aac.js", "max_forks_repo_forks_event_min_datetime": "2020-04-07T15:11:37.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-17T03:47:32.000Z"}
{"max_stars_count": 21, "max_issues_count": 2, "max_forks_count": 3, "avg_line_length": 24.2, "max_line_length": 60, "alphanum_fraction": 0.572609209}
var expect = require('chai').expect
var fs = require('fs')
var path = require('path')
var aac = require('../fdk-aac')

var testDataPath = path.join(__dirname, 'test.wav')
var testData = new Uint8Array(fs.readFileSync(testDataPath))

describe('fdk-aac', function() {
  it('should encode test file to AAC', function(done) {
    aac(testData, function (err, out) {
      if (err != null) return done(err)
      try {
        expect(out.length).to.be.above(0)
        expect(out).to.be.an.instanceof(Uint8Array)
        done()
      } catch (e) {
        done(e)
      }
    })
  })

  it('should fail on an empty file', function(done) {
    aac(new Uint8Array(), function (err) {
      try {
        expect(err).to.be.an.instanceof(Error)
        expect(err.status).to.eql(1)
        done()
      } catch (e) {
        done(e)
      }
    })
  })
})
