Skip to content

Commit

Permalink
Merge branch 'develop' into feature/response-buffer-size-extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
codenirvana authored Jul 29, 2024
2 parents 09f47d2 + 11877e3 commit b2e9c20
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@ jobs:

- if: ${{ matrix.coverage }}
name: Upload coverage
run: npm run codecov -- -c -Z -f .coverage/coverage-final.json -F unit
run: npm run codecov -- -c -Z -f .coverage/coverage-final.json -F unit -t ${{ secrets.CODECOV_TOKEN }}
2 changes: 2 additions & 0 deletions CHANGELOG.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
unreleased:
fixed bugs:
- GH-1366 Fixed a bug where $randomAvatarImage was returning an invalid URL
chores:
- GH-1362 Updated `Request~size` to handle `downloadedBytes` property

Expand Down
3 changes: 2 additions & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ coverage:

# coverage status for unit tests
unit:
flags: unit
target: 100
flags:
- unit

parsers:
javascript:
Expand Down
9 changes: 8 additions & 1 deletion lib/superstring/dynamic-variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,14 @@ var faker = require('@faker-js/faker/locale/en'),

$randomAvatarImage: {
description: 'A random avatar image',
generator: faker.image.avatar
generator: () => {
// ref: https://github.com/faker-js/faker/blob/v8.4.1/src/modules/image/index.ts#L61
return faker.random.arrayElement([
// eslint-disable-next-line max-len
`https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/${faker.datatype.number(1249)}.jpg`,
`https://avatars.githubusercontent.com/u/${faker.datatype.number(100000000)}`
]);
}
},
$randomImageUrl: {
description: 'A URL for a random image',
Expand Down
7 changes: 7 additions & 0 deletions test/unit/dynamic-variables.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,12 @@ describe('Dynamic variable', function () {
expect(directoryPath).to.not.be.undefined;
expect(directoryPath).to.not.be.null;
});

it('$randomAvatarImage returns a random avatar image', function () {
var avatarImage = dynamicVariables.$randomAvatarImage.generator();

expect(avatarImage).to.be.a('string')
.and.match(/^https:\/\/(avatars\.githubusercontent\.com|cloudflare-ipfs\.com)\/.+/);
});
});
});

0 comments on commit b2e9c20

Please sign in to comment.