' +
@@ -448,25 +540,28 @@ describe('AvailabilityUpdater', function () {
'';
const availability_response = {
- "9965126093506421": {
- "22202918790006421": {
- "on_reserve": "N",
- "location": "firestone$stacks",
- "label": "Firestone Library - Stacks",
- "status_label": "Unavailable",
- "copy_number": null,
- "cdl": true,
- "temp_location": false,
- "id": "22202918790006421"
- }
- }
+ '9965126093506421': {
+ '22202918790006421': {
+ on_reserve: 'N',
+ location: 'firestone$stacks',
+ label: 'Firestone Library - Stacks',
+ status_label: 'Unavailable',
+ copy_number: null,
+ cdl: true,
+ temp_location: false,
+ id: '22202918790006421',
+ },
+ },
};
- const holding_data = availability_response["9965126093506421"]["22202918790006421"];
+ const holding_data =
+ availability_response['9965126093506421']['22202918790006421'];
const cdl_element = $("*[data-availability-cdl='true']")[0];
- const av_element = $(`*[data-availability-record='true'][data-record-id='9965126093506421'][data-holding-id='22202918790006421'] .availability-icon`);
+ const av_element = $(
+ `*[data-availability-record='true'][data-record-id='9965126093506421'][data-holding-id='22202918790006421'] .availability-icon`
+ );
- const u = new updater;
+ const u = new updater();
u.id = '9965126093506421';
expect(cdl_element.textContent).not.toContain('Online');
@@ -475,7 +570,8 @@ describe('AvailabilityUpdater', function () {
});
test('in the Show page we display Online instead of Unavailable for CDL records', () => {
- document.body.innerHTML = '
' +
+ document.body.innerHTML =
+ '' +
'' +
' ' +
' Firestone Library - Firestone Library' +
@@ -506,24 +602,27 @@ describe('AvailabilityUpdater', function () {
' |
';
const availability_response = {
- "9999490563506421": {
- "22745424290006421": {
- "on_reserve": "N",
- "location": "firestone$stacks",
- "label": "Firestone Library - Firestone Library",
- "status_label": "Unavailable",
- "copy_number": null,
- "cdl": true,
- "temp_location": false,
- "id": "22745424290006421"
- }
- }
+ '9999490563506421': {
+ '22745424290006421': {
+ on_reserve: 'N',
+ location: 'firestone$stacks',
+ label: 'Firestone Library - Firestone Library',
+ status_label: 'Unavailable',
+ copy_number: null,
+ cdl: true,
+ temp_location: false,
+ id: '22745424290006421',
+ },
+ },
};
- const holding_data = availability_response["9999490563506421"]["22745424290006421"];
+ const holding_data =
+ availability_response['9999490563506421']['22745424290006421'];
- const av_element = $(`*[data-availability-record='true'][data-record-id='9999490563506421'][data-holding-id='22745424290006421'] .availability-icon`);
- const u = new updater;
+ const av_element = $(
+ `*[data-availability-record='true'][data-record-id='9999490563506421'][data-holding-id='22745424290006421'] .availability-icon`
+ );
+ const u = new updater();
u.id = '9999490563506421';
expect(av_element[0].textContent).not.toContain('Online');
@@ -532,7 +631,8 @@ describe('AvailabilityUpdater', function () {
});
test('special case for Marquand locations - marquand$stacks,marquand$pj,marquand$ref,marquand$ph,marquand$fesrf - items to display status: Ask Staff', () => {
- document.body.innerHTML = '' +
+ document.body.innerHTML =
+ '' +
'' +
' ' +
' ' +
@@ -553,29 +653,41 @@ describe('AvailabilityUpdater', function () {
' |
';
const availability_response = {
- "99124187703506421": {
- "22642015240006421": {
- "on_reserve": "N",
- "location": "marquand$pj",
- "label": "Marquand Library - Remote Storage (ReCAP): Marquand Library Use Only",
- "status_label": "Unavailable",
- "copy_number": null,
- "cdl": false,
- "temp_location": false,
- "id": "22642015240006421"
- }
- }
+ '99124187703506421': {
+ '22642015240006421': {
+ on_reserve: 'N',
+ location: 'marquand$pj',
+ label:
+ 'Marquand Library - Remote Storage (ReCAP): Marquand Library Use Only',
+ status_label: 'Unavailable',
+ copy_number: null,
+ cdl: false,
+ temp_location: false,
+ id: '22642015240006421',
+ },
+ },
};
- const holding_data = availability_response["99124187703506421"]["22642015240006421"];
- const av_element = $(`*[data-availability-record='true'][data-record-id='99124187703506421'][data-holding-id='22642015240006421'] .availability-icon`);
+ const holding_data =
+ availability_response['99124187703506421']['22642015240006421'];
+ const av_element = $(
+ `*[data-availability-record='true'][data-record-id='99124187703506421'][data-holding-id='22642015240006421'] .availability-icon`
+ );
- const u = new updater;
+ const u = new updater();
u.id = '99124187703506421';
expect(av_element[0].textContent).not.toContain('Ask Staff');
u.apply_availability_label(av_element, holding_data, false);
expect(av_element[0].textContent).toContain('Ask Staff');
- expect(document.querySelector('.holding-status[data-holding-id="22642015240006421"] > .badge-secondary')).toBeTruthy();
- expect(document.querySelector('.holding-status[data-holding-id="22642015240006421"] > .badge-danger')).toBeFalsy();
+ expect(
+ document.querySelector(
+ '.holding-status[data-holding-id="22642015240006421"] > .badge-secondary'
+ )
+ ).toBeTruthy();
+ expect(
+ document.querySelector(
+ '.holding-status[data-holding-id="22642015240006421"] > .badge-danger'
+ )
+ ).toBeFalsy();
});
test('location RES_SHARE$IN_RS_REQ has status Unavailable in red', () => {
@@ -584,31 +696,46 @@ describe('AvailabilityUpdater', function () {
'' +
' Available' +
' | ';
- '';
+ ('');
const res_share_response = {
- "99118399983506421": {
- "RES_SHARE$IN_RS_REQ": {
- "on_reserve": "N",
- "location": "RES_SHARE$IN_RS_REQ",
- "label": "Resource Sharing Library - Lending Resource Sharing Requests",
- "status_label": "Unavailable",
- "copy_number": null,
- "cdl": false,
- "temp_location": true,
- "id": "RES_SHARE$IN_RS_REQ"
- }
- }
+ '99118399983506421': {
+ RES_SHARE$IN_RS_REQ: {
+ on_reserve: 'N',
+ location: 'RES_SHARE$IN_RS_REQ',
+ label: 'Resource Sharing Library - Lending Resource Sharing Requests',
+ status_label: 'Unavailable',
+ copy_number: null,
+ cdl: false,
+ temp_location: true,
+ id: 'RES_SHARE$IN_RS_REQ',
+ },
+ },
};
- const u = new updater;
+ const u = new updater();
u.id = '99118399983506421';
- const element = $(`*[data-availability-record='true'][data-record-id='99118399983506421'][data-holding-id='RES_SHARE$IN_RS_REQ'] .availability-icon`);
- const holding_data = res_share_response["99118399983506421"]["RES_SHARE$IN_RS_REQ"];
+ const element = $(
+ `*[data-availability-record='true'][data-record-id='99118399983506421'][data-holding-id='RES_SHARE$IN_RS_REQ'] .availability-icon`
+ );
+ const holding_data =
+ res_share_response['99118399983506421']['RES_SHARE$IN_RS_REQ'];
expect(element[0].textContent).not.toContain('Unavailable');
u.apply_availability_label(element, holding_data, false);
expect(element[0].textContent).toContain('Unavailable');
- expect(document.querySelector('.holding-status[data-holding-id="RES_SHARE$IN_RS_REQ"] > .badge-secondary')).toBeFalsy();
- expect(document.querySelector('.holding-status[data-holding-id="RES_SHARE$IN_RS_REQ"] > .badge-primary')).toBeFalsy();
- expect(document.querySelector('.holding-status[data-holding-id="RES_SHARE$IN_RS_REQ"] > .badge-danger')).toBeTruthy();
+ expect(
+ document.querySelector(
+ '.holding-status[data-holding-id="RES_SHARE$IN_RS_REQ"] > .badge-secondary'
+ )
+ ).toBeFalsy();
+ expect(
+ document.querySelector(
+ '.holding-status[data-holding-id="RES_SHARE$IN_RS_REQ"] > .badge-primary'
+ )
+ ).toBeFalsy();
+ expect(
+ document.querySelector(
+ '.holding-status[data-holding-id="RES_SHARE$IN_RS_REQ"] > .badge-danger'
+ )
+ ).toBeTruthy();
});
// TODO: This method isn't covered by the feature tests
@@ -626,7 +753,7 @@ describe('AvailabilityUpdater', function () {
' ' +
' ' +
'';
- const u = new updater;
+ const u = new updater();
expect(u.scsb_barcodes()).toEqual(['33433038233809']);
});
@@ -660,7 +787,7 @@ describe('AvailabilityUpdater', function () {
'' +
'' +
'';
- const u = new updater;
+ const u = new updater();
expect(u.record_ids()).toEqual(['10585552', '7058493']);
});
@@ -674,18 +801,22 @@ describe('AvailabilityUpdater', function () {
' ' +
'
' +
'
';
- const u = new updater;
+ const u = new updater();
expect(u.record_ids()).toEqual(['2939035', '3821268']);
});
test('account for bound-with records when building URL to request availability', () => {
- const u = new updater;
+ const u = new updater();
u.bibdata_base_url = 'http://mock_url';
u.id = '9965126093506421';
- expect(u.availability_url_show()).toEqual('http://mock_url/bibliographic/availability.json?deep=true&bib_ids=9965126093506421');
+ expect(u.availability_url_show()).toEqual(
+ 'http://mock_url/bibliographic/availability.json?deep=true&bib_ids=9965126093506421'
+ );
u.host_id = '9900126093506421';
- expect(u.availability_url_show()).toEqual('http://mock_url/bibliographic/availability.json?deep=true&bib_ids=9965126093506421,9900126093506421');
+ expect(u.availability_url_show()).toEqual(
+ 'http://mock_url/bibliographic/availability.json?deep=true&bib_ids=9965126093506421,9900126093506421'
+ );
});
test('Temporary location - RES_SHARE$IN_RS_REQ - has a Request button', () => {
document.body.innerHTML =
@@ -696,30 +827,47 @@ describe('AvailabilityUpdater', function () {
'' +
'Request' +
' | ';
- '
';
+ ('');
const res_share_response = {
- "99118399983506421": {
- "RES_SHARE$IN_RS_REQ": {
- "on_reserve": "N",
- "location": "RES_SHARE$IN_RS_REQ",
- "label": "Resource Sharing Library - Lending Resource Sharing Requests",
- "status_label": "Unavailable",
- "copy_number": null,
- "cdl": false,
- "temp_location": true,
- "id": "RES_SHARE$IN_RS_REQ"
- }
- }
+ '99118399983506421': {
+ RES_SHARE$IN_RS_REQ: {
+ on_reserve: 'N',
+ location: 'RES_SHARE$IN_RS_REQ',
+ label: 'Resource Sharing Library - Lending Resource Sharing Requests',
+ status_label: 'Unavailable',
+ copy_number: null,
+ cdl: false,
+ temp_location: true,
+ id: 'RES_SHARE$IN_RS_REQ',
+ },
+ },
};
- const u = new updater;
+ const u = new updater();
u.id = '99118399983506421';
- const element = $(`*[data-availability-record='true'][data-record-id='99118399983506421'][data-temp-location-code='RES_SHARE$IN_RS_REQ'] .availability-icon`);
- const holding_data = res_share_response["99118399983506421"]["RES_SHARE$IN_RS_REQ"];
+ const element = $(
+ `*[data-availability-record='true'][data-record-id='99118399983506421'][data-temp-location-code='RES_SHARE$IN_RS_REQ'] .availability-icon`
+ );
+ const holding_data =
+ res_share_response['99118399983506421']['RES_SHARE$IN_RS_REQ'];
u.apply_availability_label(element, holding_data, false);
u.update_single(res_share_response, u.id);
- expect(document.querySelector('.location-services.service-conditional[data-holding-id="22936525030006421"] > .btn.btn-xs.btn-primary').style.display).not.toBe('none');
- expect(document.querySelector('.holding-status[data-temp-location-code="RES_SHARE$IN_RS_REQ"]').getAttribute('data-temp-location-code')).toBe("RES_SHARE$IN_RS_REQ");
- expect(document.querySelector('.holding-status[data-temp-location-code="RES_SHARE$IN_RS_REQ"] span').textContent).toBe("Unavailable");
+ expect(
+ document.querySelector(
+ '.location-services.service-conditional[data-holding-id="22936525030006421"] > .btn.btn-xs.btn-primary'
+ ).style.display
+ ).not.toBe('none');
+ expect(
+ document
+ .querySelector(
+ '.holding-status[data-temp-location-code="RES_SHARE$IN_RS_REQ"]'
+ )
+ .getAttribute('data-temp-location-code')
+ ).toBe('RES_SHARE$IN_RS_REQ');
+ expect(
+ document.querySelector(
+ '.holding-status[data-temp-location-code="RES_SHARE$IN_RS_REQ"] span'
+ ).textContent
+ ).toBe('Unavailable');
});
test('Reshare holdings availability badge loads correctly', () => {
@@ -742,26 +890,39 @@ describe('AvailabilityUpdater', function () {
' ' +
'';
const res_share_response = {
- "99125535710106421": {
- "RES_SHARE$IN_RS_REQ": {
- "on_reserve": "N",
- "location": "RES_SHARE$IN_RS_REQ",
- "label": "Resource Sharing Library - Lending Resource Sharing Requests",
- "status_label": "Unavailable"
- , "copy_number": null,
- "cdl": false,
- "temp_location": true,
- "id": "RES_SHARE$IN_RS_REQ"
- }
- }
+ '99125535710106421': {
+ RES_SHARE$IN_RS_REQ: {
+ on_reserve: 'N',
+ location: 'RES_SHARE$IN_RS_REQ',
+ label: 'Resource Sharing Library - Lending Resource Sharing Requests',
+ status_label: 'Unavailable',
+ copy_number: null,
+ cdl: false,
+ temp_location: true,
+ id: 'RES_SHARE$IN_RS_REQ',
+ },
+ },
};
- const u = new updater;
+ const u = new updater();
u.id = '99125535710106421';
- const element = $(`*[data-availability-record='true'][data-record-id='99125535710106421'][data-temp-location-code='RES_SHARE$IN_RS_REQ'] .availability-icon`);
- const holding_data = res_share_response["99125535710106421"]["RES_SHARE$IN_RS_REQ"];
+ const element = $(
+ `*[data-availability-record='true'][data-record-id='99125535710106421'][data-temp-location-code='RES_SHARE$IN_RS_REQ'] .availability-icon`
+ );
+ const holding_data =
+ res_share_response['99125535710106421']['RES_SHARE$IN_RS_REQ'];
u.apply_availability_label(element, holding_data, false);
u.process_result(u.id, res_share_response['99125535710106421']);
- expect(document.querySelector('.holding-status[data-temp-location-code="RES_SHARE$IN_RS_REQ"]').getAttribute('data-temp-location-code')).toBe('RES_SHARE$IN_RS_REQ');
- expect(document.querySelector('.holding-status[data-temp-location-code="RES_SHARE$IN_RS_REQ"] span').textContent).toBe('Unavailable');
+ expect(
+ document
+ .querySelector(
+ '.holding-status[data-temp-location-code="RES_SHARE$IN_RS_REQ"]'
+ )
+ .getAttribute('data-temp-location-code')
+ ).toBe('RES_SHARE$IN_RS_REQ');
+ expect(
+ document.querySelector(
+ '.holding-status[data-temp-location-code="RES_SHARE$IN_RS_REQ"] span'
+ ).textContent
+ ).toBe('Unavailable');
});
});
diff --git a/spec/requests/request_spec.rb b/spec/requests/request_spec.rb
index a89fa4aca..061d0430e 100644
--- a/spec/requests/request_spec.rb
+++ b/spec/requests/request_spec.rb
@@ -103,7 +103,7 @@
end
it 'does not provide a find it link for online holdings' do
get '/catalog/9990889283506421'
- expect(response.body.include?('[Where to Find it]')).to eq false
+ expect(response.body.include?('[Where to find it]')).to eq false
end
end
|
|