2
0
mirror of https://github.com/iconify/iconify.git synced 2025-01-06 07:20:40 +00:00

Add lastModified to getIcons result

This commit is contained in:
Vjacheslav Trushkin 2022-06-25 10:01:25 +03:00
parent d72a580214
commit 8b034b290e
2 changed files with 13 additions and 1 deletions

View File

@ -27,6 +27,12 @@ export function getIcons(
const sourceIcons = data.icons;
const sourceAliases = data.aliases || {};
// Add lastModified
if (data.lastModified) {
result.lastModified = data.lastModified;
}
// Get dependencies tree
const tree = getIconsTree(data, names);
let empty = true;

View File

@ -61,9 +61,11 @@ describe('Testing retrieving icons from icon set', () => {
});
});
test('Aliases and characters', () => {
test('Aliases, characters, lastModified', () => {
const lastModified = 12345;
const data: IconifyJSON = {
prefix: 'foo',
lastModified,
icons: {
bar: {
body: '<g />',
@ -96,6 +98,7 @@ describe('Testing retrieving icons from icon set', () => {
// Alias
expect(getIcons(data, ['foo'])).toEqual({
prefix: 'foo',
lastModified,
icons: {
bar: {
body: '<g />',
@ -112,6 +115,7 @@ describe('Testing retrieving icons from icon set', () => {
// Alias of alias
expect(getIcons(data, ['foo2'])).toEqual({
prefix: 'foo',
lastModified,
icons: {
bar: {
body: '<g />',
@ -132,6 +136,7 @@ describe('Testing retrieving icons from icon set', () => {
expect(getIcons(data, ['missing-alias'])).toBeNull();
expect(getIcons(data, ['missing-alias'], true)).toEqual({
prefix: 'foo',
lastModified,
icons: {},
not_found: ['missing-alias'],
});
@ -146,6 +151,7 @@ describe('Testing retrieving icons from icon set', () => {
expect(getIcons(data, ['f04'])).toBeNull();
expect(getIcons(data, ['f04'], true)).toEqual({
prefix: 'foo',
lastModified,
icons: {},
not_found: ['f04'],
});