Skip to content
This repository has been archived by the owner on Nov 26, 2020. It is now read-only.

Commit

Permalink
Loads BF Item Profile and tests for resourceTemplates in BIBFRAME 2.0…
Browse files Browse the repository at this point in the history
… Item Profile

Fixes #49

Loads BF Item Profile and tests for resourceTemplates in
BIBFRAME 2.0 Item Profile

Fixes: #49
  • Loading branch information
jermnelson committed Oct 5, 2018
1 parent c1e4948 commit b18dd3c
Show file tree
Hide file tree
Showing 3 changed files with 313 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ source/documentation/
source/node_modules/
source/coverage/
static-analysis
junit.xml
274 changes: 274 additions & 0 deletions source/__tests__/__fixtures__/item.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,274 @@
{
"Profile": {
"resourceTemplates": [
{
"propertyTemplates": [
{
"mandatory": "false",
"repeatable": "true",
"type": "resource",
"resourceTemplates": [],
"valueConstraint": {
"valueTemplateRefs": [
"profile:bf2:Identifiers:Barcode"
],
"useValuesFrom": [],
"valueDataType": {}
},
"propertyURI": "http://id.loc.gov/ontologies/bibframe/identifiedBy",
"propertyLabel": "Barcode"
},
{
"mandatory": "false",
"repeatable": "true",
"type": "resource",
"resourceTemplates": [],
"valueConstraint": {
"valueTemplateRefs": [
"profile:bf2:Identifiers:LC",
"profile:bf2:Identifiers:DDC",
"profile:bf2:Identifiers:Shelfmark"
],
"useValuesFrom": [],
"valueDataType": {}
},
"propertyURI": "http://id.loc.gov/ontologies/bibframe/identifiedBy",
"propertyLabel": "Call numbers"
},
{
"mandatory": "false",
"repeatable": "true",
"type": "literal",
"resourceTemplates": [],
"valueConstraint": {
"valueTemplateRefs": [],
"useValuesFrom": [],
"valueDataType": {}
},
"propertyURI": "http://id.loc.gov/ontologies/bibframe/enumerationAndChronology",
"propertyLabel": "Enumeration and chronology"
},
{
"mandatory": "true",
"repeatable": "true",
"type": "resource",
"resourceTemplates": [],
"valueConstraint": {
"valueTemplateRefs": [],
"useValuesFrom": [],
"valueDataType": {
"dataTypeURI": "http://id.loc.gov/ontologies/bibframe/Agent"
},
"defaultURI": "http://id.loc.gov/vocabulary/organizations/dlc",
"defaultLiteral": "DLC"
},
"propertyURI": "http://id.loc.gov/ontologies/bibframe/heldBy",
"propertyLabel": "Held by"
},
{
"mandatory": "true",
"repeatable": "false",
"type": "literal",
"resourceTemplates": [],
"valueConstraint": {
"valueTemplateRefs": [],
"useValuesFrom": [],
"valueDataType": {}
},
"propertyURI": "http://id.loc.gov/ontologies/bibframe/sublocation",
"propertyLabel": "Shelving location"
},
{
"mandatory": "false",
"repeatable": "true",
"type": "literal",
"resourceTemplates": [],
"valueConstraint": {
"valueTemplateRefs": [],
"useValuesFrom": [],
"valueDataType": {}
},
"propertyURI": "http://id.loc.gov/ontologies/bibframe/electronicLocator",
"propertyLabel": "Electronic location"
},
{
"mandatory": "false",
"repeatable": "true",
"type": "literal",
"resourceTemplates": [],
"valueConstraint": {
"valueTemplateRefs": [],
"useValuesFrom": [],
"valueDataType": {}
},
"propertyURI": "http://id.loc.gov/ontologies/bibframe/UsageAndAccessPolicy",
"propertyLabel": "Usage and access policy"
},
{
"mandatory": "false",
"repeatable": "true",
"type": "literal",
"resourceTemplates": [],
"valueConstraint": {
"valueTemplateRefs": [],
"useValuesFrom": [],
"valueDataType": {}
},
"propertyURI": "http://id.loc.gov/ontologies/bibframe/note",
"propertyLabel": "Note"
},
{
"mandatory": "false",
"repeatable": "true",
"type": "literal",
"resourceTemplates": [],
"valueConstraint": {
"valueTemplateRefs": [],
"useValuesFrom": [],
"valueDataType": {}
},
"propertyURI": "http://id.loc.gov/ontologies/bibframe/acquisitionSource",
"propertyLabel": "Contact information (RDA 4.3)",
"remark": "http://access.rdatoolkit.org/rdachp4_rda4-93.html"
}
],
"resourceURI": "http://id.loc.gov/ontologies/bibframe/Item",
"resourceLabel": "BIBFRAME 2.0 Item",
"id": "profile:bf2:Item"
},
{
"propertyTemplates": [
{
"mandatory": "false",
"repeatable": "true",
"type": "literal",
"resourceTemplates": [],
"valueConstraint": {
"valueTemplateRefs": [],
"useValuesFrom": [],
"valueDataType": {
"dataTypeURI": "http://id.loc.gov/ontologies/bibframe/AccessPolicy"
}
},
"propertyURI": "http://www.w3.org/2000/01/rdf-schema#label",
"propertyLabel": "Lending or Access Policy"
}
],
"id": "profile:bf2:Item:Access",
"resourceURI": "http://id.loc.gov/ontologies/bibframe/AccessPolicy",
"resourceLabel": "Lending or Access Policy"
},
{
"propertyTemplates": [
{
"mandatory": "false",
"repeatable": "true",
"type": "literal",
"resourceTemplates": [],
"valueConstraint": {
"valueTemplateRefs": [],
"useValuesFrom": [],
"valueDataType": {
"dataTypeURI": "http://id.loc.gov/ontologies/bibframe/UsePolicy"
}
},
"propertyURI": "http://www.w3.org/2000/01/rdf-schema#label",
"propertyLabel": "Use or Reproduction Policy"
}
],
"id": "profile:bf2:Item:Use",
"resourceLabel": "Use or Reproduction Policy",
"resourceURI": "http://id.loc.gov/ontologies/bibframe/UsePolicy"
},
{
"propertyTemplates": [
{
"mandatory": "false",
"repeatable": "true",
"type": "literal",
"resourceTemplates": [],
"valueConstraint": {
"valueTemplateRefs": [],
"useValuesFrom": [],
"valueDataType": {
"dataTypeURI": "http://id.loc.gov/ontologies/bibframe/RetentionPolicy"
}
},
"propertyURI": "http://www.w3.org/2000/01/rdf-schema#label",
"propertyLabel": "Retention Policy"
}
],
"id": "profile:bf2:Item:Retention",
"resourceURI": "http://id.loc.gov/ontologies/bibframe/RetentionPolicy",
"resourceLabel": "Retention Policy"
},
{
"propertyTemplates": [
{
"mandatory": "false",
"repeatable": "true",
"type": "literal",
"resourceTemplates": [],
"valueConstraint": {
"valueTemplateRefs": [],
"useValuesFrom": [],
"valueDataType": {}
},
"propertyURI": "http://www.w3.org/2000/01/rdf-schema#label",
"propertyLabel": "Immediate Source of Acquisition of Item (RDA 2.19)",
"remark": "http://access.rdatoolkit.org/2.19.html"
}
],
"id": "profile:bf2:Item:ImmAcqSource",
"resourceURI": "http://id.loc.gov/ontologies/bibframe/ImmediateAcquisition",
"resourceLabel": "Immediate Source of Acquisition"
},
{
"propertyTemplates": [
{
"mandatory": "false",
"repeatable": "true",
"type": "literal",
"resourceTemplates": [],
"valueConstraint": {
"valueTemplateRefs": [],
"useValuesFrom": [],
"valueDataType": {}
},
"propertyURI": "http://www.w3.org/2000/01/rdf-schema#label",
"propertyLabel": "Enumeration"
}
],
"id": "profile:bf2:Item:Enumeration",
"resourceURI": "http://id.loc.gov/ontologies/bibframe/Enumeration",
"resourceLabel": "Enumeration"
},
{
"propertyTemplates": [
{
"mandatory": "false",
"repeatable": "true",
"type": "literal",
"resourceTemplates": [],
"valueConstraint": {
"valueTemplateRefs": [],
"useValuesFrom": [],
"valueDataType": {}
},
"propertyURI": "http://www.w3.org/2000/01/rdf-schema#label",
"propertyLabel": "Chronology"
}
],
"id": "profile:bf2:Item:Chronology",
"resourceURI": "http://id.loc.gov/ontologies/bibframe/Chronology",
"resourceLabel": "Chronology"
}
],
"id": "profile:bf2:Item",
"title": "BIBFRAME 2.0 Item",
"description": "Item for all formats (testing)",
"date": "2017-08-08",
"contact": "NDMSO",
"remark": ""
}
}
38 changes: 38 additions & 0 deletions source/__tests__/integration/profile-create.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
const path = require('path')

describe('Sinopia Profile Editor imports a Profile', () => {

beforeAll(async () => {
await page.goto('http://127.0.0.1:8000/#/profile/create')
})

describe('Import Data Modal Upload Dialog', () => {

beforeAll(async () => {
await expect(page).toClick('a', { text: 'Import'})
})

it('click the import button and display dialog', async () => {
await expect(page).toMatch(/Import Data/)
})


it('uploads a local BIBFRAME 2.0 Item Profile and checks for loaded Profile', async () => {
const bf_item_location = path.join(__dirname, "..", "__fixtures__", 'item.json')

await expect(page).toUploadFile(
'input[type="file"]',
bf_item_location,
)

await page.waitFor(2000) // Waits for the Profile to load
await expect(page).toMatch(/BIBFRAME 2.0 Item/)
await expect(page).toMatch(/Lending or Access Policy/)
await expect(page).toMatch(/Use or Reproduction Policy/)
await expect(page).toMatch(/Retention Policy/)
await expect(page).toMatch(/Immediate Source of Acquisition/)
await expect(page).toMatch(/Enumeration/)
await expect(page).toMatch(/Chronology/)
})
})
})

0 comments on commit b18dd3c

Please sign in to comment.