Files
Laca-City/frontend/node_modules/damerau-levenshtein/test/test.js
PhongPham c65cc97a33 🎯 MapView v2.0 - Global Deployment Ready
 MAJOR FEATURES:
• Auto-zoom intelligence với smart bounds fitting
• Enhanced 3D GPS markers với pulsing effects
• Professional route display với 6-layer rendering
• Status-based parking icons với availability indicators
• Production-ready build optimizations

🗺️ AUTO-ZOOM FEATURES:
• Smart bounds fitting cho GPS + selected parking
• Adaptive padding (50px) cho visual balance
• Max zoom control (level 16) để tránh quá gần
• Dynamic centering khi không có selection

🎨 ENHANCED VISUALS:
• 3D GPS marker với multi-layer pulse effects
• Advanced parking icons với status colors
• Selection highlighting với animation
• Dimming system cho non-selected items

🛣️ ROUTE SYSTEM:
• OpenRouteService API integration
• Multi-layer route rendering (glow, shadow, main, animated)
• Real-time distance & duration calculation
• Visual route info trong popup

📱 PRODUCTION READY:
• SSR safe với dynamic imports
• Build errors resolved
• Global deployment via Vercel
• Optimized performance

🌍 DEPLOYMENT:
• Vercel: https://whatever-ctk2auuxr-phong12hexdockworks-projects.vercel.app
• Bundle size: 22.8 kB optimized
• Global CDN distribution
• HTTPS enabled

💾 VERSION CONTROL:
• MapView-v2.0.tsx backup created
• MAPVIEW_VERSIONS.md documentation
• Full version history tracking
2025-07-20 19:52:16 +07:00

169 lines
4.4 KiB
JavaScript

var levenshtien = require("./../index");
var assert = require("assert");
describe("Damerau - Levenshtein", function() {
describe("Equality", function() {
it("returns 0 steps for equal strings", function() {
assert.deepEqual(levenshtien("test", "test"), {
steps: 0,
relative: 0,
similarity: 1
});
});
});
describe("Additions", function() {
it("returns 1 step when appending one char", function() {
assert.deepEqual(levenshtien("test", "tests"), {
steps: 1,
relative: 1 / 5,
similarity: 1 - 1 / 5
});
});
it("returns 1 step when prepending one char", function() {
assert.deepEqual(levenshtien("test", "stest"), {
steps: 1,
relative: 1 / 5,
similarity: 1 - 1 / 5
});
});
it("returns 2 steps when appending two char", function() {
assert.deepEqual(levenshtien("test", "mytest"), {
steps: 2,
relative: 2 / 6,
similarity: 1 - 2 / 6
});
});
it("returns 7 steps when appending seven char", function() {
assert.deepEqual(levenshtien("test", "mycrazytest"), {
steps: 7,
relative: 7 / 11,
similarity: 1 - 7 / 11
});
});
it("returns 9 steps when prepend two chars and append seven chars", function() {
assert.deepEqual(levenshtien("test", "mytestiscrazy"), {
steps: 9,
relative: 9 / 13,
similarity: 1 - 9 / 13
});
});
});
describe("Addition of repeated chars", function() {
it("returns 1 step when repeating a character", function() {
assert.deepEqual(levenshtien("test", "teest"), {
steps: 1,
relative: 1 / 5,
similarity: 1 - 1 / 5
});
});
it("returns 2 step when repeating a character twice", function() {
assert.deepEqual(levenshtien("test", "teeest"), {
steps: 2,
relative: 2 / 6,
similarity: 1 - 2 / 6
});
});
});
describe("#Deletion", function() {
it("returns 1 step when removing one char", function() {
assert.deepEqual(levenshtien("test", "tst"), {
steps: 1,
relative: 1 / 4,
similarity: 1 - 1 / 4
});
});
});
describe("Transposition", function() {
it("returns 1 step when transposing one char", function() {
assert.deepEqual(levenshtien("test", "tset"), {
steps: 1,
relative: 1 / 4,
similarity: 1 - 1 / 4
});
});
});
describe("Addition with transposition", function() {
it("returns 2 step when transposing one char and append another", function() {
assert.deepEqual(levenshtien("test", "tsets"), {
steps: 2,
relative: 2 / 5,
similarity: 1 - 2 / 5
});
});
it("returns 2 step when transposing a char and repeating it", function() {
assert.deepEqual(levenshtien("test", "tsset"), {
steps: 2,
relative: 2 / 5,
similarity: 1 - 2 / 5
});
});
});
describe("Transposition of multiple chars", function() {
it("returns 1 step when transposing two neighbouring characters", function() {
assert.deepEqual(levenshtien("banana", "banaan"), {
steps: 1,
relative: 1 / 6,
similarity: 1 - 1 / 6
});
});
it("returns 2 step when transposing two neighbouring characters by two places", function() {
assert.deepEqual(levenshtien("banana", "nabana"), {
steps: 2,
relative: 2 / 6,
similarity: 1 - 2 / 6
});
});
it("returns 2 step when transposing two pairs of characters", function() {
assert.deepEqual(levenshtien("banana", "abnaan"), {
steps: 2,
relative: 2 / 6,
similarity: 1 - 2 / 6
});
});
});
describe("Empty strings", function() {
it("returns 0 step and 0 relative when both are empty", function() {
assert.deepEqual(levenshtien("", ""), {
steps: 0,
relative: 0,
similarity: 1
});
});
it("returns steps equal to first string lenght when second string is empty", function() {
assert.deepEqual(levenshtien("test", ""), {
steps: 4,
relative: 4 / 4,
similarity: 0
});
});
it("returns steps equal to second string lenght when first string is empty", function() {
assert.deepEqual(levenshtien("", "test"), {
steps: 4,
relative: 1,
similarity: 0
});
});
});
});