@dava96/osrs-icons 1.0.15 → 1.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,105 @@
1
+ import assert from 'node:assert';
2
+ import { sharkPack, herringPack, anglerfishPack, dragonDaggerPack, goldPack, ironPack, coinsPack, bucketPack, } from './packs';
3
+ // ── Helper ─────────────────────────────────────────────────────────
4
+ function assertIsCursorString(value, label) {
5
+ assert.strictEqual(typeof value, 'string', `${label} should be a string`);
6
+ assert.ok(value.startsWith("url('data:image/png;base64,"), `${label} should start with url('data:image/png;base64,...')`);
7
+ assert.ok(value.endsWith("'), auto"), `${label} should end with '), auto`);
8
+ }
9
+ // ── Fish Packs ─────────────────────────────────────────────────────
10
+ function testSharkPackHasCorrectKeys() {
11
+ const keys = Object.keys(sharkPack);
12
+ assert.deepStrictEqual(keys, ['raw', 'cooked', 'burnt']);
13
+ console.log('✓ sharkPack: has raw, cooked, burnt keys');
14
+ }
15
+ function testSharkPackValuesAreCursorStrings() {
16
+ assertIsCursorString(sharkPack.raw, 'sharkPack.raw');
17
+ assertIsCursorString(sharkPack.cooked, 'sharkPack.cooked');
18
+ assertIsCursorString(sharkPack.burnt, 'sharkPack.burnt');
19
+ console.log('✓ sharkPack: all values are valid cursor strings');
20
+ }
21
+ function testHerringPackHasErrorAlias() {
22
+ const keys = Object.keys(herringPack);
23
+ assert.deepStrictEqual(keys, ['raw', 'cooked', 'burnt', 'error']);
24
+ assertIsCursorString(herringPack.error, 'herringPack.error');
25
+ console.log('✓ herringPack: has error alias (red herring)');
26
+ }
27
+ function testAnglerfishPackHasCorrectKeys() {
28
+ const keys = Object.keys(anglerfishPack);
29
+ assert.deepStrictEqual(keys, ['raw', 'cooked', 'burnt']);
30
+ assertIsCursorString(anglerfishPack.cooked, 'anglerfishPack.cooked');
31
+ console.log('✓ anglerfishPack: has raw, cooked, burnt keys');
32
+ }
33
+ // ── Weapon Packs ───────────────────────────────────────────────────
34
+ function testDragonDaggerPackHasAllVariants() {
35
+ const keys = Object.keys(dragonDaggerPack);
36
+ assert.deepStrictEqual(keys, ['base', 'poisoned', 'poisonedPlus', 'poisonedPlusPlus']);
37
+ assertIsCursorString(dragonDaggerPack.base, 'dragonDaggerPack.base');
38
+ assertIsCursorString(dragonDaggerPack.poisonedPlusPlus, 'dragonDaggerPack.poisonedPlusPlus');
39
+ console.log('✓ dragonDaggerPack: has all poison variants');
40
+ }
41
+ // ── Ore Packs ──────────────────────────────────────────────────────
42
+ function testGoldPackHasOreAndBar() {
43
+ assert.deepStrictEqual(Object.keys(goldPack), ['ore', 'bar']);
44
+ assertIsCursorString(goldPack.ore, 'goldPack.ore');
45
+ assertIsCursorString(goldPack.bar, 'goldPack.bar');
46
+ console.log('✓ goldPack: has ore and bar');
47
+ }
48
+ function testIronPackHasOreAndBar() {
49
+ assert.deepStrictEqual(Object.keys(ironPack), ['ore', 'bar']);
50
+ assertIsCursorString(ironPack.ore, 'ironPack.ore');
51
+ assertIsCursorString(ironPack.bar, 'ironPack.bar');
52
+ console.log('✓ ironPack: has ore and bar');
53
+ }
54
+ // ── Progression Packs ──────────────────────────────────────────────
55
+ function testCoinsPackHasStagesArray() {
56
+ assert.ok(Array.isArray(coinsPack.stages), 'stages should be an array');
57
+ assert.strictEqual(coinsPack.stages.length, 10, 'should have 10 coin stages');
58
+ for (const stage of coinsPack.stages) {
59
+ assertIsCursorString(stage, 'coinsPack.stages entry');
60
+ }
61
+ console.log('✓ coinsPack: stages array has 10 valid cursor strings');
62
+ }
63
+ function testCoinsPackStagesAreOrderedByValue() {
64
+ assert.strictEqual(coinsPack.stages[0], coinsPack._1);
65
+ assert.strictEqual(coinsPack.stages[9], coinsPack._10000);
66
+ console.log('✓ coinsPack: stages[0] is _1, stages[9] is _10000');
67
+ }
68
+ function testBucketPackHasStagesArray() {
69
+ assert.ok(Array.isArray(bucketPack.stages), 'stages should be an array');
70
+ assert.strictEqual(bucketPack.stages.length, 6, 'should have 6 bucket stages');
71
+ for (const stage of bucketPack.stages) {
72
+ assertIsCursorString(stage, 'bucketPack.stages entry');
73
+ }
74
+ console.log('✓ bucketPack: stages array has 6 valid cursor strings');
75
+ }
76
+ function testBucketPackStagesAreOrderedEmptyToFull() {
77
+ assert.strictEqual(bucketPack.stages[0], bucketPack.empty);
78
+ assert.strictEqual(bucketPack.stages[5], bucketPack.full);
79
+ console.log('✓ bucketPack: stages[0] is empty, stages[5] is full');
80
+ }
81
+ function testAllPackValuesAreDistinct() {
82
+ const allValues = [
83
+ ...Object.values(sharkPack),
84
+ ...Object.values(herringPack),
85
+ ...Object.values(anglerfishPack),
86
+ ];
87
+ const uniqueValues = new Set(allValues);
88
+ assert.strictEqual(uniqueValues.size, allValues.length, 'all fish pack values should be distinct');
89
+ console.log('✓ fish packs: all values across packs are distinct');
90
+ }
91
+ // ── Runner ─────────────────────────────────────────────────────────
92
+ console.log('\nRunning packs tests...\n');
93
+ testSharkPackHasCorrectKeys();
94
+ testSharkPackValuesAreCursorStrings();
95
+ testHerringPackHasErrorAlias();
96
+ testAnglerfishPackHasCorrectKeys();
97
+ testDragonDaggerPackHasAllVariants();
98
+ testGoldPackHasOreAndBar();
99
+ testIronPackHasOreAndBar();
100
+ testCoinsPackHasStagesArray();
101
+ testCoinsPackStagesAreOrderedByValue();
102
+ testBucketPackHasStagesArray();
103
+ testBucketPackStagesAreOrderedEmptyToFull();
104
+ testAllPackValuesAreDistinct();
105
+ console.log('\nAll packs tests passed!\n');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dava96/osrs-icons",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "Old School RuneScape inventory icons as ready-to-use CSS cursor values. Tree-shakeable, zero runtime dependencies.",
5
5
  "keywords": [
6
6
  "osrs",
@@ -40,7 +40,7 @@
40
40
  "build": "tsc -p tsconfig.json && tsc -p tsconfig.esm.json",
41
41
  "prepublishOnly": "npm run build",
42
42
  "lint": "eslint .",
43
- "test": "ts-node src/index_test.ts",
43
+ "test": "ts-node src/index_test.ts && ts-node src/packs_test.ts && ts-node src/flip_test.ts && ts-node src/applyCursors_test.ts",
44
44
  "format": "prettier --write ."
45
45
  },
46
46
  "devDependencies": {