Skip to content
This repository has been archived by the owner on Sep 9, 2019. It is now read-only.

Commit

Permalink
chore: add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
weareoutman committed Nov 29, 2018
1 parent a677446 commit 187c12f
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 3 deletions.
29 changes: 28 additions & 1 deletion test/reducers/__snapshots__/jobs.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,40 @@ Object {
"buffer": Array [],
"cursor": 0,
"returned": "$ ls -l
drwx
100% done.",
},
},
}
`;

exports[`reducers jobs should handle JOB_OUTPUT when output is undefined 1`] = `
Object {
"active": null,
"entities": Object {
"1": Object {
"cmd": "ls -l",
"cwd": "/tmp",
"id": 1,
"name": "test job for JOB_OUTPUT",
"running": true,
},
},
"ids": Array [
1,
],
"outputs": Object {
"1": Object {
"buffer": Array [
"drwx",
],
"cursor": 0,
"returned": undefined,
},
},
}
`;

exports[`reducers jobs should handle REMOVE_JOB 1`] = `
Object {
"active": null,
Expand Down
40 changes: 38 additions & 2 deletions test/reducers/jobs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,43 @@ describe('reducers', () => {
1: {
returned: '$ ls -l',
buffer: ['drwx'],
cursor: 4
cursor: 0
}
}
},
{
type: JOB_OUTPUT,
job: {
id: 1,
name: 'test job for JOB_OUTPUT',
cmd: 'ls -l',
cwd: '/tmp'
},
output: '\b\n10% run\b\b\b\b\b\b\b100% done.\n'
}
)
).toMatchSnapshot();
});

it('should handle JOB_OUTPUT when output is undefined', () => {
expect(
jobs(
{
ids: [1],
entities: {
1: {
id: 1,
name: 'test job for JOB_OUTPUT',
cmd: 'ls -l',
cwd: '/tmp',
running: true
}
},
outputs: {
1: {
returned: undefined,
buffer: ['drwx'],
cursor: 0
}
}
},
Expand All @@ -223,7 +259,7 @@ describe('reducers', () => {
cmd: 'ls -l',
cwd: '/tmp'
},
output: '\n10% run\b\b\b\b\b\b\b100% done.\n'
output: undefined
}
)
).toMatchSnapshot();
Expand Down

0 comments on commit 187c12f

Please sign in to comment.