"use strict";

var LibraryItem = require('./library-item');
describe('LibraryItem Model', function () {
  it('validate schema', function () {
    var bioLibraryItem = {
      _id: '5c743264fb6988562bba00e3',
      catalog: 'BIOLOGICAL',
      name: 'Drosophila bocki',
      tags: ['Invertebrates'],
      details: {
        materialType: 'Invertebrates',
        riskGroup: '1',
        category: 'Animals',
        knownPathogens: ''
      }
    };
    var libraryItem = new LibraryItem(bioLibraryItem);
    var validate = libraryItem.validate();
    expect(validate.valid).toBeTruthy();
  });
  it('library item object must have non empty tags attribute', function () {
    var bioLibraryItem = {
      _id: '5c743264fb6988562bba00e3',
      catalog: 'BIOLOGICAL',
      name: 'Drosophila bocki',
      tags: [],
      details: {
        materialType: 'Invertebrates',
        riskGroup: '1',
        category: 'Animals',
        knownPathogens: ''
      }
    };
    var libraryItem = new LibraryItem(bioLibraryItem);
    var validate = libraryItem.validate();
    expect(validate.valid).toBeFalsy();
  });
});