-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
310 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const describeArtifact = async ({ appSlug, buildSlug, artifactSlug, client }) => { | ||
const response = await client.get(`/apps/${appSlug}/builds/${buildSlug}/artifacts/${artifactSlug}`); | ||
return response.data.data; | ||
}; | ||
|
||
module.exports = ({ appSlug, buildSlug, artifactSlug, client }) => { | ||
const artifact = { appSlug, buildSlug, artifactSlug }; | ||
const state = { appSlug, buildSlug, artifactSlug, client }; | ||
|
||
artifact.describe = describeArtifact.bind(artifact, state); | ||
|
||
return artifact; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const axios = require('axios'); | ||
const artifact = require('../src/artifact'); | ||
const test = require('ava'); | ||
const uuid = require('uuid/v4'); | ||
|
||
const { stubGetArtifact } = require('./stubs'); | ||
|
||
test.beforeEach((test) => { | ||
const appSlug = uuid(); | ||
const buildSlug = uuid(); | ||
const artifactSlug = uuid(); | ||
const client = axios.create(); | ||
|
||
test.context.appSlug = appSlug; | ||
test.context.artifactSlug = artifactSlug; | ||
test.context.artifact = artifact({ appSlug, buildSlug, artifactSlug, client }); | ||
test.context.buildSlug = buildSlug; | ||
test.context.client = client; | ||
}); | ||
|
||
test('has app, build, and artifact slugs', (test) => { | ||
const { appSlug, artifact, buildSlug, artifactSlug } = test.context; | ||
test.is(artifact.appSlug, appSlug); | ||
test.is(artifact.buildSlug, buildSlug); | ||
test.is(artifact.artifactSlug, artifactSlug); | ||
}); | ||
|
||
test('describing an artifact returns the artifact attributes', async (test) => { | ||
const { appSlug, artifact, buildSlug, artifactSlug, client } = test.context; | ||
const stub = stubGetArtifact({ axios: client, appSlug, buildSlug, artifactSlug }); | ||
|
||
const description = await artifact.describe(); | ||
test.deepEqual(description, stub.artifact); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.