diff options
Diffstat (limited to 'server/tests/plugins/plugin-helpers.ts')
-rw-r--r-- | server/tests/plugins/plugin-helpers.ts | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/server/tests/plugins/plugin-helpers.ts b/server/tests/plugins/plugin-helpers.ts index 5e8d08dff..49807f8f5 100644 --- a/server/tests/plugins/plugin-helpers.ts +++ b/server/tests/plugins/plugin-helpers.ts | |||
@@ -110,6 +110,7 @@ describe('Test plugin helpers', function () { | |||
110 | }) | 110 | }) |
111 | 111 | ||
112 | describe('User', function () { | 112 | describe('User', function () { |
113 | let rootId: number | ||
113 | 114 | ||
114 | it('Should not get a user if not authenticated', async function () { | 115 | it('Should not get a user if not authenticated', async function () { |
115 | await makeGetRequest({ | 116 | await makeGetRequest({ |
@@ -132,6 +133,28 @@ describe('Test plugin helpers', function () { | |||
132 | expect(res.body.isAdmin).to.be.true | 133 | expect(res.body.isAdmin).to.be.true |
133 | expect(res.body.isModerator).to.be.false | 134 | expect(res.body.isModerator).to.be.false |
134 | expect(res.body.isUser).to.be.false | 135 | expect(res.body.isUser).to.be.false |
136 | |||
137 | rootId = res.body.id | ||
138 | }) | ||
139 | |||
140 | it('Should load a user by id', async function () { | ||
141 | { | ||
142 | const res = await makeGetRequest({ | ||
143 | url: servers[0].url, | ||
144 | path: '/plugins/test-four/router/user/' + rootId, | ||
145 | expectedStatus: HttpStatusCode.OK_200 | ||
146 | }) | ||
147 | |||
148 | expect(res.body.username).to.equal('root') | ||
149 | } | ||
150 | |||
151 | { | ||
152 | await makeGetRequest({ | ||
153 | url: servers[0].url, | ||
154 | path: '/plugins/test-four/router/user/42', | ||
155 | expectedStatus: HttpStatusCode.NOT_FOUND_404 | ||
156 | }) | ||
157 | } | ||
135 | }) | 158 | }) |
136 | }) | 159 | }) |
137 | 160 | ||