mirror of
				https://github.com/Mibew/simple-icons.git
				synced 2025-10-31 02:25:59 +03:00 
			
		
		
		
	Avoid certain cases for data consistency (#7222)
This commit is contained in:
		
							parent
							
								
									c05890dc5f
								
							
						
					
					
						commit
						dd4ddc7fa9
					
				| @ -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"] | ||||
| } | ||||
|  | ||||
| @ -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`, () => { | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user