Skip to content

Commit

Permalink
test: config.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
jamacku committed Oct 14, 2022
1 parent d4b3a35 commit 83556fc
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 21 deletions.
4 changes: 2 additions & 2 deletions dist/app.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/app.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/config.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/config.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/config.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const app = (probot: Probot) => {
}

await pullRequest.freeze(
policyItem.feedback.freezedState,
policyItem.feedback.frozenState,
tag.latest,
context
);
Expand All @@ -56,7 +56,7 @@ const app = (probot: Probot) => {
continue;
}

await pullRequest.unfreeze(policyItem.feedback.unFreezedState, context);
await pullRequest.unfreeze(policyItem.feedback.unFreezeState, context);
return;
}

Expand Down
4 changes: 2 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ class Feedback {
this._unFreezeState = feedback['unfreeze-state'];
}

get freezedState() {
get frozenState() {
return this._frozenState;
}

get unFreezedState() {
get unFreezeState() {
return this._unFreezeState;
}
}
18 changes: 18 additions & 0 deletions test/unit/__snapshots__/config.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,24 @@ exports[`Config Object > get policy() 1`] = `
]
`;

exports[`Config Object > get policy() 2`] = `
[
"alpha",
"beta",
]
`;

exports[`Config Object > get policy() 3`] = `
Feedback {
"_frozenState": "This is No-No",
"_unFreezeState": "This is Yes-Yes",
}
`;

exports[`Config Object > get policy() 4`] = `"This is No-No"`;

exports[`Config Object > get policy() 5`] = `"This is Yes-Yes"`;

exports[`Config Object > is invalid 1`] = `
[
{
Expand Down
14 changes: 10 additions & 4 deletions test/unit/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,16 @@ describe('Config Object', () => {
});

test<IConfigTestContext>('get policy()', context => {
context.configs.map(item => expect(item.policy).toMatchSnapshot());
context.configs.map(configItem => {
expect(configItem.policy).toMatchSnapshot();

configItem.policy.map(policyItem => {
expect(policyItem.tags).toMatchSnapshot();
expect(policyItem.feedback).toMatchSnapshot();
expect(policyItem.feedback.frozenState).toMatchSnapshot();
expect(policyItem.feedback.unFreezeState).toMatchSnapshot();
});
});
});

it<IConfigTestContext>('is valid', async context => {
Expand All @@ -45,6 +54,3 @@ describe('Config Object', () => {
expect(Config.isConfigEmpty(null)).toEqual(true);
});
});

describe.todo('PolicyItem Object');
describe.todo('Feedback Object');

0 comments on commit 83556fc

Please sign in to comment.