This commit is contained in:
Jess Bees
2023-12-15 10:54:04 -05:00
parent d1e23d0efd
commit 0d45f33cde

View File

@@ -66,9 +66,10 @@ describe('Deployment', () => {
mockPool mockPool
.intercept({ .intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`, path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`,
method: "GET", method: 'GET'
}) })
.reply(200, .reply(
200,
{ {
total_count: 1, total_count: 1,
artifacts: [{ id: 11, name: `github-pages`, size_in_bytes: 221 }] artifacts: [{ id: 11, name: `github-pages`, size_in_bytes: 221 }]
@@ -121,9 +122,10 @@ describe('Deployment', () => {
mockPool mockPool
.intercept({ .intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`, path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`,
method: "GET", method: 'GET'
}) })
.reply(200, .reply(
200,
{ {
total_count: 1, total_count: 1,
artifacts: [{ id: 11, name: `github-pages`, size_in_bytes: 221 }] artifacts: [{ id: 11, name: `github-pages`, size_in_bytes: 221 }]
@@ -182,12 +184,9 @@ describe('Deployment', () => {
mockPool mockPool
.intercept({ .intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`, path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`,
method: "GET", method: 'GET'
}) })
.reply(400, .reply(400, { message: 'Bad request' }, { headers: { 'content-type': 'application/json' } })
{ message: 'Bad request' },
{ headers: { 'content-type': 'application/json' } }
)
// Create the deployment // Create the deployment
const deployment = new Deployment() const deployment = new Deployment()
@@ -203,9 +202,10 @@ describe('Deployment', () => {
mockPool mockPool
.intercept({ .intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`, path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`,
method: "GET", method: 'GET'
}) })
.reply(200, .reply(
200,
{ {
total_count: 1, total_count: 1,
artifacts: [{ id: 11, name: `github-pages`, size_in_bytes: 221 }] artifacts: [{ id: 11, name: `github-pages`, size_in_bytes: 221 }]
@@ -245,9 +245,10 @@ describe('Deployment', () => {
mockPool mockPool
.intercept({ .intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`, path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`,
method: "GET", method: 'GET'
}) })
.reply(200, .reply(
200,
{ {
total_count: 1, total_count: 1,
artifacts: [{ id: 11, name: `github-pages`, size_in_bytes: 221 }] artifacts: [{ id: 11, name: `github-pages`, size_in_bytes: 221 }]
@@ -287,9 +288,10 @@ describe('Deployment', () => {
mockPool mockPool
.intercept({ .intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`, path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`,
method: "GET", method: 'GET'
}) })
.reply(200, .reply(
200,
{ {
total_count: 1, total_count: 1,
artifacts: [{ id: 11, name: `github-pages`, size_in_bytes: 221 }] artifacts: [{ id: 11, name: `github-pages`, size_in_bytes: 221 }]
@@ -329,9 +331,10 @@ describe('Deployment', () => {
mockPool mockPool
.intercept({ .intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`, path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`,
method: "GET", method: 'GET'
}) })
.reply(200, .reply(
200,
{ {
total_count: 1, total_count: 1,
artifacts: [{ id: 11, name: `github-pages`, size_in_bytes: 221 }] artifacts: [{ id: 11, name: `github-pages`, size_in_bytes: 221 }]
@@ -372,9 +375,10 @@ describe('Deployment', () => {
mockPool mockPool
.intercept({ .intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`, path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`,
method: "GET", method: 'GET'
}) })
.reply(200, .reply(
200,
{ {
total_count: 2, total_count: 2,
artifacts: [ artifacts: [
@@ -405,9 +409,10 @@ describe('Deployment', () => {
mockPool mockPool
.intercept({ .intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`, path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`,
method: "GET", method: 'GET'
}) })
.reply(200, .reply(
200,
{ {
total_count: 0, total_count: 0,
artifacts: [] artifacts: []
@@ -427,12 +432,9 @@ describe('Deployment', () => {
mockPool mockPool
.intercept({ .intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`, path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`,
method: "GET", method: 'GET'
}) })
.reply(500, .reply(500, { message: 'oh no' }, { headers: { 'content-type': 'application/json' } })
{ message: 'oh no' },
{ headers: { 'content-type': 'application/json' } }
)
const deployment = new Deployment() const deployment = new Deployment()
await expect(deployment.create(fakeJwt)).rejects.toThrow( await expect(deployment.create(fakeJwt)).rejects.toThrow(
@@ -447,9 +449,10 @@ describe('Deployment', () => {
mockPool mockPool
.intercept({ .intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`, path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`,
method: "GET", method: 'GET'
}) })
.reply(200, .reply(
200,
{ {
total_count: 1, total_count: 1,
artifacts: [{ id: 12, name: `github-pages`, size_in_bytes: artifactSize }] artifacts: [{ id: 12, name: `github-pages`, size_in_bytes: artifactSize }]
@@ -502,9 +505,10 @@ describe('Deployment', () => {
mockPool mockPool
.intercept({ .intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`, path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`,
method: "GET", method: 'GET'
}) })
.reply(200, .reply(
200,
{ {
total_count: 1, total_count: 1,
artifacts: [{ id: 11, name: `github-pages`, size_in_bytes: 221 }] artifacts: [{ id: 11, name: `github-pages`, size_in_bytes: 221 }]
@@ -573,9 +577,10 @@ describe('Deployment', () => {
mockPool mockPool
.intercept({ .intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`, path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`,
method: "GET", method: 'GET'
}) })
.reply(200, .reply(
200,
{ {
total_count: 1, total_count: 1,
artifacts: [{ id: 11, name: `github-pages`, size_in_bytes: 221 }] artifacts: [{ id: 11, name: `github-pages`, size_in_bytes: 221 }]
@@ -641,9 +646,10 @@ describe('Deployment', () => {
mockPool mockPool
.intercept({ .intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`, path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`,
method: "GET", method: 'GET'
}) })
.reply(200, .reply(
200,
{ {
total_count: 1, total_count: 1,
artifacts: [{ id: 11, name: `github-pages`, size_in_bytes: 221 }] artifacts: [{ id: 11, name: `github-pages`, size_in_bytes: 221 }]
@@ -693,9 +699,10 @@ describe('Deployment', () => {
mockPool mockPool
.intercept({ .intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`, path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`,
method: "GET", method: 'GET'
}) })
.reply(200, .reply(
200,
{ {
total_count: 1, total_count: 1,
artifacts: [{ id: 11, name: `github-pages`, size_in_bytes: 221 }] artifacts: [{ id: 11, name: `github-pages`, size_in_bytes: 221 }]
@@ -791,9 +798,10 @@ describe('Deployment', () => {
mockPool mockPool
.intercept({ .intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`, path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`,
method: "GET", method: 'GET'
}) })
.reply(200, .reply(
200,
{ {
total_count: 1, total_count: 1,
artifacts: [{ id: 11, name: `github-pages`, size_in_bytes: 221 }] artifacts: [{ id: 11, name: `github-pages`, size_in_bytes: 221 }]
@@ -878,9 +886,10 @@ describe('Deployment', () => {
mockPool mockPool
.intercept({ .intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`, path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`,
method: "GET", method: 'GET'
}) })
.reply(200, .reply(
200,
{ {
total_count: 1, total_count: 1,
artifacts: [{ id: 11, name: `github-pages`, size_in_bytes: 221 }] artifacts: [{ id: 11, name: `github-pages`, size_in_bytes: 221 }]
@@ -968,9 +977,10 @@ describe('Deployment', () => {
mockPool mockPool
.intercept({ .intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`, path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`,
method: "GET", method: 'GET'
}) })
.reply(200, .reply(
200,
{ {
total_count: 1, total_count: 1,
artifacts: [{ id: 11, name: `github-pages`, size_in_bytes: 221 }] artifacts: [{ id: 11, name: `github-pages`, size_in_bytes: 221 }]
@@ -1043,9 +1053,10 @@ describe('Deployment', () => {
mockPool mockPool
.intercept({ .intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`, path: `/repos/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts?name=github-pages`,
method: "GET", method: 'GET'
}) })
.reply(200, .reply(
200,
{ {
total_count: 1, total_count: 1,
artifacts: [{ id: 11, name: `github-pages`, size_in_bytes: 221 }] artifacts: [{ id: 11, name: `github-pages`, size_in_bytes: 221 }]