Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,23 @@
"express-basic-auth": "^1.2.1",
"express-rate-limit": "^7.3.1",
"express-validator": "^7.1.0",
"graphql": "^16.8.1",
"graphql": "^16.8.2",
"graphql-http": "^1.22.1",
"graphql-tag": "^2.12.6",
"helmet": "^7.1.0",
"jsonwebtoken": "^9.0.2",
"moment": "^2.30.1",
"mongodb": "^6.7.0",
"mongoose": "^8.4.1",
"pino": "^9.1.0",
"pino-pretty": "^11.2.0",
"mongoose": "^8.4.3",
"pino": "^9.2.0",
"pino-pretty": "^11.2.1",
"swagger-ui-express": "^5.0.1",
"switcher-client": "^4.1.1",
"validator": "^13.12.0"
},
"devDependencies": {
"env-cmd": "^10.1.0",
"eslint": "^9.4.0",
"eslint": "^9.5.0",
"jest": "^29.7.0",
"jest-sonar-reporter": "^2.0.0",
"node-notifier": "^10.0.1",
Expand Down
1 change: 1 addition & 0 deletions src/routers/domain.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ router.patch('/domain/transfer/accept', auth, [
check('domain').isMongoId()
], validate, async (req, res) => {
try {
await checkDomain(req);
const domain = await Services.transferDomainAccept(req.body, req.admin);
res.send(domain);
} catch (e) {
Expand Down
22 changes: 22 additions & 0 deletions tests/domain.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
teamId
} from './fixtures/db_api';
import Component from '../src/models/component';
import { Client } from 'switcher-client';

afterAll(async () => {
await new Promise(resolve => setTimeout(resolve, 1000));
Expand Down Expand Up @@ -638,6 +639,27 @@ describe('Testing transfer Domain', () => {
}).expect(404);
});

test('DOMAIN_SUITE - Should NOT accept Domain to transfer - Domain quota exceeded', async () => {
//given
process.env.SWITCHER_API_ENABLE = true;
Client.assume('ELEMENT_CREATION').false();

//test
const response = await request(app)
.patch('/domain/transfer/accept')
.set('Authorization', `Bearer ${adminAccountToken}`)
.send({
domain: domainId
}).expect(400);

expect(response.body.error).toBe('Domain limit has been reached.');

//teardown
process.env.SWITCHER_API_ENABLE = false;
Client.forget('ELEMENT_CREATION');
});


test('DOMAIN_SUITE - Should accept Domain to transfer', async () => {
//given 'domainId' to be transfered
await request(app)
Expand Down