Skip to content

Commit

Permalink
chore: cext-2311: fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
dani97 committed Sep 29, 2023
1 parent 26e5433 commit 317af52
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
21 changes: 15 additions & 6 deletions src/commands/api-mesh/__tests__/run.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ governing permissions and limitations under the License.
*/

const RunCommand = require('../run');
const {
startGraphqlServer,
interpolateMesh,
importFiles,
} = require('../../../helpers');
const { startGraphqlServer, interpolateMesh } = require('../../../helpers');
require('@testmeshbuilder/mesh-builder');
jest.mock('../../../helpers', () => ({
initRequestId: jest.fn().mockResolvedValue({}),
Expand Down Expand Up @@ -179,6 +175,9 @@ describe('run command tests', () => {
[
"Unable to read the file src/commands/__fixtures__/.env_nonExisting. Please check the file and try again.",
],
[
"Unable to read the file src/commands/__fixtures__/.env_nonExisting. Please check the file and try again.",
],
]
`);
});
Expand All @@ -204,6 +203,9 @@ describe('run command tests', () => {
[
"Issue in src/commands/__fixtures__/env_invalid file - Duplicate key << key1 >> on line 3,Invalid format for key/value << key2=='value3' >> on line 5,Invalid format << key3 >> on line 6,Invalid format for key/value << key4='value4 >> on line 7",
],
[
"Issue in src/commands/__fixtures__/env_invalid file - Duplicate key << key1 >> on line 3,Invalid format for key/value << key2=='value3' >> on line 5,Invalid format << key3 >> on line 6,Invalid format for key/value << key4='value4 >> on line 7",
],
]
`);
});
Expand Down Expand Up @@ -232,6 +234,9 @@ describe('run command tests', () => {
[
"The mesh file cannot be interpolated due to missing keys : newKey1 , newKey2",
],
[
"The mesh file cannot be interpolated due to missing keys : newKey1 , newKey2",
],
]
`);
});
Expand Down Expand Up @@ -264,6 +269,9 @@ describe('run command tests', () => {
[
"Interpolated mesh is not a valid JSON. Please check the generated json file.",
],
[
"Interpolated mesh is not a valid JSON. Please check the generated json file.",
],
]
`);
});
Expand All @@ -273,6 +281,7 @@ describe('run command tests', () => {
args: { file: 'src/commands/__fixtures__/sample_mesh_with_placeholder' },
flags: {
env: 'src/commands/__fixtures__/env_valid',
debug: false,
},
});

Expand All @@ -286,7 +295,7 @@ describe('run command tests', () => {
interpolatedMeshData: sampleInterpolatedMesh,
});

const runResult = await RunCommand.run();
await RunCommand.run();
expect(startGraphqlServer).toHaveBeenCalledWith(expect.anything(), process.env.PORT, false);
});
});
4 changes: 2 additions & 2 deletions src/commands/api-mesh/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class RunCommand extends Command {
}

const envFilePath = await flags.env;

try {
//Ensure that current directory includes package.json
if (fs.existsSync(path.join(process.cwd(), 'package.json'))) {
Expand Down Expand Up @@ -141,7 +141,7 @@ class RunCommand extends Command {
);
}
} catch (error) {
this.error('ERROR: ' + error.message);
this.error(error.message);
}
}
}
Expand Down

0 comments on commit 317af52

Please sign in to comment.