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

Commit d333f3d

Browse files
committed
Add GraphQL tests
1 parent 4ebd337 commit d333f3d

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

packages/core/test/test-graphql.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import test from 'ava'
2+
import versionCheck from '../src/index'
3+
import { ReleaseDescriptor } from '../src/types'
4+
5+
if (! process.env['GITHUB_TOKEN']) {
6+
throw new Error('No GITHUB_TOKEN specified!')
7+
}
8+
9+
const opts = {
10+
owner: 'axelrindle',
11+
repo: 'github-version-checker',
12+
currentVersion: '0.0.1'
13+
}
14+
15+
test('graphql returns the same releases answer as rest', async (t) => {
16+
const responseGraphql = await versionCheck(opts) as ReleaseDescriptor
17+
t.not(responseGraphql, undefined)
18+
19+
const responseRest = await versionCheck({ token: false, ...opts }) as ReleaseDescriptor
20+
t.not(responseRest, undefined)
21+
22+
t.deepEqual(responseRest, responseGraphql)
23+
})
24+
25+
test('graphql returns the same tags answer as rest', async (t) => {
26+
const responseGraphql = await versionCheck({ fetchTags: true, ...opts }) as ReleaseDescriptor
27+
t.not(responseGraphql, undefined)
28+
29+
const responseRest = await versionCheck({ token: false, fetchTags: true, ...opts }) as ReleaseDescriptor
30+
t.not(responseRest, undefined)
31+
32+
t.deepEqual(responseRest, responseGraphql)
33+
})

0 commit comments

Comments
 (0)