本文整理汇总了TypeScript中nock.Scope.get方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Scope.get方法的具体用法?TypeScript Scope.get怎么用?TypeScript Scope.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nock.Scope
的用法示例。
在下文中一共展示了Scope.get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
.nock('https://api.heroku.com', (api: Scope) => {
Stubber.get(api, ['https://github.com/heroku/heroku-buildpack-ruby'])
Stubber.put(api)
api
.get('/apps/example/config-vars')
.reply(200, {})
})
示例2: get
export function get(nock: Scope, buildpacks?: Array<string | {url: string, name: string}>) {
let response: any
if (buildpacks && buildpacks.length > 0) {
if (typeof(buildpacks[0]) === 'string') {
response = buildpacks.map((b, i) => {
return {
buildpack: {url: b},
ordinal: i,
}
})
} else {
response = buildpacks.map((b, i) => {
return {
buildpack: b,
ordinal: i,
}
})
}
} else {
response = []
}
nock
.get('/apps/example/buildpack-installations')
.reply(200, response)
}
示例3:
.nock('https://buildpack-registry.heroku.com', (api: Scope) => {
api
.get('/buildpacks/heroku%2Fruby/revisions')
.reply(200, [
Fixture.revision({
release: 138,
})
])
})
示例4:
.nock('https://buildpack-registry.heroku.com', (api: Scope) => {
api
.get('/buildpacks?in[namespace][]=heroku')
.reply(200, [
Fixture.buildpack({
name: 'ruby',
description: 'Official Heroku Buildpack for Ruby',
})
])
})
示例5:
.nock('https://buildpack-registry.heroku.com', (api: Scope) => {
let buildpack = Fixture.buildpack({
namespace: 'heroku',
name: 'ruby',
blob_url: 'https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/ruby.tgz',
})
api
.get('/buildpacks/heroku%2Fruby')
.reply(200, buildpack)
})
示例6:
.nock('https://buildpack-registry.heroku.com', (api: Scope) => {
api
.get('/buildpacks/heroku%2Fruby')
.reply(200, Fixture.buildpack({
name: 'ruby',
source: {
type: 'github',
owner: 'heroku',
repo: 'heroku-buildpack-ruby',
},
}))
.get('/buildpacks/heroku%2Fruby/revisions')
.reply(200, [Fixture.revision()])
.get('/buildpacks/heroku%2Fruby/readme')
.reply(200, Fixture.readme())
})