Skip to content

Commit

Permalink
implemented test C440112 (#3518)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sherzod-Kenjaev authored Apr 24, 2024
1 parent 5227edd commit a039d1c
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import { DEFAULT_JOB_PROFILE_NAMES } from '../../../support/constants';
import Permissions from '../../../support/dictionary/permissions';
import DataImport from '../../../support/fragments/data_import/dataImport';
import MarcAuthorities from '../../../support/fragments/marcAuthority/marcAuthorities';
import MarcAuthority from '../../../support/fragments/marcAuthority/marcAuthority';
import TopMenu from '../../../support/fragments/topMenu';
import Users from '../../../support/fragments/users/users';
import getRandomPostfix from '../../../support/utils/stringTools';

describe('MARC', () => {
describe('MARC Authority', () => {
const testData = {
searchOption: 'LCCN',
AUTHORIZED: 'Authorized',
};

const searchQueries = ['sh 85057*', '*5057895', '*0578*'];

const searchResults = [
'C440112 Test LCCN subfield a record 1 (two leading spaces, one trailing space, two internal spaces)',
'C440112 Test LCCN subfield a record 2 (one space internal)',
'C440112 Test LCCN subfield a record 3 (two spaces internal)',
'C440112 Test LCCN subfield a record 4 (one space trailing)',
'C440112 Test LCCN subfield a record 5 (two spaces trailing)',
'C440112 Test LCCN subfield a record 6 (one space leading)',
'C440112 Test LCCN subfield a record 7 (two spaces leading)',
'C440112 Test LCCN subfield a record 8 (two spaces everywhere)',
'C440112 Test LCCN subfield a record 9 (no spaces)',
];

const marcFiles = [
{
marc: 'marcAuthFileForC440112.mrc',
fileName: `testMarcFile.${getRandomPostfix()}.mrc`,
jobProfileToRun: DEFAULT_JOB_PROFILE_NAMES.CREATE_AUTHORITY,
propertyName: 'authority',
},
];

const createdAuthorityIDs = [];

before('Creating user', () => {
cy.createTempUser([
Permissions.inventoryAll.gui,
Permissions.uiMarcAuthoritiesAuthorityRecordView.gui,
]).then((createdUserProperties) => {
testData.userProperties = createdUserProperties;

cy.getAdminToken();
marcFiles.forEach((marcFile) => {
DataImport.uploadFileViaApi(
marcFile.marc,
marcFile.fileName,
marcFile.jobProfileToRun,
).then((response) => {
response.forEach((record) => {
createdAuthorityIDs.push(record[marcFile.propertyName].id);
});
});
});

cy.login(testData.userProperties.username, testData.userProperties.password, {
path: TopMenu.marcAuthorities,
waiter: MarcAuthorities.waitLoading,
});
});
});

after('Deleting created user', () => {
cy.getAdminToken();
Users.deleteViaApi(testData.userProperties.userId);
createdAuthorityIDs.forEach((id) => {
MarcAuthority.deleteViaAPI(id);
});
});

it(
'C440112 Search for "MARC authority" by "LCCN" option using a query with asterisk when "LCCN" (010 $a) has (leading, internal, trailing) spaces". (spitfire)',
{ tags: ['criticalPath', 'spitfire'] },
() => {
searchQueries.forEach((query) => {
MarcAuthorities.searchByParameter(testData.searchOption, query);
searchResults.forEach((result) => {
MarcAuthorities.checkAfterSearch(testData.AUTHORIZED, result);
});
});
},
);
});
});
1 change: 1 addition & 0 deletions cypress/fixtures/marcAuthFileForC440112.mrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
00516cz a2200181n 4500001000800000005001700008008004100025010002900066035002100095035001500116040001800131053001000149151010400159550002200263781001600285906001800301953001500319470925320120326095037.0860211|| anannbabn |a ana  a sh 85057895 zt123124 a(DLC)sh 85057894 a(DLC)55938 aDLCcDLCdDLC 0aGC296 aC440112 Test LCCN subfield a record 1 (two leading spaces, one trailing space, two internal spaces) wgaOcean currents 0zGulf Stream t64--u----v0 axx00btd1400463cz a2200181n 4500001000800000005001700008008004100025010001700066035002100083035001500104040001800119053001000137151006300147550002200210781001600232906001800248953001500266470925320120326095037.0860211|| anannbabn |a ana  ash 85057895  a(DLC)sh 85057894 a(DLC)55938 aDLCcDLCdDLC 0aGC296 aC440112 Test LCCN subfield a record 2 (one space internal) wgaOcean currents 0zGulf Stream t64--u----v0 axx00btd1400464cz a2200181n 4500001000800000005001700008008004100025010001700066035002100083035001500104040001800119053001000137151006400147550002200211781001600233906001800249953001500267470925320120326095037.0860211|| anannbabn |a ana  ash 85057895 a(DLC)sh 85057894 a(DLC)55938 aDLCcDLCdDLC 0aGC296 aC440112 Test LCCN subfield a record 3 (two spaces internal) wgaOcean currents 0zGulf Stream t64--u----v0 axx00btd1400470cz a2200181n 4500001000800000005001700008008004100025010002400066035002100090035001500111040001800126053001000144151006300154550002200217781001600239906001800255953001500273470925320120326095037.0860211|| anannbabn |a ana  ash85057895 zg12345 a(DLC)sh 85057894 a(DLC)55938 aDLCcDLCdDLC 0aGC296 aC440112 Test LCCN subfield a record 4 (one space trailing) wgaOcean currents 0zGulf Stream t64--u----v0 axx00btd1400473cz a2200181n 4500001000800000005001700008008004100025010002600066035002100092035001500113040001800128053001000146151006400156550002200220781001600242906001800258953001500276470925320120326095037.0860211|| anannbabn |a ana  ash85057895 z1234123 a(DLC)sh 85057894 a(DLC)55938 aDLCcDLCdDLC 0aGC296 aC440112 Test LCCN subfield a record 5 (two spaces trailing) wgaOcean currents 0zGulf Stream t64--u----v0 axx00btd1400461cz a2200181n 4500001000800000005001700008008004100025010001600066035002100082035001500103040001800118053001000136151006200146550002200208781001600230906001800246953001500264470925320120326095037.0860211|| anannbabn |a ana  a sh85057895 a(DLC)sh 85057894 a(DLC)55938 aDLCcDLCdDLC 0aGC296 aC440112 Test LCCN subfield a record 6 (one space leading) wgaOcean currents 0zGulf Stream t64--u----v0 axx00btd1400463cz a2200181n 4500001000800000005001700008008004100025010001700066035002100083035001500104040001800119053001000137151006300147550002200210781001600232906001800248953001500266470925320120326095037.0860211|| anannbabn |a ana  a sh85057895 a(DLC)sh 85057894 a(DLC)55938 aDLCcDLCdDLC 0aGC296 aC440112 Test LCCN subfield a record 7 (two spaces leading) wgaOcean currents 0zGulf Stream t64--u----v0 axx00btd1400479cz a2200181n 4500001000800000005001700008008004100025010003000066035002100096035001500117040001800132053001000150151006600160550002200226781001600248906001800264953001500282470925320120326095037.0860211|| anannbabn |a ana  a sh 85057895 zt123124 a(DLC)sh 85057894 a(DLC)55938 aDLCcDLCdDLC 0aGC296 aC440112 Test LCCN subfield a record 8 (two spaces everywhere) wgaOcean currents 0zGulf Stream t64--u----v0 axx00btd1400452cz a2200181n 4500001000800000005001700008008004100025010001500066035002100081035001500102040001800117053001000135151005400145550002200199781001600221906001800237953001500255470925320120326095037.0860211|| anannbabn |a ana  ash85057895 a(DLC)sh 85057894 a(DLC)55938 aDLCcDLCdDLC 0aGC296 aC440112 Test LCCN subfield a record 9 (no spaces) wgaOcean currents 0zGulf Stream t64--u----v0 axx00btd14

0 comments on commit a039d1c

Please sign in to comment.