Skip to content

Commit

Permalink
test: using delimiter in scope-enum
Browse files Browse the repository at this point in the history
  • Loading branch information
colinaaa committed Sep 29, 2024
1 parent 9be7624 commit 25926c6
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions @commitlint/rules/src/scope-enum.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const messagesByScope = {
multiple: {
multiple: 'foo(bar,baz): qux',
multipleCommaSpace: 'foo(bar, baz): qux',
multipleSlash: 'foo(bar/baz): qux',
},
none: {
empty: 'foo: baz',
Expand Down Expand Up @@ -143,6 +144,16 @@ describe('Scope Enum Validation', () => {
expect(message).toEqual('scope must be one of [bar]');
});
});

test(`Succeeds with a 'multipleSlash' message when the scopes are included in enum`, async () => {
const [actual, message] = scopeEnum(
await parse(messages['multipleSlash']),
'always',
['bar/baz']
);
expect(actual).toBeTruthy();

Check failure on line 154 in @commitlint/rules/src/scope-enum.test.ts

View workflow job for this annotation

GitHub Actions / NodeJS installed from stock Ubuntu-LTS packages (not external sources)

@commitlint/rules/src/scope-enum.test.ts > Scope Enum Validation > Always > Multi-Scope Messages > Succeeds with a 'multipleSlash' message when the scopes are included in enum

AssertionError: expected false to be truthy ❯ @commitlint/rules/src/scope-enum.test.ts:154:20

Check failure on line 154 in @commitlint/rules/src/scope-enum.test.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-22.04, 18)

@commitlint/rules/src/scope-enum.test.ts > Scope Enum Validation > Always > Multi-Scope Messages > Succeeds with a 'multipleSlash' message when the scopes are included in enum

AssertionError: expected false to be truthy ❯ @commitlint/rules/src/scope-enum.test.ts:154:20

Check failure on line 154 in @commitlint/rules/src/scope-enum.test.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-22.04, 20)

@commitlint/rules/src/scope-enum.test.ts > Scope Enum Validation > Always > Multi-Scope Messages > Succeeds with a 'multipleSlash' message when the scopes are included in enum

AssertionError: expected false to be truthy ❯ @commitlint/rules/src/scope-enum.test.ts:154:20

Check failure on line 154 in @commitlint/rules/src/scope-enum.test.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-22.04, 18)

@commitlint/rules/src/scope-enum.test.ts > Scope Enum Validation > Always > Multi-Scope Messages > Succeeds with a 'multipleSlash' message when the scopes are included in enum

AssertionError: expected false to be truthy ❯ @commitlint/rules/src/scope-enum.test.ts:154:20

Check failure on line 154 in @commitlint/rules/src/scope-enum.test.ts

View workflow job for this annotation

GitHub Actions / NodeJS installed from stock Ubuntu-LTS packages (not external sources)

@commitlint/rules/src/scope-enum.test.ts > Scope Enum Validation > Always > Multi-Scope Messages > Succeeds with a 'multipleSlash' message when the scopes are included in enum

AssertionError: expected false to be truthy ❯ @commitlint/rules/src/scope-enum.test.ts:154:20

Check failure on line 154 in @commitlint/rules/src/scope-enum.test.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-22.04, 20)

@commitlint/rules/src/scope-enum.test.ts > Scope Enum Validation > Always > Multi-Scope Messages > Succeeds with a 'multipleSlash' message when the scopes are included in enum

AssertionError: expected false to be truthy ❯ @commitlint/rules/src/scope-enum.test.ts:154:20

Check failure on line 154 in @commitlint/rules/src/scope-enum.test.ts

View workflow job for this annotation

GitHub Actions / NodeJS installed from stock Ubuntu-LTS packages (not external sources)

@commitlint/rules/src/scope-enum.test.ts > Scope Enum Validation > Always > Multi-Scope Messages > Succeeds with a 'multipleSlash' message when the scopes are included in enum

AssertionError: expected false to be truthy ❯ @commitlint/rules/src/scope-enum.test.ts:154:20

Check failure on line 154 in @commitlint/rules/src/scope-enum.test.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-22.04, 18)

@commitlint/rules/src/scope-enum.test.ts > Scope Enum Validation > Always > Multi-Scope Messages > Succeeds with a 'multipleSlash' message when the scopes are included in enum

AssertionError: expected false to be truthy ❯ @commitlint/rules/src/scope-enum.test.ts:154:20

Check failure on line 154 in @commitlint/rules/src/scope-enum.test.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-22.04, 20)

@commitlint/rules/src/scope-enum.test.ts > Scope Enum Validation > Always > Multi-Scope Messages > Succeeds with a 'multipleSlash' message when the scopes are included in enum

AssertionError: expected false to be truthy ❯ @commitlint/rules/src/scope-enum.test.ts:154:20
expect(message).toEqual('scope must be one of [bar/baz]');
});
});
});

Expand Down Expand Up @@ -181,6 +192,16 @@ describe('Scope Enum Validation', () => {
expect(message).toEqual('scope must not be one of [bar, baz]');
});
});

test(`Fails with a 'multipleSlash' message when the scopes are included in enum`, async () => {
const [actual, message] = scopeEnum(
await parse(messages['multipleSlash']),
'never',
['bar/baz']
);
expect(actual).toBeFalsy();

Check failure on line 202 in @commitlint/rules/src/scope-enum.test.ts

View workflow job for this annotation

GitHub Actions / NodeJS installed from stock Ubuntu-LTS packages (not external sources)

@commitlint/rules/src/scope-enum.test.ts > Scope Enum Validation > Never > Messages with Scopes > Fails with a 'multipleSlash' message when the scopes are included in enum

AssertionError: expected true to be falsy - Expected + Received - true + false ❯ @commitlint/rules/src/scope-enum.test.ts:202:20

Check failure on line 202 in @commitlint/rules/src/scope-enum.test.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-22.04, 18)

@commitlint/rules/src/scope-enum.test.ts > Scope Enum Validation > Never > Messages with Scopes > Fails with a 'multipleSlash' message when the scopes are included in enum

AssertionError: expected true to be falsy - Expected + Received - true + false ❯ @commitlint/rules/src/scope-enum.test.ts:202:20

Check failure on line 202 in @commitlint/rules/src/scope-enum.test.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-22.04, 20)

@commitlint/rules/src/scope-enum.test.ts > Scope Enum Validation > Never > Messages with Scopes > Fails with a 'multipleSlash' message when the scopes are included in enum

AssertionError: expected true to be falsy - Expected + Received - true + false ❯ @commitlint/rules/src/scope-enum.test.ts:202:20

Check failure on line 202 in @commitlint/rules/src/scope-enum.test.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-22.04, 18)

@commitlint/rules/src/scope-enum.test.ts > Scope Enum Validation > Never > Messages with Scopes > Fails with a 'multipleSlash' message when the scopes are included in enum

AssertionError: expected true to be falsy - Expected + Received - true + false ❯ @commitlint/rules/src/scope-enum.test.ts:202:20

Check failure on line 202 in @commitlint/rules/src/scope-enum.test.ts

View workflow job for this annotation

GitHub Actions / NodeJS installed from stock Ubuntu-LTS packages (not external sources)

@commitlint/rules/src/scope-enum.test.ts > Scope Enum Validation > Never > Messages with Scopes > Fails with a 'multipleSlash' message when the scopes are included in enum

AssertionError: expected true to be falsy - Expected + Received - true + false ❯ @commitlint/rules/src/scope-enum.test.ts:202:20

Check failure on line 202 in @commitlint/rules/src/scope-enum.test.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-22.04, 20)

@commitlint/rules/src/scope-enum.test.ts > Scope Enum Validation > Never > Messages with Scopes > Fails with a 'multipleSlash' message when the scopes are included in enum

AssertionError: expected true to be falsy - Expected + Received - true + false ❯ @commitlint/rules/src/scope-enum.test.ts:202:20

Check failure on line 202 in @commitlint/rules/src/scope-enum.test.ts

View workflow job for this annotation

GitHub Actions / NodeJS installed from stock Ubuntu-LTS packages (not external sources)

@commitlint/rules/src/scope-enum.test.ts > Scope Enum Validation > Never > Messages with Scopes > Fails with a 'multipleSlash' message when the scopes are included in enum

AssertionError: expected true to be falsy - Expected + Received - true + false ❯ @commitlint/rules/src/scope-enum.test.ts:202:20

Check failure on line 202 in @commitlint/rules/src/scope-enum.test.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-22.04, 18)

@commitlint/rules/src/scope-enum.test.ts > Scope Enum Validation > Never > Messages with Scopes > Fails with a 'multipleSlash' message when the scopes are included in enum

AssertionError: expected true to be falsy - Expected + Received - true + false ❯ @commitlint/rules/src/scope-enum.test.ts:202:20

Check failure on line 202 in @commitlint/rules/src/scope-enum.test.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-22.04, 20)

@commitlint/rules/src/scope-enum.test.ts > Scope Enum Validation > Never > Messages with Scopes > Fails with a 'multipleSlash' message when the scopes are included in enum

AssertionError: expected true to be falsy - Expected + Received - true + false ❯ @commitlint/rules/src/scope-enum.test.ts:202:20
expect(message).toEqual('scope must not be one of [bar/baz]');
});
});
});
});

0 comments on commit 25926c6

Please sign in to comment.