Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nginx-push-stream-module
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
nginx-push-stream-module
Commits
c7071475
Commit
c7071475
authored
Oct 06, 2013
by
Wandenberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix some js tests syntax
parent
43d397f7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
22 deletions
+16
-22
nginx.conf
misc/nginx.conf
+3
-3
PushStreamSpec.js
misc/spec/javascripts/PushStreamSpec.js
+10
-16
UtilsSpec.js
misc/spec/javascripts/UtilsSpec.js
+3
-3
No files found.
misc/nginx.conf
View file @
c7071475
...
@@ -138,8 +138,6 @@ http {
...
@@ -138,8 +138,6 @@ http {
# activate long-polling mode for this location
# activate long-polling mode for this location
push_stream_subscriber
long-polling
;
push_stream_subscriber
long-polling
;
push_stream_longpolling_connection_ttl
1s
;
push_stream_message_template
"
{
\"id\":~id~,\"channel\":\"~channel~\",\"text\":\"~text~\",
\
"tag
\
":
\
"~tag~
\
",
\
"time
\
":
\
"~time~
\
"
}
"
;
push_stream_message_template
"
{
\"id\":~id~,\"channel\":\"~channel~\",\"text\":\"~text~\",
\
"tag
\
":
\
"~tag~
\
",
\
"time
\
":
\
"~time~
\
"
}
"
;
push_stream_last_received_message_time
"
$arg_time
"
;
push_stream_last_received_message_time
"
$arg_time
"
;
...
@@ -169,7 +167,9 @@ http {
...
@@ -169,7 +167,9 @@ http {
}
}
location
/
{
location
/
{
if
(!-f
$request_filename
)
{
proxy_pass
"http://localhost:8888"
;
proxy_pass
"http://localhost:8888"
;
}
}
}
}
}
}
}
misc/spec/javascripts/PushStreamSpec.js
View file @
c7071475
...
@@ -251,7 +251,7 @@ describe("PushStream", function() {
...
@@ -251,7 +251,7 @@ describe("PushStream", function() {
afterEach
(
function
()
{
window
.
EventSource
=
eventsourceClass
;
});
afterEach
(
function
()
{
window
.
EventSource
=
eventsourceClass
;
});
it
(
"
should use only connection modes supported by the browser on the given order
"
,
function
()
{
it
(
"
should use only connection modes supported by the browser on the given order
"
,
function
()
{
var
pushstream
=
new
PushStream
({
modes
:
"
stream|eventsource|longpolling
"
})
var
pushstream
=
new
PushStream
({
modes
:
"
stream|eventsource|longpolling
"
})
;
expect
(
pushstream
.
wrappers
.
length
).
toBe
(
2
);
expect
(
pushstream
.
wrappers
.
length
).
toBe
(
2
);
expect
(
pushstream
.
wrappers
[
0
].
type
).
toBe
(
"
Stream
"
);
expect
(
pushstream
.
wrappers
[
0
].
type
).
toBe
(
"
Stream
"
);
expect
(
pushstream
.
wrappers
[
1
].
type
).
toBe
(
"
LongPolling
"
);
expect
(
pushstream
.
wrappers
[
1
].
type
).
toBe
(
"
LongPolling
"
);
...
@@ -314,11 +314,7 @@ describe("PushStream", function() {
...
@@ -314,11 +314,7 @@ describe("PushStream", function() {
useJSONP
:
jsonp
,
useJSONP
:
jsonp
,
urlPrefixLongpolling
:
urlPrefixLongpolling
,
urlPrefixLongpolling
:
urlPrefixLongpolling
,
onmessage
:
function
(
text
,
id
,
channel
,
eventid
,
isLastMessageFromBatch
)
{
onmessage
:
function
(
text
,
id
,
channel
,
eventid
,
isLastMessageFromBatch
)
{
expect
(
text
).
toBe
(
"
a test message
"
);
expect
([
text
,
id
,
channel
,
eventid
,
isLastMessageFromBatch
]).
toEqual
([
"
a test message
"
,
1
,
channelName
,
""
,
true
]);
expect
(
id
).
toBe
(
1
);
expect
(
channel
).
toBe
(
channelName
);
expect
(
eventid
).
toBe
(
""
);
expect
(
isLastMessageFromBatch
).
toBeTruthy
();
receivedMessage
=
true
;
receivedMessage
=
true
;
}
}
});
});
...
@@ -398,11 +394,13 @@ describe("PushStream", function() {
...
@@ -398,11 +394,13 @@ describe("PushStream", function() {
waitsFor
(
function
()
{
return
pushstream
.
channelsCount
>=
2
;
},
"
Channel not added
"
,
300
);
waitsFor
(
function
()
{
return
pushstream
.
channelsCount
>=
2
;
},
"
Channel not added
"
,
300
);
runs
(
function
()
{
runs
(
function
()
{
setTimeout
(
function
()
{
$
.
post
(
"
http://
"
+
nginxServer
+
"
/pub?id=
"
+
channelName
,
"
a test message
"
,
function
()
{
$
.
post
(
"
http://
"
+
nginxServer
+
"
/pub?id=
"
+
channelName
,
"
a test message
"
,
function
()
{
setTimeout
(
function
()
{
setTimeout
(
function
()
{
$
.
post
(
"
http://
"
+
nginxServer
+
"
/pub?id=
"
+
"
other_
"
+
channelName
,
"
message on other channel
"
);
$
.
post
(
"
http://
"
+
nginxServer
+
"
/pub?id=
"
+
"
other_
"
+
channelName
,
"
message on other channel
"
);
},
700
);
},
700
);
});
});
},
700
);
});
});
waitsFor
(
function
()
{
waitsFor
(
function
()
{
...
@@ -471,11 +469,7 @@ describe("PushStream", function() {
...
@@ -471,11 +469,7 @@ describe("PushStream", function() {
return
{
"
tests
"
:
"
on
"
};
return
{
"
tests
"
:
"
on
"
};
},
},
onmessage
:
function
(
text
,
id
,
channel
,
eventid
,
isLastMessageFromBatch
)
{
onmessage
:
function
(
text
,
id
,
channel
,
eventid
,
isLastMessageFromBatch
)
{
expect
(
text
).
toBe
(
"
a test message
"
);
expect
([
text
,
id
,
channel
,
eventid
,
isLastMessageFromBatch
]).
toEqual
([
"
a test message
"
,
1
,
"
test_
"
+
channelName
,
""
,
true
]);
expect
(
id
).
toBe
(
1
);
expect
(
channel
).
toBe
(
"
test_
"
+
channelName
);
expect
(
eventid
).
toBe
(
""
);
expect
(
isLastMessageFromBatch
).
toBeTruthy
();
receivedMessage
=
true
;
receivedMessage
=
true
;
}
}
});
});
...
...
misc/spec/javascripts/UtilsSpec.js
View file @
c7071475
...
@@ -85,7 +85,7 @@ describe("Utils", function() {
...
@@ -85,7 +85,7 @@ describe("Utils", function() {
it
(
"
should use the browser default implementation when available
"
,
function
()
{
it
(
"
should use the browser default implementation when available
"
,
function
()
{
spyOn
(
window
.
JSON
,
"
parse
"
);
spyOn
(
window
.
JSON
,
"
parse
"
);
Utils
.
parseJSON
(
'
{"a":1}
'
)
Utils
.
parseJSON
(
'
{"a":1}
'
)
;
expect
(
window
.
JSON
.
parse
).
toHaveBeenCalledWith
(
'
{"a":1}
'
);
expect
(
window
.
JSON
.
parse
).
toHaveBeenCalledWith
(
'
{"a":1}
'
);
});
});
...
@@ -102,7 +102,7 @@ describe("Utils", function() {
...
@@ -102,7 +102,7 @@ describe("Utils", function() {
});
});
it
(
"
should raise error when string is a invalid json
"
,
function
()
{
it
(
"
should raise error when string is a invalid json
"
,
function
()
{
expect
(
function
()
{
Utils
.
parseJSON
(
'
{"a":1[]}
'
)
}).
toThrow
(
'
Invalid JSON: {"a":1[]}
'
);
expect
(
function
()
{
Utils
.
parseJSON
(
'
{"a":1[]}
'
)
;
}).
toThrow
(
'
Invalid JSON: {"a":1[]}
'
);
});
});
});
});
}
}
...
@@ -131,7 +131,7 @@ describe("Utils", function() {
...
@@ -131,7 +131,7 @@ describe("Utils", function() {
});
});
it
(
"
should raise error when string is a invalid json
"
,
function
()
{
it
(
"
should raise error when string is a invalid json
"
,
function
()
{
expect
(
function
()
{
Utils
.
parseJSON
(
'
{"a":1[]}
'
)
}).
toThrow
(
'
Invalid JSON: {"a":1[]}
'
);
expect
(
function
()
{
Utils
.
parseJSON
(
'
{"a":1[]}
'
)
;
}).
toThrow
(
'
Invalid JSON: {"a":1[]}
'
);
});
});
});
});
});
});
...
...
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