-
Notifications
You must be signed in to change notification settings - Fork 65
Expand file tree
/
Copy pathgithub.test.mts
More file actions
60 lines (51 loc) · 1.63 KB
/
Copy pathgithub.test.mts
File metadata and controls
60 lines (51 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/**
* Unit tests for GitHub constants.
*
* Purpose: Tests the GitHub and GraphQL constants for Socket CLI.
*
* Test Coverage: - GraphQL pagination constants - PR state constants -
* Repository constants.
*
* Related Files: - constants/github.mts (implementation)
*/
import { describe, expect, it } from 'vitest'
import {
GQL_PAGE_SENTINEL,
GQL_PR_STATE_CLOSED,
GQL_PR_STATE_MERGED,
GQL_PR_STATE_OPEN,
SOCKET_CLI_GITHUB_REPO,
} from '../../../src/constants/github.mts'
describe('github constants', () => {
describe('GraphQL pagination', () => {
it('has GQL_PAGE_SENTINEL constant', () => {
expect(GQL_PAGE_SENTINEL).toBe(100)
})
it('GQL_PAGE_SENTINEL is within GitHub API limits', () => {
// GitHub GraphQL API typically limits to 100 items per page.
expect(GQL_PAGE_SENTINEL).toBeLessThanOrEqual(100)
expect(GQL_PAGE_SENTINEL).toBeGreaterThan(0)
})
})
describe('PR state constants', () => {
it('has GQL_PR_STATE_CLOSED constant', () => {
expect(GQL_PR_STATE_CLOSED).toBe('CLOSED')
})
it('has GQL_PR_STATE_MERGED constant', () => {
expect(GQL_PR_STATE_MERGED).toBe('MERGED')
})
it('has GQL_PR_STATE_OPEN constant', () => {
expect(GQL_PR_STATE_OPEN).toBe('OPEN')
})
it('all PR states are uppercase', () => {
expect(GQL_PR_STATE_CLOSED).toMatch(/^[A-Z]+$/)
expect(GQL_PR_STATE_MERGED).toMatch(/^[A-Z]+$/)
expect(GQL_PR_STATE_OPEN).toMatch(/^[A-Z]+$/)
})
})
describe('repository constants', () => {
it('has SOCKET_CLI_GITHUB_REPO constant', () => {
expect(SOCKET_CLI_GITHUB_REPO).toBe('socket-cli')
})
})
})