Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
tSte committed Jul 11, 2023
1 parent 6de3e62 commit 80ff73b
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/Job.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,35 @@ describe('Instantiate Docker Job', () => {
});
});

describe('Instantiate Docker Job with custom properties', () => {
const docker = new CircleCI.executors.DockerExecutor('cimg/node:lts');
const helloWorld = new CircleCI.commands.Run({
command: 'echo hello world',
});
const jobName = 'my-job';
const job = new CircleCI.Job(jobName, docker, [helloWorld], {
parallelism: 3,
circleci_ip_ranges: true,
});
const jobContents = {
docker: [{ image: 'cimg/node:lts' }],
resource_class: 'medium',
parallelism: 3,
circleci_ip_ranges: true,
steps: [{ run: 'echo hello world' }],
};

it('Should match the expected output', () => {
expect(job.generate(true)).toEqual({ [jobName]: jobContents });
});

it('Add job to config and validate', () => {
const myConfig = new CircleCI.Config();
myConfig.addJob(job);
expect(myConfig.jobs.length).toBeGreaterThan(0);
});
});

describe('Instantiate Parameterized Docker Job With Custom Parameters', () => {
const docker = new CircleCI.executors.DockerExecutor('cimg/node:lts');
const helloWorld = new CircleCI.commands.Run({
Expand Down

0 comments on commit 80ff73b

Please sign in to comment.