<commit_before>/**
 * assemble <https://github.com/assemble/assemble>
 *
 * Copyright (c) 2014, <NAME>, <NAME>, contributors.
 * Licensed under the MIT License (MIT).
 */

'use strict';

var fs = require('graceful-fs');
var path = require('path');
var should = require('should');
var File = require('vinyl');
var rimraf = require('rimraf');
var assemble = require('..');

var actual = __dirname + '/layouts-actual';


describe('assemble layouts', function () {
  var site = null;
  beforeEach(function (done) {
    site = assemble.createInst();
    rimraf(actual, done);
  });
  afterEach(function (done) {
    rimraf(actual, done);
  });

  describe('.layout()', function () {
    it('should be a method on site.', function () {
      site.layout.should.be.a.function;
    });

    it('should cache a layout defined as an object.', function () {
      site.layout({
        path: 'test-layout-a',
        data: {title: 'test-layout-a'},
        content: 'Test layout A content',
        ext: '.hbs'
      });

      var layouts = site.cache.layouts;
      layouts.should.have.property('test-layout-a');
    });
  });

  describe('.layouts()', function () {
    it('should be a method on site.', function () {
      site.layouts.should.be.a.function;
    });

    xit('should return an empty array..', function () {
      site.layouts().should.be.empty;
    });

    xit('should cache an array of layouts defined as objects.', function () {
      site.layouts([
        {
          name: 'test-layout-a',
          data: {title: 'test-layout-a'},
          content: 'Test layout A content',
          ext: '.hbs'
        },
        {
          name: 'test-layout-b',
          data: {title: 'test-layout-b'},
          content: 'Test layout B content',
          ext: '.hbs'
        },
        {
          name: 'test-layout-c',
          data: {title: 'test-layout-c'},
          content: 'Test layout C content',
          ext: '.hbs'
        }
      ]);

      var layouts = site.cache.layouts;
      layouts.should.have.property('test-layout-a');
      layouts.should.have.property('test-layout-b');
      layouts.should.have.property('test-layout-c');
    });

    it('should cache an object of layouts defined as objects.', function () {
      site.layouts({
        'test-layout-a': {
          data: {title: 'test-layout-a'},
          content: 'Test layout A content',
          ext: '.hbs'
        },
        'test-layout-b': {
          data: {title: 'test-layout-b'},
          content: 'Test layout B content',
          ext: '.hbs'
        },
        'test-layout-c': {
          data: {title: 'test-layout-c'},
          content: 'Test layout C content',
          ext: '.hbs'
        }
      });

      var layouts = site.cache.layouts;
      layouts.should.have.property('test-layout-a');
      layouts.should.have.property('test-layout-b');
      layouts.should.have.property('test-layout-c');
    });

    it('should cache an object of layouts defined as a string of glob patterns.', function () {
      site.layouts('test/fixtures/templates/layouts/*.hbs');

      var layouts = site.cache.layouts;
      layouts.should.have.property('a.hbs');
      layouts.should.have.property('b.hbs');
      layouts.should.have.property('c.hbs');
    });
  });
});
<commit_msg>layouts test<commit_after>/**
 * assemble <https://github.com/assemble/assemble>
 *
 * Copyright (c) 2014, <NAME>, <NAME>, contributors.
 * Licensed under the MIT License (MIT).
 */

'use strict';

var fs = require('graceful-fs');
var path = require('path');
var should = require('should');
var File = require('vinyl');
var rimraf = require('rimraf');
var assemble = require('..');

var actual = __dirname + '/layouts-actual';


describe('assemble layouts', function () {
  var site = null;
  beforeEach(function (done) {
    site = assemble.createInst();
    rimraf(actual, done);
  });
  afterEach(function (done) {
    rimraf(actual, done);
  });

  describe('.layout()', function () {
    it('should be a method on site.', function () {
      site.layout.should.be.a.function;
    });

    it('should cache a layout defined as an object.', function () {
      site.layout({
        path: 'test-layout-a',
        data: {title: 'test-layout-a'},
        content: 'Test layout A content',
        ext: '.hbs'
      });

      var layouts = site.cache.layouts;
      layouts.should.have.property('test-layout-a');
    });
  });

  describe('.layouts()', function () {
    it('should be a method on site.', function () {
      site.layouts.should.be.a.function;
    });

    it('should return an empty array..', function () {
      site.cache.layouts.should.be.empty;
    });

    it('should cache an object of layouts defined as objects.', function () {
      site.layouts({
        'test-layout-a': {
          data: {title: 'test-layout-a'},
          content: 'Test layout A content',
          ext: '.hbs'
        },
        'test-layout-b': {
          data: {title: 'test-layout-b'},
          content: 'Test layout B content',
          ext: '.hbs'
        },
        'test-layout-c': {
          data: {title: 'test-layout-c'},
          content: 'Test layout C content',
          ext: '.hbs'
        }
      });

      var layouts = site.cache.layouts;
      layouts.should.have.property('test-layout-a');
      layouts.should.have.property('test-layout-b');
      layouts.should.have.property('test-layout-c');
    });

    it('should cache an object of layouts defined as a string of glob patterns.', function () {
      site.layouts('test/fixtures/templates/layouts/*.hbs');

      var layouts = site.cache.layouts;
      layouts.should.have.property('a.hbs');
      layouts.should.have.property('b.hbs');
      layouts.should.have.property('c.hbs');
    });
  });
});

{'fraction_non_alphanumeric': 0.1721865788104734, 'fraction_numerical': 0.001387203051846714, 'mean_word_length': 2.3054441260744984, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 2, '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': '1648768', 'n_tokens_mistral': 1815, 'n_tokens_neox': 1758, 'n_words': 412}