<commit_before>var assert = require('assert');
var client = require('../client');
var models = require('../../lib/models');

describe('Resource:', function() {

    describe('Association:', function() {

      describe('posts -> tags:', function() {

        it('should get the associated posts to tag "General" from its slug', function(done) {
          client.get('/tags/general/posts/', function(err, req, res, json) {
            assert.ifError(err);
            assert.equal(res.statusCode, 200);
            assert.equal(json.length, 3);
            done();
          });
        });

        it('should get the associated posts to tag "General" from its id', function(done) {
          client.get('/tags/2/posts/', function(err, req, res, json) {
            assert.ifError(err);
            assert.equal(res.statusCode, 200);
            assert.equal(json.length, 3);
            done();
          });
        });

        it('should return 404 for an non-existent tag"', function(done) {
          client.get('/tags/drugs/posts/', function(err, req, res, json) {
            assert.equal(res.statusCode, 404);
            done();
          });
        });

        it('should get the associated tags to post "A blog post about HipHop" from its slug', function(done) {
          client.get('/posts/4/tags/', function(err, req, res, json) {
            assert.ifError(err);
            assert.equal(res.statusCode, 200);
            assert.equal(json.length, 2);
            done();
          });
        });

        it('should log in', function(done) {
          client.post('/sessions/', {username: 'admin', password: '<PASSWORD>'}, function(err, req, res) {
            assert.equal(res.statusCode, 201);
            client.headers.cookie = res.headers['set-cookie'];
            done();
          });
        });

        it('should associate posts "A blog post about not publishing something" to tags "Programing" And "Music"', function(done) {
          client.post('/posts/6/tags/', {data: [{id: 1}, {id: 3}]}, function(err, req, res, json) {
            assert.ifError(err);
            assert.equal(res.statusCode, 201);
            assert.equal(json.count, 2);

            client.get('/posts/6/tags/', function(err, req, res, json) {
              assert.ifError(err);
              assert.equal(res.statusCode, 200);
              assert.equal(json.length, 2);
              done();
            });
          });
        });

      });

    });

});<commit_msg>Indentation<commit_after>var assert = require('assert');
var client = require('../client');
var models = require('../../lib/models');

describe('Resource:', function() {

  describe('Association:', function() {

    describe('posts -> tags:', function() {

      it('should get the associated posts to tag "General" from its slug', function(done) {
        client.get('/tags/general/posts/', function(err, req, res, json) {
          assert.ifError(err);
          assert.equal(res.statusCode, 200);
          assert.equal(json.length, 3);
          done();
        });
      });

      it('should get the associated posts to tag "General" from its id', function(done) {
        client.get('/tags/2/posts/', function(err, req, res, json) {
          assert.ifError(err);
          assert.equal(res.statusCode, 200);
          assert.equal(json.length, 3);
          done();
        });
      });

      it('should return 404 for an non-existent tag"', function(done) {
        client.get('/tags/drugs/posts/', function(err, req, res, json) {
          assert.equal(res.statusCode, 404);
          done();
        });
      });

      it('should get the associated tags to post "A blog post about HipHop" from its slug', function(done) {
        client.get('/posts/4/tags/', function(err, req, res, json) {
          assert.ifError(err);
          assert.equal(res.statusCode, 200);
          assert.equal(json.length, 2);
          done();
        });
      });

      it('should log in', function(done) {
        client.post('/sessions/', {username: 'admin', password: '<PASSWORD>'}, function(err, req, res) {
          assert.equal(res.statusCode, 201);
          client.headers.cookie = res.headers['set-cookie'];
          done();
        });
      });

      it('should associate posts "A blog post about not publishing something" to tags "Programing" And "Music"', function(done) {
        client.post('/posts/6/tags/', {data: [{id: 1}, {id: 3}]}, function(err, req, res, json) {
          assert.ifError(err);
          assert.equal(res.statusCode, 201);
          assert.equal(json.count, 2);

          client.get('/posts/6/tags/', function(err, req, res, json) {
            assert.ifError(err);
            assert.equal(res.statusCode, 200);
            assert.equal(json.length, 2);
            done();
          });
        });
      });

    });

  });

});
{'fraction_non_alphanumeric': 0.16817807089859851, 'fraction_numerical': 0.014427040395713108, 'mean_word_length': 2.0579710144927534, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6323269', 'n_tokens_mistral': 1463, 'n_tokens_neox': 1364, 'n_words': 328}