-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support local IDs for overlay of MARC records.
refs #3555
- Loading branch information
1 parent
e38de3d
commit b9139ab
Showing
27 changed files
with
590 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
[ | ||
{ | ||
"@id": "http://localhost:3000/resource/ae93cff4-d272-43b2-a4ee-fb8651907e51", | ||
"@type": [ | ||
"http://sinopia.io/vocabulary/LocalAdminMetadata" | ||
], | ||
"http://id.loc.gov/ontologies/bibframe/identifier": [ | ||
{ | ||
"@id": "_:Nfe4b29df32004cc1b097a218f69df09f" | ||
} | ||
], | ||
"http://sinopia.io/vocabulary/exportDate": [ | ||
{ | ||
"@value": "2022-08-01T15:49:44.558203" | ||
} | ||
], | ||
"http://sinopia.io/vocabulary/hasResourceTemplate": [ | ||
{ | ||
"@value": "pcc:sinopia:localAdminMetadata" | ||
} | ||
], | ||
"http://sinopia.io/vocabulary/localAdminMetadataFor": [ | ||
{ | ||
"@id": "http://localhost:3000/resource/a5c5f4c0-e7cd-4ca5-a20f-2a37fe1080d5" | ||
} | ||
] | ||
}, | ||
{ | ||
"@id": "_:Nfe4b29df32004cc1b097a218f69df09f", | ||
"@type": [ | ||
"http://id.loc.gov/ontologies/bibframe/Local" | ||
], | ||
"http://id.loc.gov/ontologies/bibframe/source": [ | ||
{ | ||
"@id": "_:Nf65f353d6fb64adeb6aa6040d21fb88c" | ||
} | ||
], | ||
"http://www.w3.org/1999/02/22-rdf-syntax-ns#value": [ | ||
{ | ||
"@value": "13714202" | ||
} | ||
] | ||
}, | ||
{ | ||
"@id": "_:Nf65f353d6fb64adeb6aa6040d21fb88c", | ||
"@type": [ | ||
"http://id.loc.gov/ontologies/bibframe/Source" | ||
], | ||
"http://www.w3.org/2000/01/rdf-schema#label": [ | ||
{ | ||
"@value": "SIRSI" | ||
} | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
import { clearLocalIds, setLocalId } from "reducers/transfer" | ||
import { createReducer } from "reducers/index" | ||
|
||
const handlers = { | ||
CLEAR_LOCAL_IDS: clearLocalIds, | ||
SET_LOCAL_ID: setLocalId, | ||
} | ||
const reducer = createReducer(handlers) | ||
|
||
describe("clearLocalIds", () => { | ||
it("removes local ids for resource", () => { | ||
const oldState = { | ||
localIds: { | ||
abc123: { | ||
FOLIO: { | ||
stanford: "123456", | ||
}, | ||
}, | ||
def456: { | ||
FOLIO: { | ||
stanford: "234567", | ||
}, | ||
}, | ||
}, | ||
} | ||
const action = { | ||
type: "CLEAR_LOCAL_IDS", | ||
payload: "abc123", | ||
} | ||
|
||
const newState = reducer(oldState, action) | ||
expect(newState).toStrictEqual({ | ||
localIds: { | ||
def456: { | ||
FOLIO: { | ||
stanford: "234567", | ||
}, | ||
}, | ||
}, | ||
}) | ||
}) | ||
}) | ||
|
||
describe("setLocalId", () => { | ||
describe("when resource does not have existing local ids", () => { | ||
it("adds local ids for resource", () => { | ||
const oldState = { | ||
localIds: {}, | ||
} | ||
const action = { | ||
type: "SET_LOCAL_ID", | ||
payload: { | ||
resourceKey: "abc123", | ||
target: "FOLIO", | ||
group: "stanford", | ||
localId: "123456", | ||
}, | ||
} | ||
|
||
const newState = reducer(oldState, action) | ||
expect(newState).toStrictEqual({ | ||
localIds: { | ||
abc123: { | ||
FOLIO: { | ||
stanford: "123456", | ||
}, | ||
}, | ||
}, | ||
}) | ||
}) | ||
}) | ||
|
||
describe("when resource has existing local ids", () => { | ||
it("appends local ids for resource", () => { | ||
const oldState = { | ||
localIds: { | ||
abc123: { | ||
SYMPHONY: { | ||
stanford: "234567", | ||
}, | ||
}, | ||
}, | ||
} | ||
const action = { | ||
type: "SET_LOCAL_ID", | ||
payload: { | ||
resourceKey: "abc123", | ||
target: "FOLIO", | ||
group: "stanford", | ||
localId: "123456", | ||
}, | ||
} | ||
|
||
const newState = reducer(oldState, action) | ||
expect(newState).toStrictEqual({ | ||
localIds: { | ||
abc123: { | ||
SYMPHONY: { | ||
stanford: "234567", | ||
}, | ||
FOLIO: { | ||
stanford: "123456", | ||
}, | ||
}, | ||
}, | ||
}) | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.