diff --git a/test/google-cloud-storage.ts b/test/google-cloud-storage.ts index 6a15b537..c929b4a2 100644 --- a/test/google-cloud-storage.ts +++ b/test/google-cloud-storage.ts @@ -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({ diff --git a/test/local.ts b/test/local.ts index ee045e5d..df65cf99 100644 --- a/test/local.ts +++ b/test/local.ts @@ -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({ diff --git a/test/s3.ts b/test/s3.ts index 62fde0df..e28e6e3c 100644 --- a/test/s3.ts +++ b/test/s3.ts @@ -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()