Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vernemq
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
stack
vernemq
Commits
f644cd7a
Commit
f644cd7a
authored
Sep 16, 2018
by
zCaesar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test
parent
43dc2eca
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
authhook/test/getTopicTest.js
+53
-0
No files found.
authhook/test/getTopicTest.js
0 → 100644
View file @
f644cd7a
var
assert
=
require
(
'assert'
)
var
getTopic
=
require
(
'../utils/getTopic'
).
getTopic
describe
(
'GetTopic'
,
()
=>
{
describe
(
'realtime msg'
,
()
=>
{
it
(
'should return topic that id_group have insert between @msg and topic'
,
()
=>
{
var
topic
=
'@msg/any/light'
var
id_group
=
'bulb'
var
tgConcat
=
'@msg/!bulb/any/light'
var
_topic
=
getTopic
(
topic
,
id_group
)
assert
.
equal
(
_topic
,
tgConcat
)
})
})
describe
(
'shadow'
,
()
=>
{
describe
(
'update pub'
,
()
=>
{
it
(
'should return topic that id have insert between @shadow/update and topic'
,
()
=>
{
var
topic
=
'@shadow/update/any/light'
var
id
=
'd4484cdb-a47a-4936-bcfd-33c1af39b857'
var
tgConcat
=
'@shadow/update/!d4484cdb-a47a-4936-bcfd-33c1af39b857/any/light'
var
_topic
=
getTopic
(
topic
,
id
)
assert
.
equal
(
_topic
,
tgConcat
)
})
})
describe
(
'update sub'
,
()
=>
{
it
(
'should return topic that id have insert behind @shadow/updated'
,
()
=>
{
var
topic
=
'@shadow/updated'
var
id
=
'd4484cdb-a47a-4936-bcfd-33c1af39b857'
var
tgConcat
=
'@shadow/updated/!d4484cdb-a47a-4936-bcfd-33c1af39b857'
var
_topic
=
getTopic
(
topic
,
id
)
assert
.
equal
(
_topic
,
tgConcat
)
})
})
describe
(
'get pub'
,
()
=>
{
it
(
'should return topic that id have insert between @shadow/get and topic'
,
()
=>
{
var
topic
=
'@shadow/get/any/light'
var
id
=
'd4484cdb-a47a-4936-bcfd-33c1af39b857'
var
tgConcat
=
'@shadow/get/!d4484cdb-a47a-4936-bcfd-33c1af39b857/any/light'
var
_topic
=
getTopic
(
topic
,
id
)
assert
.
equal
(
_topic
,
tgConcat
)
})
})
describe
(
'get sub'
,
()
=>
{
it
(
'should return topic that id have insert between @client and #'
,
()
=>
{
var
topic
=
'@client/#'
var
id
=
'd4484cdb-a47a-4936-bcfd-33c1af39b857'
var
tgConcat
=
'@client/!d4484cdb-a47a-4936-bcfd-33c1af39b857/#'
var
_topic
=
getTopic
(
topic
,
id
)
assert
.
equal
(
_topic
,
tgConcat
)
})
})
})
})
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment