test: move github repoData api test to integration

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2026-02-27 02:53:48 +01:00
parent 3692a3c56f
commit cb8840fbce
2 changed files with 50 additions and 27 deletions

View File

@@ -0,0 +1,41 @@
/**
* Copyright 2026 actions-toolkit authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, expect, it} from 'vitest';
import {GitHub} from '../../src/github/github.js';
describe('repoData', () => {
it('returns docker/actions-toolkit', async () => {
if (!process.env.GITHUB_TOKEN) {
console.log(`GitHub token not available, skipping test`);
return;
}
const originalEnv = process.env;
process.env = {
...originalEnv,
GITHUB_REPOSITORY: 'docker/actions-toolkit'
};
try {
const github = new GitHub({token: process.env.GITHUB_TOKEN});
const repo = await github.repoData();
const fullName = repo.full_name ?? `${repo.owner?.login}/${repo.name}`;
expect(fullName).toEqual('docker/actions-toolkit');
} finally {
process.env = originalEnv;
}
});
});