eadparser
Version:
Parses ead files to JSON.
94 lines (83 loc) • 7.72 kB
JavaScript
const rewire = require('rewire')
const chai = require('chai')
const expect = chai.expect
const eadParser = rewire('../lib/eadParser')
const { sample } = require('../test/samples/sample')
describe('getSpecId()', () => {
const getSpecId = eadParser.__get__('getSpecId')
it('should return a spec id in the form of "SPEC.XXX.XXXX"', () => {
const specId = getSpecId(sample.ead)
expect(specId).to.be.a('string')
expect(specId).to.equal('SPEC.TRI.CSP')
})
})
describe('getSummaryInformation()', () => {
const getSummaryInformation = eadParser.__get__('getSummaryInformation')
it('should return an object with keys: title, specid, author, dates, extent, and abstract.', () => {
const summaryInformation = getSummaryInformation(sample.ead)
expect(summaryInformation).to.have.keys(['title','specId','author','dates','extent','abstract'])
expect(summaryInformation).to.be.an('object')
expect(summaryInformation.title).to.equal('Curtiss Show Print Records')
expect(summaryInformation.specId).to.equal('SPEC.TRI.CSP')
expect(summaryInformation.author).to.equal('Finding aid prepared by Zoe MacLeod')
expect(summaryInformation.dates[0]).to.have.keys(['dates'])
expect(summaryInformation.dates[0].dates).to.equal('circa 1910s-1973')
expect(summaryInformation.extent).to.have.keys(['extent','physicalDescription'])
expect(summaryInformation.extent.extent).to.equal('37.06 Cubic feet')
expect(summaryInformation.extent.physicalDescription).to.equal('(1422) artifacts; (78) oversize folders; (21) 5" letter document boxes; (16) oversize flat boxes; (15) cartons; (1) 5" legal document box')
expect(summaryInformation.abstract).to.have.keys(['_','id','label'])
expect(summaryInformation.abstract._).to.equal('Curtiss Show Print was a Ohio based print shop that catered to show business clients and specialized in items such as posters, letterheads, tickets, and broadsides for numerous touring vaudeville troupes. The majority of Curtiss\'s show printing was done between 1905 and mid 1940s. The Curtiss Show Print Records consist of print blocks, the letterpress work done by Curtiss for its show business clients, and the paperwork accompanying the print orders.')
expect(summaryInformation.abstract.id).to.have.members(['ref3032'])
expect(summaryInformation.abstract.label).to.have.members(['Abstract'])
})
})
describe('getBiographicalHistoricalNote()', () => {
const getBiographicalHistoricalNote = eadParser.__get__('getBiographicalHistoricalNote')
it('should return an object with keys: title, text.', () => {
const biographicalHistoricalNote = getBiographicalHistoricalNote(sample.ead)
expect(biographicalHistoricalNote).to.have.keys(['title','text'])
expect(biographicalHistoricalNote).to.be.an('object')
expect(biographicalHistoricalNote.title).to.equal('Historical Note')
expect(biographicalHistoricalNote.text).to.equal('Curtiss Show Print (also known as Curtiss Shoprint in its early days) began in Kalida, Ohio in 1905. Soon after its establishment, founder Bill Curtiss moved the printing business to nearby Continental, Ohio. It gained a reputation for its fast and excellent letterpress work, and specialized in items such as posters, letterhead, tickets, and broadsides for numerous touring vaudeville troupes. Many itinerant performers such as The Kinsey Komedy Kompany, Beers Barnes Circus, Skippy LaMore\'s Comedians, The Ginnivan Dramatic Company, J. C. Lincoln\'s Minstrel Troupe, Brownie\'s Comedians, and Uncle Tom\'s Cabin companies regularly ordered their advertising materials from Curtiss Show Print. The majority of Curtiss\'s show printing was done between 1905 and World War II.')
})
})
describe('getScopeAndContents()', () => {
const getScopeAndContents = eadParser.__get__('getScopeAndContents')
// TODO: test for complex strings
it('should return a string', () => {
const scopeAndContents = getScopeAndContents(sample.ead)
expect(scopeAndContents).to.be.a('string')
expect(scopeAndContents).to.equal('The Curtiss Show Print Records consists primarily of print blocks, the letterpress work done by Curtiss for its show business clients, and the paperwork accompanying the print orders. It contains posters, heralds, handbills, photographs, job tickets, correspondence, and printing blocks. Some of the companies and performers that are covered in the collection are the Kinsey Komedy Kompany, The Ginnivan Dramatic Company, Eddie Mason\'s Big Hoosier Country Store show, Beers-Barnes Circus, Woods\'s Chautauqua, and Bryant\'s Showboat, as well as several other circuses, minstrel companies, tent shows, vaudeville performers, and Uncle Tom\'s Cabin companies. Materials date between the 1910s and 1973, with the majority of the materials dating between the 1910s and 1940s.')
})
})
describe('getArrangementOfMaterials()', () => {
const getArrangementOfMaterials = eadParser.__get__('getArrangementOfMaterials')
it('should return a string', () => {
const arrangementOfMaterials = getArrangementOfMaterials(sample.ead)
expect(arrangementOfMaterials).to.be.a('string')
expect(arrangementOfMaterials).to.equal('The Curtiss Show Print Records are arranged into four series:')
})
})
describe('getAdministrativeInformation()', () => {
const getAdministrativeInformation = eadParser.__get__('getAdministrativeInformation')
it('should return an object with keys: publicationInformation, accessToMaterials, useOfMaterials, acquisitions, and processing.', () => {
const administrativeInformation = getAdministrativeInformation(sample.ead)
expect(administrativeInformation).to.have.keys(['publicationInformation','accessToMaterials','useOfMaterials','acquisitions','processing'])
expect(administrativeInformation).to.be.an('object')
expect(administrativeInformation.publicationInformation.address).to.have.members([ '1858 Neil Avenue', 'Columbus, OH, 43210' ])
expect(administrativeInformation.publicationInformation.date).to.equal('2018 January')
expect(administrativeInformation.publicationInformation.publisher).to.equal('Ohio State University Libraries Special Collections')
expect(administrativeInformation.accessToMaterials).to.equal('Materials in this collection are available for use, but may be used in the Thompson Library Special Collections reading room only.')
expect(administrativeInformation.useOfMaterials).to.equal('Materials in this collection may be protected by copyright, and are made available for research and educational purposes. In general, the OSU Libraries do not own the copyright for materials from our collections and cannot grant copyright permissions for these materials. The user is responsible for making a final determination of copyright status. If copyright protection applies, permission must be obtained from the copyright holder to reuse, publish, or reproduce the work beyond the bounds of fair use or other exceptions to the law. Works in the public domain are not protected by copyright and do not require permission to use.')
expect(administrativeInformation.acquisitions).to.equal('Donated by Nyle Stateler, 2006; Accession Number TRI.2017.0042: Nena Couch, 2017 April')
expect(administrativeInformation.processing).to.equal('Finding aid written by Zoe MacLeod, 2018 January')
})
})
describe('getCollectionRelatedMaterials()', () => {
const getCollectionRelatedMaterials = eadParser.__get__('getCollectionRelatedMaterials')
it('should return an empty object', () => {
const collectionRelatedMaterials = getCollectionRelatedMaterials(sample.ead)
expect(collectionRelatedMaterials).to.be.an('object')
expect(collectionRelatedMaterials).to.be.empty
})
})