8000 Fix tests and rebuild · actions/setup-python@168d1ea · GitHub
[go: up one dir, main page]

Skip to content

Commit 168d1ea

Browse files
committed
Fix tests and rebuild
1 parent 56d3584 commit 168d1ea

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

__tests__/cache-restore.test.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,27 +193,28 @@ virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/patrick/Library/Caches/py
193193

194194
describe('Check if handleMatchResult', () => {
195195
it.each([
196-
['pip', '3.8.12', 'requirements.txt', 'someKey', true],
197-
['pipenv', '3.9.1', 'requirements.txt', 'someKey', true],
198-
['poetry', '3.8.12', 'requirements.txt', 'someKey', true],
199-
['pip', '3.9.2', 'requirements.txt', undefined, false],
200-
['pipenv', '3.8.12', 'requirements.txt', undefined, false],
201-
['poetry', '3.9.12', 'requirements.txt', undefined, false]
196+
['pip', '3.8.12', 'requirements.txt', 'someKey', 'someKey', true],
197+
['pipenv', '3.9.1', 'requirements.txt', 'someKey', 'someKey', true],
198+
['poetry', '3.8.12', 'requirements.txt', 'someKey', 'someKey', true],
199+
['pip', '3.9.2', 'requirements.txt', undefined, 'someKey', false],
200+
['pipenv', '3.8.12', 'requirements.txt', undefined, 'someKey', false],
201+
['poetry', '3.9.12', 'requirements.txt', undefined, 'someKey', false]
202202
])(
203203
'sets correct outputs',
204204
async (
205205
packageManager,
206206
pythonVersion,
207207
dependencyFile,
208208
matchedKey,
209+
restoredKey,
209210
expectedOutputValue
210211
) => {
211212
const cacheDistributor = getCacheDistributor(
212213
packageManager,
213214
pythonVersion,
214215
dependencyFile
215216
);
216-
cacheDistributor.handleMatchResult(matchedKey);
217+
cacheDistributor.handleMatchResult(matchedKey, restoredKey);
217218
expect(setOutputSpy).toHaveBeenCalledWith(
218219
'cache-hit',
219220
expectedOutputValue

dist/cache-save/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37238,14 +37238,14 @@ class CacheDistributor {
3723837238
});
3723937239
}
3724037240
handleMatchResult(matchedKey, primaryKey) {
37241-
if (matchedKey == primaryKey) {
37241+
if (matchedKey) {
3724237242
core.saveState(State.CACHE_MATCHED_KEY, matchedKey);
3724337243
core.info(`Cache restored from key: ${matchedKey}`);
3724437244
}
3724537245
else {
3724637246
core.info(`${this.packageManager} cache is not found`);
3724737247
}
37248-
core.setOutput('cache-hit', Boolean(matchedKey));
37248+
core.setOutput('cache-hit', matchedKey === primaryKey);
3724937249
}
3725037250
}
3725137251
exports.default = CacheDistributor;

dist/setup/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42583,14 +42583,14 @@ class CacheDistributor {
4258342583
});
4258442584
}
4258542585
handleMatchResult(matchedKey, primaryKey) {
42586-
if (matchedKey == primaryKey) {
42586+
if (matchedKey) {
4258742587
core.saveState(State.CACHE_MATCHED_KEY, matchedKey);
4258842588
core.info(`Cache restored from key: ${matchedKey}`);
4258942589
}
4259042590
else {
4259142591
core.info(`${this.packageManager} cache is not found`);
4259242592
}
42593-
core.setOutput('cache-hit', Boolean(matchedKey));
42593+
core.setOutput('cache-hit', matchedKey === primaryKey);
4259442594
}
4259542595
}
4259642596
exports.default = CacheDistributor;

0 commit comments

Comments
 (0)
0