Skip to content

Commit dd19a56

Browse files
author
Zachary Eisinger
committed
Fix test broken by changes to gpr case
1 parent 09cc69f commit dd19a56

File tree

2 files changed

+29
-11
lines changed

2 files changed

+29
-11
lines changed

__tests__/__snapshots__/authutil.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ exports[`authutil tests Existing config w/ two GPR sources, sets up a partial Nu
115115
"<?xml version=\\"1.0\\"?>
116116
<configuration>
117117
<config>
118-
<add key=\\"defaultPushSource\\" value=\\"https://nuget.pkg.github.com/OwnerName/index.json\\"/>
118+
<add key=\\"defaultPushSource\\" value=\\"https://nuget.pkg.github.com\\"/>
119119
</config>
120120
<packageSourceCredentials>
121121
<GPR-GitHub>

__tests__/authutil.test.ts

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const gprNuGetConfig: string = `<?xml version="1.0" encoding="utf-8"?>
4444
const twogprNuGetConfig: string = `<?xml version="1.0" encoding="utf-8"?>
4545
<configuration>
4646
<packageSources>
47-
<add key="GPR-GitHub" value="https://nuget.pkg.github.com/github/index.json" protocolVersion="3" />
47+
<add key="GPR-GitHub" value="https://nuget.pkg.github.com/OwnerName/index.json" protocolVersion="3" />
4848
<add key="GPR-Actions" value="https://nuget.pkg.github.com/actions/index.json" protocolVersion="3" />
4949
</packageSources>
5050
</configuration>`;
@@ -94,7 +94,9 @@ describe('authutil tests', () => {
9494

9595
it('No existing config, sets up a full NuGet.config with URL and user/PAT for GPR', async () => {
9696
process.env['NUGET_AUTH_TOKEN'] = 'TEST_FAKE_AUTH_TOKEN';
97-
await auth.configAuthentication('https://nuget.pkg.github.com/OwnerName/index.json');
97+
await auth.configAuthentication(
98+
'https://nuget.pkg.github.com/OwnerName/index.json'
99+
);
98100
expect(fs.existsSync(nugetConfigFile)).toBe(true);
99101
expect(
100102
fs.readFileSync(nugetConfigFile, {encoding: 'utf8'})
@@ -104,7 +106,9 @@ describe('authutil tests', () => {
104106
it('No existing config, auth token environment variable not provided, throws', async () => {
105107
let thrown = false;
106108
try {
107-
await auth.configAuthentication('https://nuget.pkg.github.com/OwnerName/index.json');
109+
await auth.configAuthentication(
110+
'https://nuget.pkg.github.com/OwnerName/index.json'
111+
);
108112
} catch {
109113
thrown = true;
110114
}
@@ -114,7 +118,9 @@ describe('authutil tests', () => {
114118
it('No existing config, sets up a full NuGet.config with URL and other owner/PAT for GPR', async () => {
115119
process.env['NUGET_AUTH_TOKEN'] = 'TEST_FAKE_AUTH_TOKEN';
116120
process.env['INPUT_OWNER'] = 'otherorg';
117-
await auth.configAuthentication('https://nuget.pkg.github.com/otherorg/index.json');
121+
await auth.configAuthentication(
122+
'https://nuget.pkg.github.com/otherorg/index.json'
123+
);
118124
expect(fs.existsSync(nugetConfigFile)).toBe(true);
119125
expect(
120126
fs.readFileSync(nugetConfigFile, {encoding: 'utf8'})
@@ -130,7 +136,9 @@ describe('authutil tests', () => {
130136
fs.writeFileSync(inputNuGetConfigPath, invalidNuGetConfig);
131137
let thrown = false;
132138
try {
133-
await auth.configAuthentication('https://nuget.pkg.github.com/OwnerName/index.json');
139+
await auth.configAuthentication(
140+
'https://nuget.pkg.github.com/OwnerName/index.json'
141+
);
134142
} catch {
135143
thrown = true;
136144
}
@@ -144,7 +152,9 @@ describe('authutil tests', () => {
144152
'nuget.config'
145153
);
146154
fs.writeFileSync(inputNuGetConfigPath, emptyNuGetConfig);
147-
await auth.configAuthentication('https://nuget.pkg.github.com/OwnerName/index.json');
155+
await auth.configAuthentication(
156+
'https://nuget.pkg.github.com/OwnerName/index.json'
157+
);
148158
expect(fs.existsSync(nugetConfigFile)).toBe(true);
149159
expect(
150160
fs.readFileSync(nugetConfigFile, {encoding: 'utf8'})
@@ -158,7 +168,9 @@ describe('authutil tests', () => {
158168
'nuget.config'
159169
);
160170
fs.writeFileSync(inputNuGetConfigPath, nugetorgNuGetConfig);
161-
await auth.configAuthentication('https://nuget.pkg.github.com/OwnerName/index.json');
171+
await auth.configAuthentication(
172+
'https://nuget.pkg.github.com/OwnerName/index.json'
173+
);
162174
expect(fs.existsSync(nugetConfigFile)).toBe(true);
163175
expect(
164176
fs.readFileSync(nugetConfigFile, {encoding: 'utf8'})
@@ -172,7 +184,9 @@ describe('authutil tests', () => {
172184
'nuget.config'
173185
);
174186
fs.writeFileSync(inputNuGetConfigPath, gprNuGetConfig);
175-
await auth.configAuthentication('https://nuget.pkg.github.com/OwnerName/index.json');
187+
await auth.configAuthentication(
188+
'https://nuget.pkg.github.com/OwnerName/index.json'
189+
);
176190
expect(fs.existsSync(nugetConfigFile)).toBe(true);
177191
expect(
178192
fs.readFileSync(nugetConfigFile, {encoding: 'utf8'})
@@ -186,7 +200,9 @@ describe('authutil tests', () => {
186200
'nuget.config'
187201
);
188202
fs.writeFileSync(inputNuGetConfigPath, gprnugetorgNuGetConfig);
189-
await auth.configAuthentication('https://nuget.pkg.github.com/OwnerName/index.json');
203+
await auth.configAuthentication(
204+
'https://nuget.pkg.github.com/OwnerName/index.json'
205+
);
190206
expect(fs.existsSync(nugetConfigFile)).toBe(true);
191207
expect(
192208
fs.readFileSync(nugetConfigFile, {encoding: 'utf8'})
@@ -216,7 +232,9 @@ describe('authutil tests', () => {
216232
fs.writeFileSync(inputNuGetConfigPath, spaceNuGetConfig);
217233
let thrown = false;
218234
try {
219-
await auth.configAuthentication('https://nuget.pkg.github.com/OwnerName/index.json');
235+
await auth.configAuthentication(
236+
'https://nuget.pkg.github.com/OwnerName/index.json'
237+
);
220238
} catch {
221239
thrown = true;
222240
}

0 commit comments

Comments
 (0)