Skip to content

Commit

Permalink
Fix test broken by changes to gpr case
Browse files Browse the repository at this point in the history
  • Loading branch information
Zachary Eisinger committed Nov 26, 2019
1 parent 09cc69f commit dd19a56
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 11 deletions.
2 changes: 1 addition & 1 deletion __tests__/__snapshots__/authutil.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ exports[`authutil tests Existing config w/ two GPR sources, sets up a partial Nu
"<?xml version=\\"1.0\\"?>
<configuration>
<config>
<add key=\\"defaultPushSource\\" value=\\"https://nuget.pkg.github.com/OwnerName/index.json\\"/>
<add key=\\"defaultPushSource\\" value=\\"https://nuget.pkg.github.com\\"/>
</config>
<packageSourceCredentials>
<GPR-GitHub>
Expand Down
38 changes: 28 additions & 10 deletions __tests__/authutil.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const gprNuGetConfig: string = `<?xml version="1.0" encoding="utf-8"?>
const twogprNuGetConfig: 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" />
<add key="GPR-Actions" value="https://nuget.pkg.github.com/actions/index.json" protocolVersion="3" />
</packageSources>
</configuration>`;
Expand Down Expand Up @@ -94,7 +94,9 @@ 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/OwnerName/index.json');
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 +106,9 @@ 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/OwnerName/index.json');
await auth.configAuthentication(
'https://nuget.pkg.github.com/OwnerName/index.json'
);
} catch {
thrown = true;
}
Expand All @@ -114,7 +118,9 @@ 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/otherorg/index.json');
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 +136,9 @@ describe('authutil tests', () => {
fs.writeFileSync(inputNuGetConfigPath, invalidNuGetConfig);
let thrown = false;
try {
await auth.configAuthentication('https://nuget.pkg.github.com/OwnerName/index.json');
await auth.configAuthentication(
'https://nuget.pkg.github.com/OwnerName/index.json'
);
} catch {
thrown = true;
}
Expand All @@ -144,7 +152,9 @@ describe('authutil tests', () => {
'nuget.config'
);
fs.writeFileSync(inputNuGetConfigPath, emptyNuGetConfig);
await auth.configAuthentication('https://nuget.pkg.github.com/OwnerName/index.json');
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 +168,9 @@ describe('authutil tests', () => {
'nuget.config'
);
fs.writeFileSync(inputNuGetConfigPath, nugetorgNuGetConfig);
await auth.configAuthentication('https://nuget.pkg.github.com/OwnerName/index.json');
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 +184,9 @@ describe('authutil tests', () => {
'nuget.config'
);
fs.writeFileSync(inputNuGetConfigPath, gprNuGetConfig);
await auth.configAuthentication('https://nuget.pkg.github.com/OwnerName/index.json');
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 +200,9 @@ describe('authutil tests', () => {
'nuget.config'
);
fs.writeFileSync(inputNuGetConfigPath, gprnugetorgNuGetConfig);
await auth.configAuthentication('https://nuget.pkg.github.com/OwnerName/index.json');
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 +232,9 @@ describe('authutil tests', () => {
fs.writeFileSync(inputNuGetConfigPath, spaceNuGetConfig);
let thrown = false;
try {
await auth.configAuthentication('https://nuget.pkg.github.com/OwnerName/index.json');
await auth.configAuthentication(
'https://nuget.pkg.github.com/OwnerName/index.json'
);
} catch {
thrown = true;
}
Expand Down

0 comments on commit dd19a56

Please sign in to comment.