feat: release version 1.0.4

This commit is contained in:
2026-08-19 18:56:00 +09:00
parent bd9d5a6ba6
commit f910db8901
11 changed files with 506 additions and 105 deletions
+54
View File
@@ -0,0 +1,54 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { activeEffectPercent, sortCardsByActive, type CardSummary, type SkillLevel } from '../models/card-list.ts';
function skill(level: number, values: Partial<SkillLevel> = {}): SkillLevel {
return {
level,
description: '',
coolTimeSeconds: null,
probabilityPercent: null,
durationSeconds: null,
...values
};
}
function card(id: string, active?: SkillLevel[]): CardSummary {
return {
id,
rarity: 5,
type: '큐트',
name: id,
versionName: '',
generation: '',
highestStat: '퍼포먼스',
details: { title: '', passive: [], active, special: [], costume: null }
};
}
test('sorts numeric active values in both directions and keeps missing values last', () => {
const cards = [
card('missing'),
card('slow', [skill(1, { coolTimeSeconds: 24 })]),
card('fast', [skill(1, { coolTimeSeconds: 18 })])
];
assert.deepEqual(sortCardsByActive(cards, 'coolTime', 'asc', 1).map(({ id }) => id), ['fast', 'slow', 'missing']);
assert.deepEqual(sortCardsByActive(cards, 'coolTime', 'desc', 1).map(({ id }) => id), ['slow', 'fast', 'missing']);
});
test('uses the selected skill level and preserves source order for ties', () => {
const cards = [
card('first', [skill(1, { effect: '스코어가 80% UP' }), skill(2, { effect: '스코어가 120% UP' })]),
card('second', [skill(1, { effect: '스코어가 90% UP' }), skill(2, { effect: '스코어가 100% UP' })]),
card('same', [skill(1, { effect: '스코어가 90% UP' }), skill(2, { effect: '스코어가 100% UP' })])
];
assert.deepEqual(sortCardsByActive(cards, 'effect', 'desc', 1).map(({ id }) => id), ['second', 'same', 'first']);
assert.deepEqual(sortCardsByActive(cards, 'effect', 'desc', 2).map(({ id }) => id), ['first', 'second', 'same']);
});
test('falls back to the active description when the separated effect is unavailable', () => {
assert.equal(activeEffectPercent(skill(1, { description: '10초 동안 스코어가 85% UP' })), 85);
assert.equal(activeEffectPercent(skill(1, { effect: '라이프가 회복됩니다.' })), null);
});