1
0
mirror of https://github.com/simple-icons/simple-icons.git synced 2024-12-16 01:10:30 +02:00

Avoid certain cases for data consistency (#7222)

This commit is contained in:
Álvaro Mondéjar 2022-03-14 21:04:50 +01:00 committed by GitHub
parent c05890dc5f
commit dd4ddc7fa9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 19 deletions

View File

@ -55,22 +55,6 @@
"license": {
"description": "The license for the icon",
"oneOf": [
{
"type": "object",
"required": ["type", "url"],
"properties": {
"type": {
"description": "The license name or 'custom'",
"type": "string",
"enum": ["custom"]
},
"url": {
"description": "The URL to the license text by the brand",
"$ref": "#/definitions/url"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": ["type"],
@ -166,6 +150,22 @@
}
},
"additionalProperties": false
},
{
"type": "object",
"required": ["type", "url"],
"properties": {
"type": {
"description": "The license name or 'custom'",
"type": "string",
"enum": ["custom"]
},
"url": {
"description": "The URL to the license text by the brand",
"$ref": "#/definitions/url"
}
},
"additionalProperties": false
}
]
}
@ -235,7 +235,6 @@
"pattern": "^https?://[^\\s]+$"
}
},
"type": "object",
"properties": {
"icons": {
@ -243,5 +242,7 @@
"type": "array",
"items": { "$ref": "#/definitions/brand" }
}
}
},
"additionalProperties": false,
"required": ["icons"]
}

View File

@ -1,5 +1,5 @@
import simpleIcons from '../index.js';
import { getIconSlug, getIconsData } from '../scripts/utils.js';
import { getIconSlug, getIconsData, titleToSlug } from '../scripts/utils.js';
import { test } from 'mocha';
import { strict as assert } from 'node:assert';
@ -16,6 +16,15 @@ import { strict as assert } from 'node:assert';
assert.equal(found.hex, icon.hex);
assert.equal(found.source, icon.source);
});
if (icon.slug) {
// if an icon data has a slug, it must be different to the
// slug inferred from the title, which prevents adding
// unnecessary slugs to icons data
test(`'${icon.title}' slug must be necessary`, () => {
assert.notEqual(titleToSlug(icon.title), icon.slug);
});
}
});
test(`Iterating over simpleIcons only exposes icons`, () => {