Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Sharkey
Manage
Activity
Members
Labels
Plan
Issues
342
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
27
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TransFem.org
Sharkey
Commits
76aaa340
Commit
76aaa340
authored
8 years ago
by
syuilo
Browse files
Options
Downloads
Patches
Plain Diff
[Test] Add some messaging tests
parent
df344063
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/api.ts
+72
-0
72 additions, 0 deletions
test/api.ts
with
72 additions
and
0 deletions
test/api.ts
+
72
−
0
View file @
76aaa340
...
...
@@ -1193,6 +1193,78 @@ describe('API', () => {
});
});
describe
(
'
messaging/messages/create
'
,
()
=>
{
it
(
'
メッセージを送信できる
'
,
()
=>
async
(
done
)
=>
{
const
me
=
await
insertSakurako
();
const
hima
=
await
insertHimawari
();
request
(
'
/messaging/messages/create
'
,
{
user_id
:
hima
.
_id
.
toString
(),
text
:
'
Hey hey ひまわり
'
}).
then
(
res
=>
{
res
.
should
.
have
.
status
(
200
);
res
.
body
.
should
.
be
.
a
(
'
object
'
);
res
.
body
.
should
.
have
.
property
(
'
text
'
).
eql
(
'
Hey hey ひまわり
'
);
done
();
});
});
it
(
'
自分自身にはメッセージを送信できない
'
,
()
=>
async
(
done
)
=>
{
const
me
=
await
insertSakurako
();
request
(
'
/messaging/messages/create
'
,
{
user_id
:
me
.
_id
.
toString
(),
text
:
'
Yo
'
}).
then
(
res
=>
{
res
.
should
.
have
.
status
(
400
);
done
();
});
});
it
(
'
存在しないユーザーにはメッセージを送信できない
'
,
()
=>
async
(
done
)
=>
{
const
me
=
await
insertSakurako
();
request
(
'
/messaging/messages/create
'
,
{
user_id
:
'
000000000000000000000000
'
,
text
:
'
Yo
'
}).
then
(
res
=>
{
res
.
should
.
have
.
status
(
400
);
done
();
});
});
it
(
'
不正なユーザーIDで怒られる
'
,
()
=>
async
(
done
)
=>
{
const
me
=
await
insertSakurako
();
request
(
'
/messaging/messages/create
'
,
{
user_id
:
'
kyoppie
'
,
text
:
'
Yo
'
}).
then
(
res
=>
{
res
.
should
.
have
.
status
(
400
);
done
();
});
});
it
(
'
テキストが無くて怒られる
'
,
()
=>
async
(
done
)
=>
{
const
me
=
await
insertSakurako
();
const
hima
=
await
insertHimawari
();
request
(
'
/messaging/messages/create
'
,
{
user_id
:
hima
.
_id
.
toString
()
}).
then
(
res
=>
{
res
.
should
.
have
.
status
(
400
);
done
();
});
});
it
(
'
文字数オーバーで怒られる
'
,
()
=>
async
(
done
)
=>
{
const
me
=
await
insertSakurako
();
const
hima
=
await
insertHimawari
();
request
(
'
/messaging/messages/create
'
,
{
user_id
:
hima
.
_id
.
toString
(),
text
:
'
!
'
.
repeat
(
501
)
}).
then
(
res
=>
{
res
.
should
.
have
.
status
(
400
);
done
();
});
});
});
describe
(
'
auth/session/generate
'
,
()
=>
{
it
(
'
認証セッションを作成できる
'
,
()
=>
async
(
done
)
=>
{
const
app
=
await
insertApp
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment