LOCATION_TYPE can move into location.js

This commit is contained in:
Girish Ramakrishnan
2023-08-17 16:05:19 +05:30
parent 5c98b6f080
commit 28bfab6700
3 changed files with 59 additions and 71 deletions
+4 -3
View File
@@ -10,6 +10,7 @@ const apps = require('../apps.js'),
BoxError = require('../boxerror.js'),
common = require('./common.js'),
expect = require('expect.js'),
Location = require('../location.js'),
safe = require('safetydance');
describe('Apps', function () {
@@ -20,17 +21,17 @@ describe('Apps', function () {
describe('validateLocations', function () {
it('does not allow reserved subdomain', async function () {
let location = { type: apps.LOCATION_TYPE_ALIAS, subdomain: 'my', domain: domain.domain };
let location = new Location('my', domain.domain, Location.TYPE_ALIAS);
expect(await apps._validateLocations([location])).to.be.an(Error);
});
it('does not allow unknown domain', async function () {
let location = { type: apps.LOCATION_TYPE_PRIMARY, subdomain: 'my2', domain: domain.domain + 'x' };
let location = new Location('my2', domain.domain + 'x', Location.TYPE_PRIMARY);
expect(await apps._validateLocations([location])).to.be.an(Error);
});
it('allows valid locations', async function () {
let location = { type: apps.LOCATION_TYPE_SECONDARY, subdomain: 'my2', domain: domain.domain };
let location = new Location('my2', domain.domain, Location.TYPE_SECONDARY);
expect(await apps._validateLocations([location])).to.be(null);
});
});