Skip to content

Commit

Permalink
added readme moved tests inside src
Browse files Browse the repository at this point in the history
  • Loading branch information
ayeressian committed Jun 26, 2020
1 parent df88b0d commit faa9666
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 5 deletions.
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
# bunnycdn-storage-deploy

Deploys directory to BunnyCDN storage.
This action deploys selected directory to BunnyCDN storage.

## Inputs

### `source`

**Required** The source directory folder.

### `storageZoneName`

**Required** The name of your storage zone where you are connecting to.

### `apiKey`

**Required** The storage API key.

## Example usage
````
- name: Deploy to BunnyCDN
uses: ayeressian/bunnycdn-storage-deploy@latest
with:
source: "dist"
storageZoneName: "myzone"
accessKey: "${{ secrets.BUNNY_CDN_STORAGE_KEY }}"
````
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions test/uploader.test.ts → src/test/uploader.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {resolve} from 'path';
const fetchMock = jest.fn(() => Promise.resolve());
const fetchMock = jest.fn(() => Promise.resolve({status: 201}));
jest.mock('node-fetch', () => fetchMock);

import uploader from '../src/uploader';
import uploader from '../uploader';

describe('when uploading a directory with 3 files', () => {
it('should call fetch api 3 times with correct arguments', async () => {
await uploader(resolve('test/test-upload-dir'), 'storageName', 'key');
await uploader(resolve('src/test/test-upload-dir'), 'storageName', 'key');
expect(fetchMock).toHaveBeenCalledWith("https://storage.bunnycdn.com/storageName/test.txt", expect.anything());
expect(fetchMock).toHaveBeenCalledWith("https://storage.bunnycdn.com/storageName/test2.txt", expect.anything());
expect(fetchMock).toHaveBeenCalledWith("https://storage.bunnycdn.com/storageName/nestd/test3.txt", expect.anything());
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"resolveJsonModule": true,
},
"include": [
"src"
"src"
]
}

0 comments on commit faa9666

Please sign in to comment.