Add extra tests and use toEqual matcher.

Turns out that toMatchObject would allow extra properties through
This commit is contained in:
Josh Dales
2023-03-20 17:23:11 -04:00
parent cc1e02580b
commit d0d3628020
3 changed files with 42 additions and 29 deletions

View File

@@ -90,7 +90,7 @@ describe('toBranchMatchConfig', () => {
it('returns an empty object', () => {
const result = toBranchMatchConfig(config);
expect(result).toMatchObject({});
expect(result).toEqual({});
});
});
@@ -99,7 +99,7 @@ describe('toBranchMatchConfig', () => {
it('sets headBranch in the matchConfig', () => {
const result = toBranchMatchConfig(config);
expect(result).toMatchObject<BranchMatchConfig>({
expect(result).toEqual<BranchMatchConfig>({
headBranch: ['testing']
});
});
@@ -109,7 +109,7 @@ describe('toBranchMatchConfig', () => {
it('sets headBranch in the matchConfig', () => {
const result = toBranchMatchConfig(stringConfig);
expect(result).toMatchObject<BranchMatchConfig>({
expect(result).toEqual<BranchMatchConfig>({
headBranch: ['testing']
});
});
@@ -120,7 +120,7 @@ describe('toBranchMatchConfig', () => {
const config = {'base-branch': ['testing']};
it('sets baseBranch in the matchConfig', () => {
const result = toBranchMatchConfig(config);
expect(result).toMatchObject<BranchMatchConfig>({
expect(result).toEqual<BranchMatchConfig>({
baseBranch: ['testing']
});
});
@@ -130,7 +130,7 @@ describe('toBranchMatchConfig', () => {
it('sets baseBranch in the matchConfig', () => {
const result = toBranchMatchConfig(stringConfig);
expect(result).toMatchObject<BranchMatchConfig>({
expect(result).toEqual<BranchMatchConfig>({
baseBranch: ['testing']
});
});
@@ -141,7 +141,7 @@ describe('toBranchMatchConfig', () => {
const config = {'base-branch': ['testing'], 'head-branch': ['testing']};
it('sets headBranch and baseBranch in the matchConfig', () => {
const result = toBranchMatchConfig(config);
expect(result).toMatchObject<BranchMatchConfig>({
expect(result).toEqual<BranchMatchConfig>({
baseBranch: ['testing'],
headBranch: ['testing']
});