<commit_before>test('watcher/StyleSheetParser', [

  '../../lib/watcher/StyleSheetParser',
  '../../lib/core/Model',
  'lodash'

], function (runner) {

  var instance, _;

  runner.beforeEach(function () {
    instance = new runner.deps.StyleSheetParser();
    _ = runner.deps.lodash;
  });

  runner.afterEach(function () {
    instance.destroy();
  });

  runner.spec('parse (object model, string raw, object dependencies)', function () {

    runner.when('model is not a valid model', function () {

      runner.it('should throw an error', function () {

        var dependencies = new runner.deps.Model();
        expect(function () {
          instance.parse(null, 'foo', dependencies);
        }).to.throw(Error);
      });
    });

    runner.when('model is not a model, but without attributes.path', function () {

      runner.it('should throw an error', function () {

        var model = new runner.deps.Model();
        var dependencies = new runner.deps.Model();
        expect(function () {
          instance.parse(model, 'foo', dependencies);
        }).to.throw(Error);
      });
    });

    runner.when('raw does not contain an @import statement', function () {

      runner.it('should only add itself to the dependency graph', function (done) {

        var model = new runner.deps.Model({
          'path': 'foo/bar'
        });
        var dependencies = new runner.deps.Model();
        instance.parse(model, 'foo', dependencies);

        _.each(dependencies.attributes, function (arr, path) {
          if (path.indexOf('foo/bar') >= 0) {
            _.each(arr, function (dep) {
              if (dep.attributes.path.indexOf('foo/bar') >= 0) {
                done();
              }
            });
          }
        });
      });
    });

    runner.when('raw contains @import statements', function () {

      runner.when('the imported stylus file exists', function () {

        runner.it('should register the model as a node of the stylus file in the dependency graph');
      });

      runner.when('the imported stylus file does not exist', function () {

        runner.it('should throw error');<commit_msg>robustify<commit_after>test('watcher/StyleSheetParser', [

  '../../lib/watcher/StyleSheetParser',
  '../../lib/core/Model',
  'lodash'

], function (runner) {

  var instance, _;

  runner.beforeEach(function () {
    instance = new runner.deps.StyleSheetParser();
    _ = runner.deps.lodash;
  });

  runner.afterEach(function () {
    instance.destroy();
  });

  runner.spec('parse (object model, string raw, object dependencies)', function () {

    runner.when('model is not a model', function () {

      runner.it('should throw an error', function () {

        var dependencies = new runner.deps.Model();
        expect(function () {
          instance.parse(null, 'foo', dependencies);
        }).to.throw(Error);
      });
    });

    runner.when('model is a model, but without attributes.path', function () {

      runner.it('should throw an error', function () {

        var model = new runner.deps.Model();
        var dependencies = new runner.deps.Model();
        expect(function () {
          instance.parse(model, 'foo', dependencies);
        }).to.throw(Error);
      });
    });

    runner.when('raw does not contain an @import statement', function () {

      runner.it('should only add itself to the dependency graph', function (done) {

        var model = new runner.deps.Model({
          'path': 'foo/bar'
        });
        var dependencies = new runner.deps.Model();
        instance.parse(model, 'foo', dependencies);

        expect(_.keys(model.attributes).length).to.equal(1);

        _.each(dependencies.attributes, function (arr, path) {
          if (path.indexOf('foo/bar') >= 0) {

            expect(arr.length).to.equal(1);
            _.each(arr, function (dep) {
              if (dep.attributes.path.indexOf('foo/bar') >= 0) {
                done();
              }
            });
          }
        });
      });
    });

    runner.when('raw contains @import statements', function () {

      runner.when('the imported stylus file exists', function () {

        runner.it('should register the model as a node of the stylus file in the dependency graph');
      });

      runner.when('the imported stylus file does not exist', function () {

        runner.it('should throw error', function () {
          var model = new runner.deps.Model({
            'path': 'foo/bar'
          });
          var dependencies = new runner.deps.Model();
          expect(function () {
            instance.parse(model, '@import "notExisting.styl"', dependencies);
          }).to.throw(Error);
        });
{'fraction_non_alphanumeric': 0.15253515125692374, 'fraction_numerical': 0.0012782275244993609, 'mean_word_length': 2.2626824183460736, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6330467', 'n_tokens_mistral': 1322, 'n_tokens_neox': 1265, 'n_words': 322}