Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commitf4f725f

Browse files
committed
feat(editor-export): add tests for uid generator
1 parent343eb8b commitf4f725f

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

‎test/helper/utils_test.exs‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,4 +162,20 @@ defmodule GroupherServer.Test.Helper.UtilsTest do
162162
assertfalse==Utils.less_than("lang",4,:no_equal)
163163
end
164164
end
165+
166+
describe"[uid generator]"do
167+
test"should gen uniq id with lengh of 5"do
168+
uid_str=Utils.uid(:html,"what_ever")
169+
assertString.length(uid_str)==5
170+
end
171+
172+
test"should never contains number"do
173+
uid_str=Utils.uid(:html,%{"id"=>""})
174+
assertString.match?(uid_str,~r/[0-9]/)==false
175+
end
176+
177+
test"exsit id will stay the same"do
178+
assert"exsit_id"==Utils.uid(:html,%{"id"=>"exsit_id"})
179+
end
180+
end
165181
end

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp