Skip to content
This repository was archived by the owner on Dec 19, 2025. It is now read-only.

Commit dac04ac

Browse files
committed
Update GraphQL tests
1 parent bd8002d commit dac04ac

2 files changed

Lines changed: 16 additions & 10 deletions

File tree

packages/core/src/util/graphql.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ query($repo: String!, $owner: String!, $cursor: String = null) {
1212
}
1313
nodes {
1414
name
15-
tagName
15+
tag {
16+
name
17+
}
1618
isPrerelease
1719
isDraft
1820
publishedAt

packages/core/test/test-graphql.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,37 @@
11
import test from 'ava'
2-
import versionCheck from '../src/index'
3-
import { ReleaseDescriptor } from '../src/types'
2+
import versionCheck from '../src/check'
3+
import { CheckOptions, CheckResult } from '@github-version-checker/api'
44

55
if (! process.env['GITHUB_TOKEN']) {
66
throw new Error('No GITHUB_TOKEN specified!')
77
}
88

9-
const opts = {
9+
const opts: CheckOptions = {
1010
owner: 'axelrindle',
1111
repo: 'github-version-checker',
1212
currentVersion: '0.0.1'
1313
}
1414

1515
test('graphql returns the same releases answer as rest', async (t) => {
16-
const responseGraphql = await versionCheck(opts) as ReleaseDescriptor
16+
const responseGraphql = await versionCheck(opts) as CheckResult
1717
t.not(responseGraphql, undefined)
1818

19-
const responseRest = await versionCheck({ token: false, ...opts }) as ReleaseDescriptor
19+
const responseRest = await versionCheck({ ...opts, token: false }) as CheckResult
2020
t.not(responseRest, undefined)
2121

22-
t.deepEqual(responseRest, responseGraphql)
22+
t.is(responseGraphql.src, 'graphql')
23+
t.is(responseRest.src, 'rest')
24+
t.deepEqual(responseRest.update, responseGraphql.update)
2325
})
2426

2527
test('graphql returns the same tags answer as rest', async (t) => {
26-
const responseGraphql = await versionCheck({ fetchTags: true, ...opts }) as ReleaseDescriptor
28+
const responseGraphql = await versionCheck({ ...opts, fetchTags: true }) as CheckResult
2729
t.not(responseGraphql, undefined)
2830

29-
const responseRest = await versionCheck({ token: false, fetchTags: true, ...opts }) as ReleaseDescriptor
31+
const responseRest = await versionCheck({ ...opts, token: false, fetchTags: true }) as CheckResult
3032
t.not(responseRest, undefined)
3133

32-
t.deepEqual(responseRest, responseGraphql)
34+
t.is(responseGraphql.src, 'graphql')
35+
t.is(responseRest.src, 'rest')
36+
t.deepEqual(responseRest.update, responseGraphql.update)
3337
})

0 commit comments

Comments
 (0)