{"size": 1895, "ext": "js", "max_stars_repo_path": "packages/cml-js-parser/test/test.js", "max_stars_repo_name": "ReusLi/chameleon", "max_stars_repo_stars_event_min_datetime": "2019-11-07T14:05:06.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-07T14:05:06.000Z", "max_issues_repo_path": "packages/cml-js-parser/test/test.js", "max_issues_repo_name": "ReusLi/chameleon", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "packages/cml-js-parser/test/test.js", "max_forks_repo_name": "ReusLi/chameleon", "max_forks_repo_forks_event_min_datetime": "2020-03-06T07:26:06.000Z", "max_forks_repo_forks_event_max_datetime": "2020-03-06T07:26:06.000Z"}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 48.5897435897, "max_line_length": 183, "alphanum_fraction": 0.6432717678}
const path = require('path');
const chai = require('chai');
const expect = chai.expect;
const Parser = require('../index');

describe('parser check', function() {
  it('should pass export class check', function() {
    let parser = new Parser({filePath: path.resolve(__dirname, './docs/export-class.cml')});
    let results = parser.getParseResults();
    expect(results).to.have.deep.property('vars', ['propOne', 'propTwo', 'dataOne', 'dataTwo', 'computedOne', 'computedTwo'], 'failed at checking vars');
    expect(results).to.have.deep.property('methods', ['onTap', 'onClick'], 'failed on checking methods');
    expect(results).to.have.deep.property('props', [{
      name: 'propOne', valueType: 'Object', required: true, default: ''
    }, {
      name: 'propTwo', valueType: 'Boolean', required: false, default: true
    }], 'failed at checking props');
    expect(results).to.have.deep.property('events', [{
      name: 'eventOne', paramsNum: -1, params: []
    }]);
  });

  it('should pass export default check', function() {
    let parser = new Parser({filePath: path.resolve(__dirname, './docs/export-default.cml')});
    let results = parser.getParseResults();
    expect(results).to.have.deep.property('vars', ['propOne', 'propTwo', 'dataOne', 'dataTwo', 'computedOne', 'computedTwo', 'computedShow', 'getterHide'], 'failed at checking vars');
    expect(results).to.have.deep.property('methods', ['onTap', 'onClick'], 'failed on checking methods');
    expect(results).to.have.deep.property('props', [{
      name: 'propOne', valueType: 'Object', required: true, default: ''
    }, {
      name: 'propTwo', valueType: 'Boolean', required: false, default: true
    }], 'failed at checking props');
    expect(results).to.have.deep.property('events', [{
      name: 'eventOne', paramsNum: -1, params: []
    }, {
      name: 'topevent', paramsNum: -1, params: []
    }]);
  });
});
