{"size": 1236, "ext": "js", "max_stars_repo_path": "spec/index-spec.js", "max_stars_repo_name": "clm-a/autocomplete-tailwind", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "spec/index-spec.js", "max_issues_repo_name": "clm-a/autocomplete-tailwind", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "spec/index-spec.js", "max_forks_repo_name": "clm-a/autocomplete-tailwind", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 29.4285714286, "max_line_length": 81, "alphanum_fraction": 0.6707119741}
'use babel';

const path = require('path');

let module;

function setPathAndActivate(folder) {
  atom.project.setPaths([path.join(__dirname, 'fixtures', folder)]);
  waitsForPromise(() => atom.packages.activatePackage('autocomplete-tailwind') );
  runs(() => {
    module = atom.packages.getActivePackage('autocomplete-tailwind').mainModule;
  });
}

describe('project-tailwind', () => {
  it('detects tailwind project', function() {
    setPathAndActivate('project-tailwind');
    waitsForPromise(() => module.isTailwindListedAsDependency() );
    runs(() => {
      expect(module.getProvider().isTailwindProject).toBe(true);
    });
  });
});

describe('project-html', () => {
  it('does not detect tailwind project', function() {
    setPathAndActivate('project-html');
    waitsForPromise(() => module.isTailwindListedAsDependency() );
    runs(() => {
      expect(module.getProvider().isTailwindProject).toBe(false);
    });
  });

  it('does not detect tailwind project but activates anyway', function() {
    atom.config.set(`autocomplete-tailwind.isDisabledIfNotInPackageJson`, false);
    setPathAndActivate('project-html');
    runs(() => {
      expect(module.getProvider().isTailwindProject).toBe(true);
    });
  });
});
