Files
wownerogue/test/appearance.test.js
jwinterm fad2a695bd Wownerogue
A browser-based roguelike synchronized with crypto block timing. A run is a race
against the next block: reach the exit before the block lands, or the house wins.
The same codebase runs the solo dungeon, the social Tavern, and operator-selected
PvP and race rulesets, with separate free and paid leaderboards.

Self-hostable under the MIT License. See README.md to run it, docs/ARCHITECTURE.md
for the design, and docs/DEPLOY.md to operate an instance.
2026-07-27 08:23:01 -04:00

50 lines
2.0 KiB
JavaScript

const Appearance = require('../src/multiplayer/appearance');
describe('appearance catalog normalization', () => {
test('normalizes character colors and equipment slots', () => {
expect(Appearance.normalizeAppearance({
avatar: 'char-ranger',
tint: 'moss',
equipment: { body: 'mail', head: 'helm', shield: 'bad', weapon: 'bow' },
colors: { base: 'teal', skin: 'warm', hair: 'silver', body: 'gold', head: 'bad', shield: 'rose', weapon: 'ash' }
})).toEqual({
avatar: 'char-ranger',
tint: 'teal',
equipment: { body: 'mail', head: 'helm', shield: 'none', weapon: 'bow' },
colors: { base: 'teal', skin: 'warm', hair: 'silver', body: 'gold', head: 'none', shield: 'rose', weapon: 'ash' }
});
});
test('uses legacy tint as the default character color ramp', () => {
expect(Appearance.normalizeAppearance({
avatar: 'char-ranger',
tint: 'moss'
})).toEqual({
avatar: 'char-ranger',
tint: 'moss',
equipment: { body: 'none', head: 'none', shield: 'none', weapon: 'none' },
colors: { base: 'moss', skin: 'natural', hair: 'copper', body: 'moss', head: 'moss', shield: 'moss', weapon: 'moss' }
});
});
test('strips character-only fields from color and premium skin avatars', () => {
expect(Appearance.normalizeAppearance({
avatar: 'monero-knight',
tint: 'teal',
equipment: { body: 'mail' }
})).toEqual({
avatar: 'monero-knight',
tint: 'none',
equipment: { body: 'none', head: 'none', shield: 'none', weapon: 'none' }
});
});
test('falls back unknown avatars to default', () => {
expect(Appearance.normalizeAppearance('rainbow')).toEqual({
avatar: 'default',
tint: 'none',
equipment: { body: 'none', head: 'none', shield: 'none', weapon: 'none' }
});
});
});