<commit_before>/**
 * @license
 * Copyright (c) 2017 Google Inc. All rights reserved.
 * This code may only be used under the BSD style license found at
 * http://polymer.github.io/LICENSE.txt
 * Code distributed by Google as part of this project is also
 * subject to an additional IP rights grant found at
 * http://polymer.github.io/PATENTS.txt
 */

const assert = require('chai').assert;
const Loader = require('../loader.js');
const Manifest = require('../manifest.js');

describe('schema', function() {

  it('schemas load recursively', async function() {
    let manifest = await Manifest.load('../entities/Product.manifest', new Loader());
    let schema = manifest.findSchemaByName('Product');
    assert.deepEqual(schema.normative, {name: 'Text'});
    assert.deepEqual(schema.optional, {description: 'Text', image: 'URL', category: 'Text', price: 'Text', seller: 'Text', shipDays: 'Text'});
    assert.equal(schema.name, "Product");
    assert.equal(schema.parent.name, "Thing");
  });

  it('constructs an appropriate entity subclass', async function() {
    let manifest = await Manifest.load('../entities/Product.manifest', new Loader());
    let schema = manifest.findSchemaByName('Product');
    var Product = schema.entityClass();
    assert.equal(Product.name, "Product");
    var product = new Product({name: "Pickled Chicken Sandwich", description: "A sandwich with pickles and chicken"});
    assert(product instanceof Product);
    assert.equal(product.name, "Pickled Chicken Sandwich");
    assert.equal(product.description, "A sandwich with pickles and chicken");
    assert.equal(product.image, undefined);
  })
});
<commit_msg>fix goldfile schema test The addition of the 'url' element was expected<commit_after>/**
 * @license
 * Copyright (c) 2017 Google Inc. All rights reserved.
 * This code may only be used under the BSD style license found at
 * http://polymer.github.io/LICENSE.txt
 * Code distributed by Google as part of this project is also
 * subject to an additional IP rights grant found at
 * http://polymer.github.io/PATENTS.txt
 */

const assert = require('chai').assert;
const Loader = require('../loader.js');
const Manifest = require('../manifest.js');

describe('schema', function() {

  it('schemas load recursively', async function() {
    let manifest = await Manifest.load('../entities/Product.manifest', new Loader());
    let schema = manifest.findSchemaByName('Product');
    assert.deepEqual(schema.normative, {name: 'Text'});
    assert.deepEqual(schema.optional, {description: 'Text', image: 'URL', category: 'Text', price: 'Text', seller: 'Text', shipDays: 'Text', url: 'URL'});
    assert.equal(schema.name, "Product");
    assert.equal(schema.parent.name, "Thing");
  });

  it('constructs an appropriate entity subclass', async function() {
    let manifest = await Manifest.load('../entities/Product.manifest', new Loader());
    let schema = manifest.findSchemaByName('Product');
    var Product = schema.entityClass();
    assert.equal(Product.name, "Product");
    var product = new Product({name: "Pickled Chicken Sandwich", description: "A sandwich with pickles and chicken"});
    assert(product instanceof Product);
    assert.equal(product.name, "Pickled Chicken Sandwich");
    assert.equal(product.description, "A sandwich with pickles and chicken");
    assert.equal(product.image, undefined);
  })
});

{'fraction_non_alphanumeric': 0.14632701421800948, 'fraction_numerical': 0.002369668246445498, 'mean_word_length': 4.482142857142857, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7193513', 'n_tokens_mistral': 956, 'n_tokens_neox': 919, 'n_words': 295}