Skip to main content

Mocking the Review Functionality

With the View page in place, we can now mock the Review functionality. This allows us to simulate how an officer interacts with a submitted company, approving or rejecting it without a real backend.


Step 1: Create review.json

Create a new file in the src-mock/data folder named review.json. This file simulates the response a backend would return when the review process is started.

review.json
{
"id": "b6843532-f1f4-4e4e-93d1-8ee2d7be95bf",
"version": 1,
"data": {
"companyName": "Test Company",
"legalForm": "LLC",
"establishedDate": "2025-04-26",
"capital": 12123,
"employees": 12,
"type": {
"code": "IT",
"description": "Information Technology"
},
"phone": "123456789",
"email": "[email protected]",
"vatNumber": null,
"remark": null,
"address": {
"street": "67 street",
"city": "Los Angeles",
"state": "California",
"zip": "12345"
},
"website": "testcompany.it",
"shareholders": [
{
"id": "f40a683a-96df-43ea-a731-daeba18ef87f",
"firstName": "Alice",
"lastName": "Doe",
"phone": "123456789",
"email": "[email protected]",
"shares": 500,
"percentage": 50,
"_eid": "f40a683a-96df-43ea-a731-daeba18ef87f"
},
{
"id": "6b2f725e-5355-4899-bd00-df6ac815ed06",
"firstName": "Bob",
"lastName": "Doe",
"phone": "123456789",
"email": "[email protected]",
"shares": 500,
"percentage": 50,
"_eid": "6b2f725e-5355-4899-bd00-df6ac815ed06"
}
]
},
"metadata": {
"states": [
"SUBMITTED"
],
"tags": [],
"created": {
"startOperation": "NEW",
"operation": "SUBMIT",
"state": "SUBMITTED",
"user": {
"username": "bob",
"name": "Bob Doe"
},
"date": "2025-04-15",
"dateTime": "2025-04-15T18:12:53"
},
"prev": {
"startOperation": "",
"operation": "",
"state": "",
"user": {
"username": "",
"name": ""
},
"date": null,
"dateTime": null
},
"current": {
"startOperation": "NEW",
"operation": "SUBMIT",
"state": "SUBMITTED",
"user": {
"username": "bob",
"name": "Bob Doe"
},
"date": "2025-04-15",
"dateTime": "2025-04-15T18:12:53"
}
},
"startOperations": [
{
"id": "VIEW",
"type": "READ",
"ordinal": 1,
"uri": "/api/v1/registration/company/start-operations/b6843532-f1f4-4e4e-93d1-8ee2d7be95bf/view",
"security": {
"mustAuthenticate": true,
"mustAuthorize": true,
"roles": [
"company",
"officer"
],
"scopes": [],
"claims": []
},
"attributes": {}
}
],
"operations": [
{
"id": "approve",
"constant": "APPROVE",
"type": "UPDATE",
"ordinal": 1,
"uri": "/api/v1/registration/company/operations/b6843532-f1f4-4e4e-93d1-8ee2d7be95bf/approve",
"security": {
"mustAuthenticate": true,
"mustAuthorize": true,
"roles": [
"officer"
],
"scopes": [],
"claims": []
},
"startOperation": "REVIEW",
"startState": "SUBMITTED",
"endState": [
"APPROVED"
],
"attributes": {}
},
{
"id": "reject",
"constant": "REJECT",
"type": "UPDATE",
"ordinal": 2,
"uri": "/api/v1/registration/company/operations/b6843532-f1f4-4e4e-93d1-8ee2d7be95bf/reject",
"security": {
"mustAuthenticate": true,
"mustAuthorize": true,
"roles": [
"officer"
],
"scopes": [],
"claims": []
},
"startOperation": "REVIEW",
"startState": "SUBMITTED",
"endState": [
"REJECTED"
],
"attributes": {}
}
],
"attributes": {}
}

Step 2: Add approve.json and reject.json

These files simulate the response after submitting the review action.

  • approve.json
{
"id": "b6843532-f1f4-4e4e-93d1-8ee2d7be95bf",
"version": 1
}
  • reject.json
{
"id": "b6843532-f1f4-4e4e-93d1-8ee2d7be95bf",
"version": 1
}

Step 3: Register the Mock Endpoints

In your src-mock/index.cjs file, register the mock endpoints as follows:

app.get('/api/v1/registration/company/start-operations/:id/review', (req, res) => {
res.send(require('./data/review.json'));
});

app.put('/api/v1/registration/company/operations/:id/approve', (req, res) => {
res.send(require('./data/approve.json'));
});

app.put('/api/v1/registration/company/operations/:id/reject', (req, res) => {
res.send(require('./data/reject.json'));
});

Testing the Review Flow

Start the Review

From the View page, click the Review button (available only to users with the officer role).

View Review


Approve the Company

  1. Open the Registration tab.
  2. Fill in the VAT Number and optional Remarks.
  3. Click Approve.

View Approve


Reject the Company

To test rejection:

  1. Go back to the Search page.
  2. Open the company View page again.
  3. Click Review.
  4. Enter a Remark in the Registration tab.
  5. Click Reject.

View Reject


What’s Next

With the full review flow now mocked, you’re ready to connect to the real backend, covered in the Backend Integration section.