mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
49e19cad64
Add group and institution membership and management info to subscription dashboard GitOrigin-RevId: 1aba5d5a20cd00ff5090811d0f66dc9c4944dd60
42 lines
1.2 KiB
CoffeeScript
42 lines
1.2 KiB
CoffeeScript
should = require('chai').should()
|
|
assert = require('chai').assert
|
|
async = require("async")
|
|
request = require "./helpers/request"
|
|
MockV1Api = require "./helpers/MockV1Api"
|
|
|
|
assertResponse = (path, expectedStatusCode, expectedBody, cb) ->
|
|
request.get path, (error, response) ->
|
|
should.not.exist error
|
|
response.statusCode.should.equal expectedStatusCode
|
|
assert.deepEqual(JSON.parse(response.body), expectedBody) if expectedBody
|
|
cb()
|
|
|
|
describe "ProxyUrls", ->
|
|
before ->
|
|
@timeout(1000)
|
|
|
|
it 'proxy static URLs', (done) ->
|
|
async.series [
|
|
(cb) -> assertResponse '/institutions/list', 200, [], cb
|
|
(cb) -> assertResponse '/institutions/domains', 200, [], cb
|
|
],
|
|
done
|
|
|
|
it 'proxy dynamic URLs', (done) ->
|
|
async.series [
|
|
(cb) -> assertResponse '/institutions/list/123', 200, { id: 123, name: "Institution 123" }, cb
|
|
(cb) -> assertResponse '/institutions/list/456', 200, { id: 456, name: "Institution 456" }, cb
|
|
],
|
|
done
|
|
|
|
it 'return 404 if proxy is not set', (done) ->
|
|
async.series [
|
|
(cb) -> assertResponse '/institutions/foobar', 404, null, cb
|
|
],
|
|
done
|
|
|
|
it 'handle missing baseUrl', (done) ->
|
|
async.series [
|
|
(cb) -> assertResponse '/proxy/missing/baseUrl', 500, null, cb
|
|
],
|
|
done
|