1
mirror of https://github.com/jakejarvis/hugo-extended.git synced 2025-10-16 09:54:28 -04:00

Switch to async methods (#128)

This commit is contained in:
XhmikosR
2023-03-17 09:22:09 +02:00
committed by GitHub
parent 9e6b5c865f
commit 9985b1c985
6 changed files with 44 additions and 30 deletions

View File

@@ -5,10 +5,9 @@ import { test, suite } from 'uvu';
import hugoBin from '../index.js';
import hugoLib from '../lib/index.js';
test('should return path to binary and work', () => {
return binCheck(hugoBin, ['version']).then(works => {
assert.ok(works);
});
test('should return path to binary and work', async () => {
const works = await binCheck(hugoBin, ['version']);
assert.equal(works, true);
});
test.run();
@@ -32,26 +31,29 @@ hugoLibCustomRepoTestSuite('verify test env', () => {
// Default Repository - Test Cases
hugoLibCustomRepoTestSuite('should return default repository url - Repository: default - Extended: undefined', () => {
const repoSources = hugoLib(process.cwd())._src.map((v) => v.url);
hugoLibCustomRepoTestSuite('should return default repository url - Repository: default - Extended: undefined', async () => {
const lib = await hugoLib(process.cwd());
const repoSources = lib._src.map((v) => v.url);
for (const sourceUrl of repoSources) {
assert.equal(sourceUrl.startsWith('https://github.com/'), true);
}
});
hugoLibCustomRepoTestSuite('should return default repository url - Repository: default - Extended: empty', () => {
hugoLibCustomRepoTestSuite('should return default repository url - Repository: default - Extended: empty', async () => {
process.env.npm_config_hugo_bin_build_tags = '';
const repoSources = hugoLib(process.cwd())._src.map((v) => v.url);
const lib = await hugoLib(process.cwd());
const repoSources = lib._src.map((v) => v.url);
for (const sourceUrl of repoSources) {
assert.equal(sourceUrl.startsWith('https://github.com/'), true);
}
});
hugoLibCustomRepoTestSuite('should return default repository url - Repository: default - Extended: extended', () => {
hugoLibCustomRepoTestSuite('should return default repository url - Repository: default - Extended: extended', async () => {
process.env.npm_config_hugo_bin_build_tags = 'extended';
const repoSources = hugoLib(process.cwd())._src.map((v) => v.url);
const lib = await hugoLib(process.cwd());
const repoSources = lib._src.map((v) => v.url);
for (const sourceUrl of repoSources) {
assert.equal(sourceUrl.startsWith('https://github.com/'), true);
@@ -60,29 +62,32 @@ hugoLibCustomRepoTestSuite('should return default repository url - Repository: d
// Custom/Enterprise Repository Test Cases
hugoLibCustomRepoTestSuite('should return custom repository url - Repository: custom - Extended: undefined', () => {
hugoLibCustomRepoTestSuite('should return custom repository url - Repository: custom - Extended: undefined', async () => {
process.env.npm_config_hugo_bin_download_repo = 'https://some1.example.com';
const repoSources = hugoLib(process.cwd())._src.map((v) => v.url);
const lib = await hugoLib(process.cwd());
const repoSources = lib._src.map((v) => v.url);
for (const sourceUrl of repoSources) {
assert.equal(sourceUrl.startsWith('https://some1.example.com/'), true);
}
});
hugoLibCustomRepoTestSuite('should return custom repository url - Repository: custom - Extended: empty', () => {
hugoLibCustomRepoTestSuite('should return custom repository url - Repository: custom - Extended: empty', async () => {
process.env.npm_config_hugo_bin_build_tags = '';
process.env.npm_config_hugo_bin_download_repo = 'https://some2.example.com';
const repoSources = hugoLib(process.cwd())._src.map((v) => v.url);
const lib = await hugoLib(process.cwd());
const repoSources = lib._src.map((v) => v.url);
for (const sourceUrl of repoSources) {
assert.equal(sourceUrl.startsWith('https://some2.example.com/'), true);
}
});
hugoLibCustomRepoTestSuite('should return custom repository url - Repository: custom - Extended: extended', () => {
hugoLibCustomRepoTestSuite('should return custom repository url - Repository: custom - Extended: extended', async () => {
process.env.npm_config_hugo_bin_build_tags = 'extended';
process.env.npm_config_hugo_bin_download_repo = 'https://some3.example.com';
const repoSources = hugoLib(process.cwd())._src.map((v) => v.url);
const lib = await hugoLib(process.cwd());
const repoSources = lib._src.map((v) => v.url);
for (const sourceUrl of repoSources) {
assert.equal(sourceUrl.startsWith('https://some3.example.com/'), true);