Files
shields/services/jetbrains/jetbrains-downloads.tester.js
dependabot[bot] b9d96755ec chore(deps-dev): bump prettier from 2.8.8 to 3.0.0 (#9357)
* chore(deps-dev): bump prettier from 2.8.8 to 3.0.0

Bumps [prettier](https://github.com/prettier/prettier) from 2.8.8 to 3.0.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.8.8...3.0.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* reformat all the things (prettier 3)

* update tests to await calls to prettier.format()

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: chris48s <git@chris-shaw.dev>
2023-07-10 09:27:51 +00:00

58 lines
1.8 KiB
JavaScript

import { isMetric } from '../test-validators.js'
import { createServiceTester } from '../tester.js'
export const t = await createServiceTester()
t.create('downloads (number as a plugin id)')
.get('/7495.json')
.expectBadge({ label: 'downloads', message: isMetric })
t.create('downloads (plugin id from plugin.xml)')
.get('/org.intellij.scala.json')
.expectBadge({ label: 'downloads', message: isMetric })
t.create('downloads (user friendly plugin id)')
.get('/1347-scala.json')
.expectBadge({ label: 'downloads', message: isMetric })
t.create('downloads (numeric id)')
.get('/9435.json')
.intercept(nock =>
nock('https://plugins.jetbrains.com')
.get('/api/plugins/9435')
.reply(200, { downloads: 2 }),
)
.expectBadge({ label: 'downloads', message: '2' })
t.create('downloads (string id)')
.get('/io.harply.plugin.json')
.intercept(
nock =>
nock('https://plugins.jetbrains.com')
.get('/plugins/list?pluginId=io.harply.plugin')
.reply(
200,
`<?xml version="1.0" encoding="UTF-8"?>
<plugin-repository>
<category name="Code editing">
<idea-plugin downloads="2" size="13159" date="1485601807000" url=""></idea-plugin>
</category>
</plugin-repository>`,
),
{
'Content-Type': 'text/xml;charset=UTF-8',
},
)
.expectBadge({ label: 'downloads', message: '2' })
t.create('unknown plugin (string id)')
.get('/unknown-plugin.json')
.expectBadge({ label: 'downloads', message: 'not found' })
t.create('unknown plugin (numeric id)')
.get('/9999999999999.json')
.expectBadge({ label: 'downloads', message: 'not found' })
t.create('unknown plugin (mixed id)')
.get('/9999999999999-abc.json')
.expectBadge({ label: 'downloads', message: 'not found' })