Skip to content

Commit

Permalink
Update route.spec.js
Browse files Browse the repository at this point in the history
  • Loading branch information
leungkinghin-ct committed Aug 11, 2023
1 parent a8d1464 commit a883932
Showing 1 changed file with 27 additions and 9 deletions.
36 changes: 27 additions & 9 deletions full-ingestion/test/route.spec.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,45 @@
import { expect, describe, beforeAll, afterAll, it } from '@jest/globals';
import request from 'supertest';
import server from '../src/index.js';
import { expect, describe, afterAll, it } from '@jest/globals';

/** Reminder : Please put mandatory environment variables in the settings of your github repository **/
describe('Test event.controller.js', () => {
const storeKey = 'MY_STORE_KEY'; // Specify the key of Commercetools Store for product synchronization

it(`POST /${storeKey}`, async () => {
let response = {};
// Send request to the connector application with following code statement
// Send request to the connector application with following code snippet.
/**
response = await request(server).post(`/${storeKey}`);
**/
import request from 'supertest';
import server from '../src/index.js';
response = await request(server).post(`/${storeKey}`);
**/
expect(response).toBeDefined();
});

it(`POST /`, async () => {
const res = await request(server).post(`/`);
expect(res.statusCode).toBe(404);
let response = {};
// Send request to the connector application with following code snippet.
/**
import request from 'supertest';
import server from '../src/index.js';
response = await request(server).post(`/`);
**/
expect(response).toBeDefined();
});

afterAll(() => {
if (server) {
// Enable the function below to close the application on server once all test cases are executed.
/**
if (server) {
server.close();
}
**/
});
});

0 comments on commit a883932

Please sign in to comment.