Sifa professional network API (Fastify, AT Protocol, Jetstream)
sifa.id/
1import { describe, it, expect } from 'vitest';
2import { normalizeSkillName, createSlug } from '../../src/services/skill-normalization.js';
3
4describe('normalizeSkillName', () => {
5 it('lowercases and trims input', () => {
6 expect(normalizeSkillName(' React.js ')).toBe('react.js');
7 });
8
9 it('handles mixed case', () => {
10 expect(normalizeSkillName('TypeScript')).toBe('typescript');
11 });
12
13 it('preserves dots and hyphens', () => {
14 expect(normalizeSkillName('Node.js')).toBe('node.js');
15 expect(normalizeSkillName('vue-router')).toBe('vue-router');
16 });
17
18 it('collapses multiple spaces', () => {
19 expect(normalizeSkillName('machine learning')).toBe('machine learning');
20 });
21});
22
23describe('createSlug', () => {
24 it('creates url-safe slug from skill name', () => {
25 expect(createSlug('React.js')).toBe('react-js');
26 });
27
28 it('handles spaces and special chars', () => {
29 expect(createSlug('C++')).toBe('c-plus-plus');
30 expect(createSlug('C#')).toBe('c-sharp');
31 });
32
33 it('collapses multiple hyphens', () => {
34 expect(createSlug('Node.js / Express')).toBe('node-js-express');
35 });
36});