<commit_before>describe('Spark', function() {
  describe('login', function() {

    describe('with access token', function() {
      it('callback', function() {
        Spark.login({accessToken: 'access_token'}, function(err, data) {
          expect(err).to.eq(null);
          expect(data.accessToken).to.eq('access_token');
          expect(Spark.ready()).to.eq(true);
        });
      });

      it('promise', function() {
        promise = Spark.login({accessToken: 'access_token'});
        return expect(promise).to.be.fulfilled;
      });
    });

    describe('with username/password', function() {
      var subject = function(callback) {
        return Spark.login({username: 'spark', password: '<PASSWORD>'}, callback);
      };
      var data = {accessToken: 'access_token'};

      shared.behavesLikeAPI('login', subject, data);

      it('sets accessToken correctly');

      it('is ready');
    });
  });

  describe('listDevices', function() {
    var subject = function(callback) {
      Spark.accessToken = 'token';
      return Spark.listDevices(callback);
    };
    var data = [{id: 'id', name: 'sparky'}];

    shared.behavesLikeAPI('listDevices', subject, data);

    it('sets devices correctly');
  });


  describe('createUser', function() {
    var subject = function(callback) {
      return Spark.createUser('<EMAIL>', 'pass', callback);
    };
    var data = {ok: true};

    it('promise', function() {
      promise = Spark.login({accessToken: 'access_token'});
      return expect(promise).to.be.fulfilled;
    });

    shared.behavesLikeAPI('createUser', subject, data);

    describe('with invalid username', function() {<commit_msg>Added beginning of getDevice test<commit_after>describe('Spark', function() {
  describe('login', function() {

    describe('with access token', function() {
      it('callback', function() {
        Spark.login({accessToken: 'access_token'}, function(err, data) {
          expect(err).to.eq(null);
          expect(data.accessToken).to.eq('access_token');
          expect(Spark.ready()).to.eq(true);
        });
      });

      it('promise', function() {
        promise = Spark.login({accessToken: 'access_token'});
        return expect(promise).to.be.fulfilled;
      });
    });

    describe('with username/password', function() {
      var subject = function(callback) {
        return Spark.login({username: 'spark', password: '<PASSWORD>'}, callback);
      };
      var data = {accessToken: 'access_token'};

      shared.behavesLikeAPI('login', subject, data);

      it('sets accessToken correctly');

      it('is ready');
    });
  });

  describe('listDevices', function() {
    var subject = function(callback) {
      Spark.accessToken = 'token';
      return Spark.listDevices(callback);
    };
    var data = [{id: 'id', name: 'sparky'}];

    shared.behavesLikeAPI('listDevices', subject, data);

    it('sets devices correctly');
  });

  describe.skip('getDevice', function() {
    var subject = function(callback) {
      Spark.accessToken = 'token';
      return Spark.getDevice(callback);
    };
    var data = {id: 'id', name: 'sparky'};

    shared.behavesLikeAPI('getDevice', subject, data);

    it('gets a device correctly');
  });

  describe('createUser', function() {
    var subject = function(callback) {
      return Spark.createUser('<EMAIL>', '<PASSWORD>', callback);
    };
    var data = {ok: true};

    it('promise', function() {
      promise = Spark.login({accessToken: 'access_token'});
      return expect(promise).to.be.fulfilled;
    });

    shared.behavesLikeAPI('createUser', subject, data);

    describe('with invalid username', function() {
{'fraction_non_alphanumeric': 0.171303873431533, 'fraction_numerical': 0.0, 'mean_word_length': 3.1670454545454545, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '5415855', 'n_tokens_mistral': 1106, 'n_tokens_neox': 1057, 'n_words': 218}