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

tests: use for of

This commit is contained in:
XhmikosR
2023-03-15 07:39:19 +02:00
parent de6249b42c
commit 54c2c33f6f

View File

@@ -34,25 +34,28 @@ hugoLibCustomRepoTestSuite('verify test env', () => {
hugoLibCustomRepoTestSuite('should return default repository url - Repository: default - Extended: undefined', () => {
const repoSources = hugoLib(process.cwd())._src.map((v) => v.url);
repoSources.forEach((sourceUrl) => {
for (const sourceUrl of repoSources) {
assert.ok(sourceUrl.startsWith('https://github.com/'));
});
}
});
hugoLibCustomRepoTestSuite('should return default repository url - Repository: default - Extended: empty', () => {
process.env.npm_config_hugo_bin_build_tags = '';
const repoSources = hugoLib(process.cwd())._src.map((v) => v.url);
repoSources.forEach((sourceUrl) => {
for (const sourceUrl of repoSources) {
assert.ok(sourceUrl.startsWith('https://github.com/'));
});
}
});
hugoLibCustomRepoTestSuite('should return default repository url - Repository: default - Extended: extended', () => {
process.env.npm_config_hugo_bin_build_tags = 'extended';
const repoSources = hugoLib(process.cwd())._src.map((v) => v.url);
repoSources.forEach((sourceUrl) => {
for (const sourceUrl of repoSources) {
assert.ok(sourceUrl.startsWith('https://github.com/'));
});
}
});
// Custom/Enterprise Repository Test Cases
@@ -60,27 +63,30 @@ hugoLibCustomRepoTestSuite('should return default repository url - Repository: d
hugoLibCustomRepoTestSuite('should return custom repository url - Repository: custom - Extended: undefined', () => {
process.env.npm_config_hugo_bin_download_repo = 'https://some1.example.com';
const repoSources = hugoLib(process.cwd())._src.map((v) => v.url);
repoSources.forEach((sourceUrl) => {
for (const sourceUrl of repoSources) {
assert.ok(sourceUrl.startsWith('https://some1.example.com/'));
});
}
});
hugoLibCustomRepoTestSuite('should return custom repository url - Repository: custom - Extended: empty', () => {
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);
repoSources.forEach((sourceUrl) => {
for (const sourceUrl of repoSources) {
assert.ok(sourceUrl.startsWith('https://some2.example.com/'));
});
}
});
hugoLibCustomRepoTestSuite('should return custom repository url - Repository: custom - Extended: extended', () => {
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);
repoSources.forEach((sourceUrl) => {
for (const sourceUrl of repoSources) {
assert.ok(sourceUrl.startsWith('https://some3.example.com/'));
});
}
});
hugoLibCustomRepoTestSuite.run();