polyfill coverage testing

deepsource-autofix-76c6eb20
Dan Gowans 2023-01-30 14:08:54 -05:00
parent dec9adab13
commit b45567450f
2 changed files with 32 additions and 3 deletions

View File

@ -5,9 +5,10 @@ import * as cacheFunctions from '../helpers/functions.cache.js';
import * as iconFunctions from '../helpers/functions.icons.js'; import * as iconFunctions from '../helpers/functions.icons.js';
import * as sqlFilterFunctions from '../helpers/functions.sqlFilters.js'; import * as sqlFilterFunctions from '../helpers/functions.sqlFilters.js';
import * as userFunctions from '../helpers/functions.user.js'; import * as userFunctions from '../helpers/functions.user.js';
import * as polyfills from '../helpers/polyfills.js';
describe('config.cemetery.ssm', () => { describe('config.cemetery.ssm', () => {
it('Sorts burial site names', () => { it('Sorts burial site names', () => {
const grave2 = 'XX-B1-G2'; const grave2 = 'XX-B1-G2A';
const grave10 = 'XX-B1-G10'; const grave10 = 'XX-B1-G10';
assert.ok(lotNameSortNameFunction(grave2) < lotNameSortNameFunction(grave10)); assert.ok(lotNameSortNameFunction(grave2) < lotNameSortNameFunction(grave10));
}); });
@ -334,3 +335,13 @@ describe('functions.user', () => {
}); });
}); });
}); });
describe('plyfills', () => {
it('applys Object.hasOwn polyfill', () => {
delete Object.hasOwn;
assert.ok(Object.hasOwn === undefined);
polyfills.applyPolyfills();
assert.ok(Object.hasOwn !== undefined);
const testObject = { foo: 'bar' };
assert.ok(Object.hasOwn(testObject, 'foo'));
});
});

View File

@ -8,12 +8,16 @@ import * as iconFunctions from '../helpers/functions.icons.js'
import * as sqlFilterFunctions from '../helpers/functions.sqlFilters.js' import * as sqlFilterFunctions from '../helpers/functions.sqlFilters.js'
import * as userFunctions from '../helpers/functions.user.js' import * as userFunctions from '../helpers/functions.user.js'
import * as polyfills from '../helpers/polyfills.js'
describe('config.cemetery.ssm', () => { describe('config.cemetery.ssm', () => {
it('Sorts burial site names', () => { it('Sorts burial site names', () => {
const grave2 = 'XX-B1-G2' const grave2 = 'XX-B1-G2A'
const grave10 = 'XX-B1-G10' const grave10 = 'XX-B1-G10'
assert.ok(lotNameSortNameFunction(grave2) < lotNameSortNameFunction(grave10)) assert.ok(
lotNameSortNameFunction(grave2) < lotNameSortNameFunction(grave10)
)
}) })
}) })
@ -511,3 +515,17 @@ describe('functions.user', () => {
}) })
}) })
}) })
describe('plyfills', () => {
it('applys Object.hasOwn polyfill', () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
delete (Object as any).hasOwn
assert.ok(Object.hasOwn === undefined)
polyfills.applyPolyfills()
assert.ok(Object.hasOwn !== undefined)
const testObject = { foo: 'bar' }
assert.ok(Object.hasOwn(testObject, 'foo'))
})
})