Skip to content
Snippets Groups Projects
Commit 5a067f51 authored by ManosAngelidis's avatar ManosAngelidis
Browse files

[NRRPLT-8625] eslint and moving the test to the right folder

parent 2ab4754c
No related branches found
No related tags found
No related merge requests found
......@@ -4,7 +4,7 @@
import '@testing-library/jest-dom';
import 'jest-fetch-mock';
import ModelsStorageService from '../models/models-storage-service';
import ModelsStorageService from '../models-storage-service'
test('makes sure that invoking the constructor fails with the right message', () => {
expect(() => {
......@@ -23,24 +23,24 @@ test('the service instance always refers to the same object', () => {
test('getTemplateModels function', async () => {
let modelsService = ModelsStorageService.instance;
// fetch template robots
let response = await modelsService.getTemplateModels(true,'robots',false);
let response = await modelsService.getTemplateModels(true, 'robots', false);
expect(response.name).toBe('hbp_clearpath_robotics_husky_a200');
expect(response.ownerName).toBe('nrpuser');
expect(response.type).toBe('robots');
// fetch custom robots
response = await modelsService.getTemplateModels(true,'robots',true);
response = await modelsService.getTemplateModels(true, 'robots', true);
expect(response.name).toBe('custom_hbp_clearpath_robotics_husky_a200');
expect(response.ownerName).toBe('nrpuser');
expect(response.type).toBe('robots');
expect(response.type).toBe('robots');
});
test('getCustomModelsByUser function', async () => {
let modelsService = ModelsStorageService.instance;
// fetch template robots
......@@ -52,19 +52,19 @@ test('getCustomModelsByUser function', async () => {
});
test('verifyModelType function', async () => {
let modelsService = ModelsStorageService.instance;
const expectedErrorPart = 'Error Type 400: Bad Request : The model type notRobots';
const expectedErrorPart = 'Error Type 400: Bad Request : The model type notRobots';
// fetch template robots
expect(()=>modelsService.verifyModelType('notRobots')).toThrowError(expectedErrorPart);
expect(() => modelsService.verifyModelType('notRobots')).toThrowError(expectedErrorPart);
});
test('setCustomModel function', async () => {
let modelsService = ModelsStorageService.instance;
let response = await modelsService.setCustomModel('robots','husky','fakeContent');
let response = await modelsService.setCustomModel('robots', 'husky', 'fakeContent');
expect(response.name).toBe('created_hbp_clearpath_robotics_husky_a200');
expect(response.ownerName).toBe('nrpuser');
expect(response.type).toBe('robots');
expect(response.type).toBe('robots');
});
......@@ -133,7 +133,6 @@ class ModelsStorageService extends HttpService {
try {
this.verifyModelType(modelType);
const setCustomModelURL = `${storageModelsURL}/${modelType}/${modelName}`;
console.log(setCustomModelURL)
return (await this.httpRequestPOST(setCustomModelURL, fileContent)).json();
}
catch (error) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment