Skip to content

Commit

Permalink
added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danielva-monday committed Sep 25, 2024
1 parent 2e7ab48 commit 1308477
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mondaycom/apps-cli",
"version": "4.1.2",
"version": "4.2.0",
"description": "A cli tool to manage apps (and monday-code projects) in monday.com",
"author": "monday.com Apps Team",
"type": "module",
Expand Down
33 changes: 33 additions & 0 deletions src/services/__tests__/mondaycoderc-schema.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { mondaycodercSchema } from 'services/schemas/mondaycoderc-schema';

describe('mondaycodercSchema Validation', () => {
it('should validate a correct Python runtime and version', () => {
const data = { RUNTIME: 'Python', RUNTIME_VERSION: '3.10.1' };
expect(() => mondaycodercSchema.parse(data)).not.toThrow();
});

it('should invalidate an incorrect Python runtime version', () => {
const data = { RUNTIME: 'Python', RUNTIME_VERSION: '2.7.0' };
expect(() => mondaycodercSchema.parse(data)).toThrow('Invalid RUNTIME_VERSION for the specified RUNTIME');
});

it('should validate a correct Java runtime and version', () => {
const data = { RUNTIME: 'Java', RUNTIME_VERSION: '17' };
expect(() => mondaycodercSchema.parse(data)).not.toThrow();
});

it('should invalidate a missing runtime version when runtime is specified', () => {
const data = { RUNTIME: 'Java' };
expect(() => mondaycodercSchema.parse(data)).toThrow('Invalid RUNTIME_VERSION for the specified RUNTIME');
});

it('should validate when runtime is not specified', () => {
const data = {};
expect(() => mondaycodercSchema.parse(data)).not.toThrow();
});

it('should invalidate an incorrect Go runtime version', () => {
const data = { RUNTIME: 'Go', RUNTIME_VERSION: '2.0.0' };
expect(() => mondaycodercSchema.parse(data)).toThrow('Invalid RUNTIME_VERSION for the specified RUNTIME');
});
});
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@
}
},
"include": [
"src/**/*",
"src/**/*"
],
"exclude": [
"test",
"node_modules",
"bin",
"dist",
"dist"
]
}

0 comments on commit 1308477

Please sign in to comment.