Skip to content

Commit

Permalink
run linter
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcook1186 committed Oct 30, 2023
1 parent b92c392 commit 7f78271
Show file tree
Hide file tree
Showing 21 changed files with 156 additions and 153 deletions.
10 changes: 5 additions & 5 deletions scripts/impact.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { parseProcessArgument } from '../src/util/args';
import { ModelsUniverse } from '../src/util/models-universe';
import { Supercomputer } from '../src/util/supercomputer';
import { openYamlFileAsObject, saveYamlFileAs } from '../src/util/yaml';
import {parseProcessArgument} from '../src/util/args';
import {ModelsUniverse} from '../src/util/models-universe';
import {Supercomputer} from '../src/util/supercomputer';
import {openYamlFileAsObject, saveYamlFileAs} from '../src/util/yaml';

/**
* 1. Parses yml input/output process arguments.
Expand All @@ -16,7 +16,7 @@ const impactScript = async () => {
const processParams = parseProcessArgument();

if (processParams) {
const { inputPath, outputPath } = processParams;
const {inputPath, outputPath} = processParams;
const impl = await openYamlFileAsObject(inputPath);

if (!('graph' in impl)) {
Expand Down
8 changes: 4 additions & 4 deletions src/__mocks__/model-universe/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IOutputModelInterface } from '../../lib';
import {IOutputModelInterface} from '../../lib';

import {
ImplInitializeModel,
Expand All @@ -14,9 +14,9 @@ class MockModel implements IOutputModelInterface {
return Promise.resolve(this);
}
execute(): Promise<any[]> {
return Promise.resolve([{ data: 'mock-data' }]);
return Promise.resolve([{data: 'mock-data'}]);
}
authenticate(): void { }
authenticate(): void {}
}

/**
Expand Down Expand Up @@ -46,7 +46,7 @@ export class ModelsUniverse {
* Initializes and registers model.
*/
public writeDown(model: ImplInitializeModel) {
const { name } = model;
const {name} = model;

const Model = this.handModelByCriteria();

Expand Down
64 changes: 32 additions & 32 deletions src/__tests__/unit/lib/boavizta/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { describe, expect, jest, test } from '@jest/globals';
import {describe, expect, jest, test} from '@jest/globals';
import {
BoaviztaCloudoutputModel,
BoaviztaCpuoutputModel,
} from '../../../../lib/boavizta/index';
import axios, { AxiosResponse } from 'axios';
import axios, {AxiosResponse} from 'axios';
import * as PROVIDERS from '../../../../__mocks__/boavizta/providers.json';
import * as COUNTRIES from '../../../../__mocks__/boavizta/countries.json';
import * as INSTANCE_TYPES from '../../../../__mocks__/boavizta/instance_types.json';
Expand All @@ -13,9 +13,9 @@ async function axiosGet<T = any, R = AxiosResponse<T, any>>(
): Promise<R> {
switch (url) {
case 'https://api.boavizta.org/v1/cloud/instance/all_providers':
return { data: PROVIDERS } as R;
return {data: PROVIDERS} as R;
case 'https://api.boavizta.org/v1/utils/country_code':
return Promise.resolve({ data: COUNTRIES } as R);
return Promise.resolve({data: COUNTRIES} as R);
case 'https://api.boavizta.org/v1/cloud/instance/all_instances?provider=aws':
return Promise.resolve({
data: INSTANCE_TYPES['aws'],
Expand All @@ -42,7 +42,7 @@ mockAxios.post.mockImplementation(
max: 0.003113,
warnings: ['End of life is not included in the calculation'],
},
use: { value: 0.06743, min: 0.06743, max: 0.06743 },
use: {value: 0.06743, min: 0.06743, max: 0.06743},
unit: 'kgCO2eq',
description: 'Total climate change',
},
Expand All @@ -53,7 +53,7 @@ mockAxios.post.mockImplementation(
max: 7.771e-7,
warnings: ['End of life is not included in the calculation'],
},
use: { value: 1.796e-8, min: 1.796e-8, max: 1.796e-8 },
use: {value: 1.796e-8, min: 1.796e-8, max: 1.796e-8},
unit: 'kgSbeq',
description: 'Use of minerals and fossil ressources',
},
Expand All @@ -64,7 +64,7 @@ mockAxios.post.mockImplementation(
max: 0.04314,
warnings: ['End of life is not included in the calculation'],
},
use: { value: 2.07, min: 2.07, max: 2.07 },
use: {value: 2.07, min: 2.07, max: 2.07},
unit: 'MJ',
description: 'Consumption of primary energy',
},
Expand All @@ -82,7 +82,7 @@ mockAxios.post.mockImplementation(
max: 0.006226,
warnings: ['End of life is not included in the calculation'],
},
use: { value: 0.1924, min: 0.1924, max: 0.1924 },
use: {value: 0.1924, min: 0.1924, max: 0.1924},
unit: 'kgCO2eq',
description: 'Total climate change',
},
Expand All @@ -93,7 +93,7 @@ mockAxios.post.mockImplementation(
max: 0.000001554,
warnings: ['End of life is not included in the calculation'],
},
use: { value: 5.126e-8, min: 5.126e-8, max: 5.126e-8 },
use: {value: 5.126e-8, min: 5.126e-8, max: 5.126e-8},
unit: 'kgSbeq',
description: 'Use of minerals and fossil ressources',
},
Expand All @@ -104,7 +104,7 @@ mockAxios.post.mockImplementation(
max: 0.08627,
warnings: ['End of life is not included in the calculation'],
},
use: { value: 5.907, min: 5.907, max: 5.907 },
use: {value: 5.907, min: 5.907, max: 5.907},
unit: 'MJ',
description: 'Consumption of primary energy',
},
Expand All @@ -120,7 +120,7 @@ mockAxios.post.mockImplementation(
'End of life is not included in the calculation',
],
},
use: { value: 0.1924, min: 0.1924, max: 0.1924 },
use: {value: 0.1924, min: 0.1924, max: 0.1924},
unit: 'kgCO2eq',
description: 'Total climate change',
},
Expand All @@ -133,7 +133,7 @@ mockAxios.post.mockImplementation(
'End of life is not included in the calculation',
],
},
use: { value: 5.126e-8, min: 5.126e-8, max: 5.126e-8 },
use: {value: 5.126e-8, min: 5.126e-8, max: 5.126e-8},
unit: 'kgSbeq',
description: 'Use of minerals and fossil ressources',
},
Expand All @@ -146,12 +146,12 @@ mockAxios.post.mockImplementation(
'End of life is not included in the calculation',
],
},
use: { value: 5.907, min: 5.907, max: 5.907 },
use: {value: 5.907, min: 5.907, max: 5.907},
unit: 'MJ',
description: 'Consumption of primary energy',
},
},
units: { value: 1, status: 'ARCHETYPE', min: 1, max: 1 },
units: {value: 1, status: 'ARCHETYPE', min: 1, max: 1},
die_size: {
value: 521,
status: 'COMPLETED',
Expand All @@ -160,15 +160,15 @@ mockAxios.post.mockImplementation(
min: 41.2,
max: 3640,
},
duration: { value: 2, unit: 'hours' },
duration: {value: 2, unit: 'hours'},
avg_power: {
value: 260.05,
status: 'COMPLETED',
unit: 'W',
min: 260.05,
max: 260.05,
},
time_workload: { value: 100, status: 'INPUT', unit: '%' },
time_workload: {value: 100, status: 'INPUT', unit: '%'},
usage_location: {
value: 'USA',
status: 'INPUT',
Expand All @@ -189,7 +189,7 @@ mockAxios.post.mockImplementation(
max: 26280,
},
params: {
value: { a: 171.2, b: 0.0354, c: 36.89, d: -10.13 },
value: {a: 171.2, b: 0.0354, c: 36.89, d: -10.13},
status: 'ARCHETYPE',
},
gwp_factor: {
Expand Down Expand Up @@ -230,7 +230,7 @@ mockAxios.post.mockImplementation(
max: 0.006226,
warnings: ['End of life is not included in the calculation'],
},
use: { value: 0.1924, min: 0.1924, max: 0.1924 },
use: {value: 0.1924, min: 0.1924, max: 0.1924},
unit: 'kgCO2eq',
description: 'Total climate change',
},
Expand All @@ -241,7 +241,7 @@ mockAxios.post.mockImplementation(
max: 0.000001554,
warnings: ['End of life is not included in the calculation'],
},
use: { value: 5.126e-8, min: 5.126e-8, max: 5.126e-8 },
use: {value: 5.126e-8, min: 5.126e-8, max: 5.126e-8},
unit: 'kgSbeq',
description: 'Use of minerals and fossil ressources',
},
Expand All @@ -252,7 +252,7 @@ mockAxios.post.mockImplementation(
max: 0.08627,
warnings: ['End of life is not included in the calculation'],
},
use: { value: 5.907, min: 5.907, max: 5.907 },
use: {value: 5.907, min: 5.907, max: 5.907},
unit: 'MJ',
description: 'Consumption of primary energy',
},
Expand All @@ -268,7 +268,7 @@ mockAxios.post.mockImplementation(
'End of life is not included in the calculation',
],
},
use: { value: 0.1924, min: 0.1924, max: 0.1924 },
use: {value: 0.1924, min: 0.1924, max: 0.1924},
unit: 'kgCO2eq',
description: 'Total climate change',
},
Expand All @@ -281,7 +281,7 @@ mockAxios.post.mockImplementation(
'End of life is not included in the calculation',
],
},
use: { value: 5.126e-8, min: 5.126e-8, max: 5.126e-8 },
use: {value: 5.126e-8, min: 5.126e-8, max: 5.126e-8},
unit: 'kgSbeq',
description: 'Use of minerals and fossil ressources',
},
Expand All @@ -294,12 +294,12 @@ mockAxios.post.mockImplementation(
'End of life is not included in the calculation',
],
},
use: { value: 5.907, min: 5.907, max: 5.907 },
use: {value: 5.907, min: 5.907, max: 5.907},
unit: 'MJ',
description: 'Consumption of primary energy',
},
},
units: { value: 1, status: 'ARCHETYPE', min: 1, max: 1 },
units: {value: 1, status: 'ARCHETYPE', min: 1, max: 1},
die_size: {
value: 521,
status: 'COMPLETED',
Expand All @@ -308,15 +308,15 @@ mockAxios.post.mockImplementation(
min: 41.2,
max: 3640,
},
duration: { value: 2, unit: 'hours' },
duration: {value: 2, unit: 'hours'},
avg_power: {
value: 260.05,
status: 'COMPLETED',
unit: 'W',
min: 260.05,
max: 260.05,
},
time_workload: { value: 100, status: 'INPUT', unit: '%' },
time_workload: {value: 100, status: 'INPUT', unit: '%'},
usage_location: {
value: 'USA',
status: 'INPUT',
Expand All @@ -337,7 +337,7 @@ mockAxios.post.mockImplementation(
max: 26280,
},
params: {
value: { a: 171.2, b: 0.0354, c: 36.89, d: -10.13 },
value: {a: 171.2, b: 0.0354, c: 36.89, d: -10.13},
status: 'ARCHETYPE',
},
gwp_factor: {
Expand Down Expand Up @@ -376,7 +376,7 @@ describe('cpu:configure test', () => {
test('initialize wrong params should throw error', async () => {
const outputModel = new BoaviztaCpuOutputModel();
await expect(
outputModel.configure('test', { allocation: 'wrong' })
outputModel.configure('test', {allocation: 'wrong'})
).rejects.toThrowError();
expect(outputModel.name).toBe('test');
});
Expand Down Expand Up @@ -422,7 +422,7 @@ describe('cpu:configure test', () => {
);
// improper inputs will throw an invalid inputs error
await expect(
outputModel.execute([{ invalid: 'input' }])
outputModel.execute([{invalid: 'input'}])
).rejects.toStrictEqual(Error('Invalid Input: Invalid inputs parameter'));
});
});
Expand Down Expand Up @@ -488,13 +488,13 @@ describe('cloud:initialize with params', () => {
const outputModel = new BoaviztaCloudoutputModel();
expect(outputModel.modelIdentifier()).toBe('org.boavizta.cloud.sci');
await expect(
outputModel.validateLocation({ location: 'SomethingFail' })
outputModel.validateLocation({location: 'SomethingFail'})
).rejects.toThrowError();
await expect(
outputModel.validateInstanceType({ 'instance-type': 'SomethingFail' })
outputModel.validateInstanceType({'instance-type': 'SomethingFail'})
).rejects.toThrowError();
await expect(
outputModel.validateProvider({ provider: 'SomethingFail' })
outputModel.validateProvider({provider: 'SomethingFail'})
).rejects.toThrowError();
await expect(
outputModel.configure('test', {
Expand Down
6 changes: 3 additions & 3 deletions src/__tests__/unit/util/observatory.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, it, jest } from '@jest/globals';
import { Observatory } from '../../../util/observatory';
import { BoaviztaCpuoutputModel } from '../../../lib';
import {describe, expect, it, jest} from '@jest/globals';
import {Observatory} from '../../../util/observatory';
import {BoaviztaCpuoutputModel} from '../../../lib';

describe('util/observatory: ', () => {
const expectedValue = [
Expand Down
Loading

0 comments on commit 7f78271

Please sign in to comment.