Skip to content
This repository has been archived by the owner on Mar 4, 2021. It is now read-only.

Commit

Permalink
Create test stub, add CI workflow file, add test badge
Browse files Browse the repository at this point in the history
  • Loading branch information
IAmHughes committed Sep 25, 2019
1 parent f427b0b commit 63a40d6
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 38 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,15 @@
name: "Tests"

on:
pull_request:
push:
branches: # array of glob patterns matching against refs/heads. Optional; defaults to all
- master # triggers on pushes that contain changes in master

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: npm ci
- run: npm test
37 changes: 0 additions & 37 deletions .github/workflows/upload-release-asset.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
@@ -1,7 +1,7 @@
# GitHub Action - Releases API
This GitHub Action (written in JavaScript) wraps the [GitHub Release API](https://developer.github.com/v3/repos/releases/), specifically the [Upload a Release Asset](https://developer.github.com/v3/repos/releases/#upload-a-release-asset) endpoint, to allow you to leverage GitHub Actions to upload release assets.

<a href="https://github.com/actions/upload-release-asset"><img alt="GitHub Actions status" src="https://github.com/actions/upload-release-asset/workflows/Upload%20Release%20Asset/badge.svg"></a>
<a href="https://github.com/actions/upload-release-asset"><img alt="GitHub Actions status" src="https://github.com/actions/upload-release-asset/workflows/Tests/badge.svg"></a>

## Usage
### Pre-requisites
Expand Down
37 changes: 37 additions & 0 deletions tests/main.test.js
@@ -0,0 +1,37 @@
jest.mock('@actions/github');

const { GitHub, context } = require('@actions/github');
const run = require('../src/main.js');

/* eslint-disable no-undef */
describe('module', () => {
let uploadReleaseAsset;

beforeEach(() => {
uploadReleaseAsset = jest.fn();

context.repo = {
owner: 'owner',
repo: 'repo'
};

const github = {
repos: {
uploadReleaseAsset
}
};

GitHub.mockImplementation(() => github);
});

test('Upload release endpoint is called', async () => {
await run();

expect(uploadReleaseAsset).toHaveBeenCalledWith({
owner: 'owner',
repo: 'repo'
});
});

test('Outputs are set', async () => {});
});

0 comments on commit 63a40d6

Please sign in to comment.