Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sachin Patel committed Oct 10, 2022
1 parent 74fc6cc commit 5f8d2f8
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test/google-cloud-storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,36 @@ tap.test('Google Cloud Storage', async t => {
t2.equal(response.statusCode, 200)
t2.same(response.body, 'test cache data')
})
t.test('should verify artifact exists', async t2 => {
t2.plan(2)
const response = await app.inject({
method: 'HEAD',
url: `/v8/artifacts/${artifactId}`,
headers: {
authorization: 'Bearer changeme',
},
query: {
teamId,
},
})
t2.equal(response.statusCode, 200)
t2.same(response.body, {})
})
t.test('should verify artifact does not exist', async t2 => {
t2.plan(2)
const response = await app.inject({
method: 'HEAD',
url: `/v8/artifacts/not-found`,
headers: {
authorization: 'Bearer changeme',
},
query: {
teamId,
},
})
t2.equal(response.statusCode, 404)
t2.same(response.body, {})
})
t.test('should upload an artifact when slug is used', async t2 => {
t2.plan(2)
const response = await app.inject({
Expand Down
30 changes: 30 additions & 0 deletions test/local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,36 @@ test(`local'`, async t => {
t2.equal(response.statusCode, 200)
t2.same(response.body, 'test cache data')
})
t.test('should verify artifact exists', async t2 => {
t2.plan(2)
const response = await app.inject({
method: 'HEAD',
url: `/v8/artifacts/${artifactId}`,
headers: {
authorization: 'Bearer changeme',
},
query: {
teamId,
},
})
t2.equal(response.statusCode, 200)
t2.same(response.body, {})
})
t.test('should verify artifact does not exist', async t2 => {
t2.plan(2)
const response = await app.inject({
method: 'HEAD',
url: `/v8/artifacts/not-found`,
headers: {
authorization: 'Bearer changeme',
},
query: {
teamId,
},
})
t2.equal(response.statusCode, 404)
t2.same(response.body, {})
})
t.test('should upload an artifact when slug is used', async t2 => {
t2.plan(2)
const response = await app.inject({
Expand Down
30 changes: 30 additions & 0 deletions test/s3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,36 @@ server.run(err => {
t2.equal(response.statusCode, 200)
t2.same(response.body, 'test cache data')
})
t.test('should verify artifact exists', async t2 => {
t2.plan(2)
const response = await app.inject({
method: 'HEAD',
url: `/v8/artifacts/${artifactId}`,
headers: {
authorization: 'Bearer changeme',
},
query: {
teamId,
},
})
t2.equal(response.statusCode, 200)
t2.same(response.body, {})
})
t.test('should verify artifact does not exist', async t2 => {
t2.plan(2)
const response = await app.inject({
method: 'HEAD',
url: `/v8/artifacts/not-found`,
headers: {
authorization: 'Bearer changeme',
},
query: {
teamId,
},
})
t2.equal(response.statusCode, 404)
t2.same(response.body, {})
})

t.teardown(() => {
server.close()
Expand Down

0 comments on commit 5f8d2f8

Please sign in to comment.