<commit_before>process.env.NODE_ENV = 'test'
var should = require('chai').should()
var sequelize = require('./init_seq');

var models = require('../model')(sequelize)

describe('Device', function() {
	 beforeEach(function(done){
        //clear out db
        models.Device.destroy().success(done).error(done);

         fakeDevice1 = {
            name            : '<NAME>'
            , status    : 'disconnected'
            ,platform : 'ios'
            ,deviceType : 'mobile'
            ,osVersion : 1
        };
        fakeDevice2 = {
            name            : '<NAME>'
            , status    : 'available'
            ,platform : 'ios'
            ,deviceType : 'mobile'
            ,osVersion : 1
        };
       
    });

	 it('should have required properties', function(done){
	 		var device =  models.Device.build(fakeDevice1);
            device.save().success(function(){
                device.should.have.property('name', '<NAME>');
                device.should.have.property('status', 'disconnected');
                done();
            }).error(function(error) {
			  done(error);
			});
     });

     it('isAvailable',function(done){
     	models.Device.bulkCreate([fakeDevice1,fakeDevice2]).success(function(devices) { 
     		devices.length.should.equal(2);
     		devices[0].isAvailable().should.be.false;
     		devices[1].isAvailable().should.be.true;
     		done();
     	}).error(done);
     });
});<commit_msg>added more test<commit_after>process.env.NODE_ENV = 'test'
var should = require('chai').should()
var sequelize = require('./init_seq');

var models = require('../model')(sequelize)

describe('Device', function() {
	 beforeEach(function(done){
        //clear out db
        models.Device.destroy().success(done).error(done);

         fakeDevice1 = {
            name            : '<NAME>'
            , status    : 'disconnected'
            ,platform : 'ios'
            ,deviceType : 'mobile'
            ,osVersion : 1
        };
        fakeDevice2 = {
            name            : '<NAME>'
            , status    : 'available'
            ,platform : 'ios'
            ,deviceType : 'mobile'
            ,osVersion : 1
        };
       
    });


	 it('should have required properties', function(done){
	 		var device =  models.Device.build(fakeDevice1);
            device.save().success(function(){
                device.should.have.property('name', '<NAME>');
                device.should.have.property('status', 'disconnected');
                done();
            }).error(function(error) {
			  done(error);
			});
     });
	 describe('class method',function(){
	 	beforeEach(function(done){
	 			models.Device.bulkCreate([fakeDevice1,fakeDevice2]).success(function(devices) { 
	 				done();
	 			}).error(done);
	 	});
	 	it('get all available devices',function(done){
	 		models.Device.availableDevices().success(function(devices){
	 			devices.length.should.equal(1);	
	 			devices[0].should.have.property('name', '<NAME>');
	 			done();
	 		}).error(done);
	 	});

	 	it('get all available devices count',function(done){
	 		models.Device.availableCount().success(function(count){
	 			count.should.equal(1);	
	 			done();
	 		}).error(done);
	 	});
	 });
	 describe('instance method',function(){
	     it('isAvailable',function(done){
	     	models.Device.bulkCreate([fakeDevice1,fakeDevice2]).success(function(devices) { 
	     		devices.length.should.equal(2);
	     		devices[0].isAvailable().should.be.false;
	     		devices[1].isAvailable().should.be.true;
	     		done();
	     	}).error(done);
	     });
	 });
});
{'fraction_non_alphanumeric': 0.16374269005847952, 'fraction_numerical': 0.006961849067112225, 'mean_word_length': 2.1647577092511012, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, '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': '195105', 'n_tokens_mistral': 1118, 'n_tokens_neox': 1021, 'n_words': 155}