Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
RocketChat
Rocket.Chat.js.SDK
Commits
52a2cf88
Commit
52a2cf88
authored
Aug 09, 2018
by
Tim Kinnane
Browse files
fix(pretest): Fix setup of private group
parent
90120b4e
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
dist/utils/testing.d.ts
View file @
52a2cf88
...
...
@@ -22,7 +22,7 @@ export declare function lastMessages(roomId: string, count?: number): Promise<IM
/** Create a room for tests and catch the error if it exists already */
export
declare
function
createChannel
(
name
:
string
,
members
?:
string
[],
readOnly
?:
boolean
):
Promise
<
IChannelResultAPI
>
;
/** Create a private group / room and catch if exists already */
export
declare
function
createPrivate
(
name
:
string
,
members
?:
string
[],
readOnly
?:
boolean
):
Promise
<
I
Channel
ResultAPI
>
;
export
declare
function
createPrivate
(
name
:
string
,
members
?:
string
[],
readOnly
?:
boolean
):
Promise
<
I
Group
ResultAPI
>
;
/** Send message from mock user to channel for tests to listen and respond */
/** @todo Sometimes the post request completes before the change event emits
* the message to the streamer. That's why the interval is used for proof
...
...
dist/utils/testing.js
View file @
52a2cf88
...
...
@@ -181,7 +181,7 @@ function setup() {
console
.
log
(
`Test channel (
${
exports
.
testChannelName
}
) exists`
);
}
// Verify or create private room for tests
let
testPrivateInfo
=
yield
channel
Info
({
roomName
:
exports
.
testPrivateName
});
let
testPrivateInfo
=
yield
private
Info
({
roomName
:
exports
.
testPrivateName
});
if
(
!
testPrivateInfo
||
!
testPrivateInfo
.
success
)
{
console
.
log
(
`Test private room (
${
exports
.
testPrivateName
}
) not found`
);
testPrivateInfo
=
yield
createPrivate
(
exports
.
testPrivateName
,
[
...
...
dist/utils/testing.js.map
View file @
52a2cf88
This diff is collapsed.
Click to expand it.
src/utils/testing.ts
View file @
52a2cf88
...
...
@@ -59,7 +59,7 @@ export async function createPrivate (
name
:
string
,
members
:
string
[]
=
[],
readOnly
:
boolean
=
false
):
Promise
<
I
Channel
ResultAPI
>
{
):
Promise
<
I
Group
ResultAPI
>
{
return
post
(
'
groups.create
'
,
{
name
,
members
,
readOnly
},
true
)
}
...
...
@@ -167,7 +167,7 @@ export async function setup () {
}
// Verify or create private room for tests
let
testPrivateInfo
=
await
channel
Info
({
roomName
:
testPrivateName
})
let
testPrivateInfo
=
await
private
Info
({
roomName
:
testPrivateName
})
if
(
!
testPrivateInfo
||
!
testPrivateInfo
.
success
)
{
console
.
log
(
`Test private room (
${
testPrivateName
}
) not found`
)
testPrivateInfo
=
await
createPrivate
(
testPrivateName
,
[
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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