-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from pirafrank/dev
v0.1.2
- Loading branch information
Showing
16 changed files
with
360 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
node_modules | ||
.gitignore | ||
*.test.js | ||
jest.config.js | ||
.docker | ||
.github | ||
.vscode | ||
dummy | ||
.env | ||
.env* |
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 @@ | ||
export GITHUB_TOKEN="gh123abc" |
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
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 |
---|---|---|
@@ -1,6 +1,17 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
argv=(node /app/github.js "$@") | ||
cmd=$(printf '%q ' "${argv[@]}") | ||
eval $cmd | ||
|
||
if [ -z "$GITHUB_TOKEN" ]; then | ||
echo "GITHUB_TOKEN is not set. Exiting." | ||
exit 1 | ||
fi | ||
|
||
if [[ "$DEBUG" == "true" ]]; then | ||
echo "first arg" | ||
echo $1 | ||
echo "all args:" | ||
echo $@ | ||
fi | ||
|
||
eval "node /app/github.js $@" |
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,63 @@ | ||
const { exec } = require("child_process"); | ||
const { | ||
repoOwner, | ||
repoName, | ||
correctBranch, | ||
wrongBranch, | ||
} = require("./test.common.js"); | ||
|
||
describe("github.js", () => { | ||
describe("commit command", () => { | ||
test("commit command, good branch", (done) => { | ||
exec( | ||
`node github.js commit -o ${repoOwner} -r ${repoName} -b ${correctBranch} -c dummy/file1.txt -m "this is a commit msg"`, | ||
(error, stdout, stderr) => { | ||
expect(error).toBeNull(); | ||
expect(stdout).toContain( | ||
`Commit created: https://github.com/${repoOwner}/${repoName}/commit` | ||
); | ||
done(); | ||
} | ||
); | ||
}, 10000); | ||
|
||
test("commit command, BAD branch", (done) => { | ||
exec( | ||
`node github.js commit -o ${repoOwner} -r ${repoName} -b ${wrongBranch} -c dummy/file1.txt -m "this is a commit msg"`, | ||
(error, stdout, stderr) => { | ||
expect(error).not.toBeNull(); | ||
expect(stderr).toMatch(/Failed to create commit:/); | ||
done(); | ||
} | ||
); | ||
}, 10000); | ||
}); | ||
|
||
describe("branch command", () => { | ||
test("branch command, good branch", (done) => { | ||
exec( | ||
`node github.js branch -o ${repoOwner} -r ${repoName} -b ${correctBranch}`, | ||
(error, stdout, stderr) => { | ||
expect(error).toBeNull(); | ||
expect(stdout).toContain( | ||
`Repository ${repoOwner}/${repoName} has a branch named '${correctBranch}'` | ||
); | ||
done(); | ||
} | ||
); | ||
}, 10000); | ||
|
||
test("branch command, BAD branch", (done) => { | ||
exec( | ||
`node github.js branch -o ${repoOwner} -r ${repoName} -b ${wrongBranch}`, | ||
(error, stdout, stderr) => { | ||
expect(error).toBeNull(); | ||
expect(stdout).toContain( | ||
`Repository ${repoOwner}/${repoName} has no branch named '${wrongBranch}'` | ||
); | ||
done(); | ||
} | ||
); | ||
}, 10000); | ||
}); | ||
}); |
Oops, something went wrong.