|
| 1 | +/** |
| 2 | + * @file Type Tests - Commit |
| 3 | + * @module commitlint-config/interfaces/tests/unit-d/Commit |
| 4 | + */ |
| 5 | + |
| 6 | +import type { Scope, Type } from '#src/enums' |
| 7 | +import type { LiteralUnion, Nullable } from '@flex-development/tutils' |
| 8 | +import type TestSubject from '../commit' |
| 9 | +import type Note from '../note' |
| 10 | +import type Reference from '../reference' |
| 11 | +import type Revert from '../revert' |
| 12 | + |
| 13 | +describe('unit-d:interfaces/Commit', () => { |
| 14 | + it('should match [body: Nullable<string>]', () => { |
| 15 | + expectTypeOf<TestSubject>() |
| 16 | + .toHaveProperty('body') |
| 17 | + .toEqualTypeOf<Nullable<string>>() |
| 18 | + }) |
| 19 | + |
| 20 | + it('should match [breaking: Nullable<"!">]', () => { |
| 21 | + expectTypeOf<TestSubject>() |
| 22 | + .toHaveProperty('breaking') |
| 23 | + .toEqualTypeOf<Nullable<'!'>>() |
| 24 | + }) |
| 25 | + |
| 26 | + it('should match [committerDate: string]', () => { |
| 27 | + expectTypeOf<TestSubject>().toHaveProperty('committerDate').toBeString() |
| 28 | + }) |
| 29 | + |
| 30 | + it('should match [footer: Nullable<string>]', () => { |
| 31 | + expectTypeOf<TestSubject>() |
| 32 | + .toHaveProperty('footer') |
| 33 | + .toEqualTypeOf<Nullable<string>>() |
| 34 | + }) |
| 35 | + |
| 36 | + it('should match [gitTags: string]', () => { |
| 37 | + expectTypeOf<TestSubject>().toHaveProperty('gitTags').toBeString() |
| 38 | + }) |
| 39 | + |
| 40 | + it('should match [hash: string]', () => { |
| 41 | + expectTypeOf<TestSubject>().toHaveProperty('hash').toBeString() |
| 42 | + }) |
| 43 | + |
| 44 | + it('should match [header: string]', () => { |
| 45 | + expectTypeOf<TestSubject>().toHaveProperty('header').toBeString() |
| 46 | + }) |
| 47 | + |
| 48 | + it('should match [mentions: string[]]', () => { |
| 49 | + expectTypeOf<TestSubject>() |
| 50 | + .toHaveProperty('mentions') |
| 51 | + .toEqualTypeOf<string[]>() |
| 52 | + }) |
| 53 | + |
| 54 | + it('should match [merge: null]', () => { |
| 55 | + expectTypeOf<TestSubject>().toHaveProperty('merge').toBeNull() |
| 56 | + }) |
| 57 | + |
| 58 | + it('should match [notes: Note[]]', () => { |
| 59 | + expectTypeOf<TestSubject>().toHaveProperty('notes').toEqualTypeOf<Note[]>() |
| 60 | + }) |
| 61 | + |
| 62 | + it('should match [pr: Nullable<string>]', () => { |
| 63 | + expectTypeOf<TestSubject>() |
| 64 | + .toHaveProperty('pr') |
| 65 | + .toEqualTypeOf<Nullable<string>>() |
| 66 | + }) |
| 67 | + |
| 68 | + it('should match [references: Reference[]]', () => { |
| 69 | + expectTypeOf<TestSubject>() |
| 70 | + .toHaveProperty('references') |
| 71 | + .toEqualTypeOf<Reference[]>() |
| 72 | + }) |
| 73 | + |
| 74 | + it('should match [revert: Nullable<Revert>]', () => { |
| 75 | + expectTypeOf<TestSubject>() |
| 76 | + .toHaveProperty('revert') |
| 77 | + .toEqualTypeOf<Nullable<Revert>>() |
| 78 | + }) |
| 79 | + |
| 80 | + it('should match [scope: Nullable<LiteralUnion<Scope, string>>]', () => { |
| 81 | + expectTypeOf<TestSubject>() |
| 82 | + .toHaveProperty('scope') |
| 83 | + .toEqualTypeOf<Nullable<LiteralUnion<Scope, string>>>() |
| 84 | + }) |
| 85 | + |
| 86 | + it('should match [shortHash: Nullable<string>]', () => { |
| 87 | + expectTypeOf<TestSubject>() |
| 88 | + .toHaveProperty('shortHash') |
| 89 | + .toEqualTypeOf<Nullable<string>>() |
| 90 | + }) |
| 91 | + |
| 92 | + it('should match [subject: string]', () => { |
| 93 | + expectTypeOf<TestSubject>().toHaveProperty('subject').toBeString() |
| 94 | + }) |
| 95 | + |
| 96 | + it('should match [type: LiteralUnion<Type, string>]', () => { |
| 97 | + expectTypeOf<TestSubject>() |
| 98 | + .toHaveProperty('type') |
| 99 | + .toEqualTypeOf<LiteralUnion<Type, string>>() |
| 100 | + }) |
| 101 | +}) |
0 commit comments