Skip to content

Commit

Permalink
Fix tests that do not specify full url
Browse files Browse the repository at this point in the history
  • Loading branch information
Zachary Eisinger committed Nov 26, 2019
1 parent 167e5cb commit 09cc69f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
26 changes: 13 additions & 13 deletions __tests__/authutil.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ const nugetorgNuGetConfig: string = `<?xml version="1.0" encoding="utf-8"?>
const gprnugetorgNuGetConfig: string = `<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="GPR" value="https://nuget.pkg.github.com/github/index.json" protocolVersion="3" />
<add key="GPR" value="https://nuget.pkg.github.com/OwnerName/index.json" protocolVersion="3" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>`;

const gprNuGetConfig: string = `<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="GPR" value="https://nuget.pkg.github.com/github/index.json" protocolVersion="3" />
<add key="GPR" value="https://nuget.pkg.github.com/OwnerName/index.json" protocolVersion="3" />
</packageSources>
</configuration>`;

Expand All @@ -52,7 +52,7 @@ const twogprNuGetConfig: string = `<?xml version="1.0" encoding="utf-8"?>
const spaceNuGetConfig: string = `<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="GPR GitHub" value="https://nuget.pkg.github.com/github/index.json" protocolVersion="3" />
<add key="GPR GitHub" value="https://nuget.pkg.github.com/OwnerName/index.json" protocolVersion="3" />
</packageSources>
</configuration>`;

Expand Down Expand Up @@ -94,7 +94,7 @@ describe('authutil tests', () => {

it('No existing config, sets up a full NuGet.config with URL and user/PAT for GPR', async () => {
process.env['NUGET_AUTH_TOKEN'] = 'TEST_FAKE_AUTH_TOKEN';
await auth.configAuthentication('https://nuget.pkg.github.com');
await auth.configAuthentication('https://nuget.pkg.github.com/OwnerName/index.json');
expect(fs.existsSync(nugetConfigFile)).toBe(true);
expect(
fs.readFileSync(nugetConfigFile, {encoding: 'utf8'})
Expand All @@ -104,7 +104,7 @@ describe('authutil tests', () => {
it('No existing config, auth token environment variable not provided, throws', async () => {
let thrown = false;
try {
await auth.configAuthentication('https://nuget.pkg.github.com');
await auth.configAuthentication('https://nuget.pkg.github.com/OwnerName/index.json');
} catch {
thrown = true;
}
Expand All @@ -114,7 +114,7 @@ describe('authutil tests', () => {
it('No existing config, sets up a full NuGet.config with URL and other owner/PAT for GPR', async () => {
process.env['NUGET_AUTH_TOKEN'] = 'TEST_FAKE_AUTH_TOKEN';
process.env['INPUT_OWNER'] = 'otherorg';
await auth.configAuthentication('https://nuget.pkg.github.com');
await auth.configAuthentication('https://nuget.pkg.github.com/otherorg/index.json');
expect(fs.existsSync(nugetConfigFile)).toBe(true);
expect(
fs.readFileSync(nugetConfigFile, {encoding: 'utf8'})
Expand All @@ -130,7 +130,7 @@ describe('authutil tests', () => {
fs.writeFileSync(inputNuGetConfigPath, invalidNuGetConfig);
let thrown = false;
try {
await auth.configAuthentication('https://nuget.pkg.github.com');
await auth.configAuthentication('https://nuget.pkg.github.com/OwnerName/index.json');
} catch {
thrown = true;
}
Expand All @@ -144,7 +144,7 @@ describe('authutil tests', () => {
'nuget.config'
);
fs.writeFileSync(inputNuGetConfigPath, emptyNuGetConfig);
await auth.configAuthentication('https://nuget.pkg.github.com');
await auth.configAuthentication('https://nuget.pkg.github.com/OwnerName/index.json');
expect(fs.existsSync(nugetConfigFile)).toBe(true);
expect(
fs.readFileSync(nugetConfigFile, {encoding: 'utf8'})
Expand All @@ -158,7 +158,7 @@ describe('authutil tests', () => {
'nuget.config'
);
fs.writeFileSync(inputNuGetConfigPath, nugetorgNuGetConfig);
await auth.configAuthentication('https://nuget.pkg.github.com');
await auth.configAuthentication('https://nuget.pkg.github.com/OwnerName/index.json');
expect(fs.existsSync(nugetConfigFile)).toBe(true);
expect(
fs.readFileSync(nugetConfigFile, {encoding: 'utf8'})
Expand All @@ -172,7 +172,7 @@ describe('authutil tests', () => {
'nuget.config'
);
fs.writeFileSync(inputNuGetConfigPath, gprNuGetConfig);
await auth.configAuthentication('https://nuget.pkg.github.com');
await auth.configAuthentication('https://nuget.pkg.github.com/OwnerName/index.json');
expect(fs.existsSync(nugetConfigFile)).toBe(true);
expect(
fs.readFileSync(nugetConfigFile, {encoding: 'utf8'})
Expand All @@ -186,7 +186,7 @@ describe('authutil tests', () => {
'nuget.config'
);
fs.writeFileSync(inputNuGetConfigPath, gprnugetorgNuGetConfig);
await auth.configAuthentication('https://nuget.pkg.github.com');
await auth.configAuthentication('https://nuget.pkg.github.com/OwnerName/index.json');
expect(fs.existsSync(nugetConfigFile)).toBe(true);
expect(
fs.readFileSync(nugetConfigFile, {encoding: 'utf8'})
Expand Down Expand Up @@ -216,7 +216,7 @@ describe('authutil tests', () => {
fs.writeFileSync(inputNuGetConfigPath, spaceNuGetConfig);
let thrown = false;
try {
await auth.configAuthentication('https://nuget.pkg.github.com');
await auth.configAuthentication('https://nuget.pkg.github.com/OwnerName/index.json');
} catch {
thrown = true;
}
Expand All @@ -236,7 +236,7 @@ describe('authutil tests', () => {
fs.mkdirSync(inputNuGetConfigDirectory, {recursive: true});
fs.writeFileSync(inputNuGetConfigPath, gprNuGetConfig);
await auth.configAuthentication(
'https://nuget.pkg.github.com',
'https://nuget.pkg.github.com/OwnerName/index.json',
'subfolder/nuget.config'
);
expect(fs.existsSync(nugetConfigFile)).toBe(true);
Expand Down
4 changes: 2 additions & 2 deletions __tests__/installer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ describe('installer tests', () => {
}, 100000);

it('Acquires version of dotnet if no matching version is installed', async () => {
await getDotnet('2.2.104');
const dotnetDir = path.join(toolDir, 'dncs', '2.2.104', os.arch());
await getDotnet('2.2.205');
const dotnetDir = path.join(toolDir, 'dncs', '2.2.205', os.arch());

expect(fs.existsSync(`${dotnetDir}.complete`)).toBe(true);
if (IS_WINDOWS) {
Expand Down

0 comments on commit 09cc69f

Please sign in to comment.