lot name sorting coverage
parent
586256ac31
commit
dec9adab13
|
|
@ -1,2 +1,3 @@
|
|||
export declare const config: import("../types/configTypes.js").Config;
|
||||
export declare function lotNameSortNameFunction(lotName: string): string;
|
||||
export default config;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ config.settings.lot.lotNamePattern =
|
|||
config.settings.lot.lotNameHelpText = `Two digit cemetery-Block-Range-Lot-Grave, Interment number\n
|
||||
ex. XX-BA-R41-L15-G3A, Interment 1`;
|
||||
const numericPadding = '00000';
|
||||
config.settings.lot.lotNameSortNameFunction = (lotName) => {
|
||||
export function lotNameSortNameFunction(lotName) {
|
||||
try {
|
||||
const lotNameSplit = lotName.toUpperCase().split('-');
|
||||
const cleanLotNamePieces = [];
|
||||
|
|
@ -37,7 +37,8 @@ config.settings.lot.lotNameSortNameFunction = (lotName) => {
|
|||
catch {
|
||||
return lotName;
|
||||
}
|
||||
};
|
||||
}
|
||||
config.settings.lot.lotNameSortNameFunction = lotNameSortNameFunction;
|
||||
config.settings.lotOccupancy.occupantCityDefault = 'Sault Ste. Marie';
|
||||
config.settings.lotOccupancy.prints = [
|
||||
'pdf/ssm.cemetery.burialPermit',
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ config.settings.lot.lotNameHelpText = `Two digit cemetery-Block-Range-Lot-Grave,
|
|||
|
||||
const numericPadding = '00000'
|
||||
|
||||
config.settings.lot.lotNameSortNameFunction = (lotName) => {
|
||||
export function lotNameSortNameFunction(lotName: string): string {
|
||||
try {
|
||||
const lotNameSplit = lotName.toUpperCase().split('-')
|
||||
|
||||
|
|
@ -41,8 +41,8 @@ config.settings.lot.lotNameSortNameFunction = (lotName) => {
|
|||
|
||||
cleanLotNamePieces.push(
|
||||
firstLetter +
|
||||
numericPiece.slice(-1 * numericPadding.length) +
|
||||
letterPiece
|
||||
numericPiece.slice(-1 * numericPadding.length) +
|
||||
letterPiece
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -52,6 +52,8 @@ config.settings.lot.lotNameSortNameFunction = (lotName) => {
|
|||
}
|
||||
}
|
||||
|
||||
config.settings.lot.lotNameSortNameFunction = lotNameSortNameFunction
|
||||
|
||||
config.settings.lotOccupancy.occupantCityDefault = 'Sault Ste. Marie'
|
||||
config.settings.lotOccupancy.prints = [
|
||||
'pdf/ssm.cemetery.burialPermit',
|
||||
|
|
|
|||
|
|
@ -1,9 +1,17 @@
|
|||
import * as assert from 'node:assert';
|
||||
import fs from 'node:fs';
|
||||
import { lotNameSortNameFunction } from '../data/config.cemetery.ssm.js';
|
||||
import * as cacheFunctions from '../helpers/functions.cache.js';
|
||||
import * as iconFunctions from '../helpers/functions.icons.js';
|
||||
import * as sqlFilterFunctions from '../helpers/functions.sqlFilters.js';
|
||||
import * as userFunctions from '../helpers/functions.user.js';
|
||||
describe('config.cemetery.ssm', () => {
|
||||
it('Sorts burial site names', () => {
|
||||
const grave2 = 'XX-B1-G2';
|
||||
const grave10 = 'XX-B1-G10';
|
||||
assert.ok(lotNameSortNameFunction(grave2) < lotNameSortNameFunction(grave10));
|
||||
});
|
||||
});
|
||||
describe('functions.cache', () => {
|
||||
const badId = -3;
|
||||
const badName = 'qwertyuiopasdfghjklzxcvbnm';
|
||||
|
|
|
|||
|
|
@ -1,12 +1,22 @@
|
|||
import * as assert from 'node:assert'
|
||||
|
||||
import fs from 'node:fs'
|
||||
import { lotNameSortNameFunction } from '../data/config.cemetery.ssm.js'
|
||||
|
||||
import * as cacheFunctions from '../helpers/functions.cache.js'
|
||||
import * as iconFunctions from '../helpers/functions.icons.js'
|
||||
import * as sqlFilterFunctions from '../helpers/functions.sqlFilters.js'
|
||||
import * as userFunctions from '../helpers/functions.user.js'
|
||||
|
||||
describe('config.cemetery.ssm', () => {
|
||||
it('Sorts burial site names', () => {
|
||||
const grave2 = 'XX-B1-G2'
|
||||
const grave10 = 'XX-B1-G10'
|
||||
|
||||
assert.ok(lotNameSortNameFunction(grave2) < lotNameSortNameFunction(grave10))
|
||||
})
|
||||
})
|
||||
|
||||
describe('functions.cache', () => {
|
||||
const badId = -3
|
||||
const badName = 'qwertyuiopasdfghjklzxcvbnm'
|
||||
|
|
|
|||
Loading…
Reference in New Issue