forked from mirrors/action-gh-release
refactor for cross platform use
This commit is contained in:
parent
090932e783
commit
18daf2c63f
15 changed files with 5626 additions and 23 deletions
30
__tests__/github.test.ts
Normal file
30
__tests__/github.test.ts
Normal file
|
@ -0,0 +1,30 @@
|
|||
//import * as assert from "assert";
|
||||
//const assert = require('assert');
|
||||
import * as assert from 'assert';
|
||||
import { mimeOrDefault, asset } from '../src/github';
|
||||
|
||||
describe('github', () => {
|
||||
describe('mimeOrDefault', () => {
|
||||
it('returns a specific mime for common path', async () => {
|
||||
assert.equal(mimeOrDefault('foo.tar.gz'), 'application/gzip')
|
||||
});
|
||||
it('returns default mime for uncommon path', async () => {
|
||||
assert.equal(mimeOrDefault('foo.uncommon'), 'application/octet-stream')
|
||||
});
|
||||
});
|
||||
|
||||
describe('asset', () => {
|
||||
it('derives asset info from a path', async () => {
|
||||
const {
|
||||
name,
|
||||
mime,
|
||||
size,
|
||||
file
|
||||
} = asset('tests/data/foo/bar.txt');
|
||||
assert.equal(name, 'bar.txt');
|
||||
assert.equal(mime, 'text/plain');
|
||||
assert.equal(size, 10);
|
||||
assert.equal(file.toString(), 'release me')
|
||||
});
|
||||
})
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue