setup ava for ts, port test/ to ts

This commit is contained in:
Labhansh Agrawal 2019-12-14 12:01:15 +05:30 committed by Benjamin Staneck
parent acbf06e4ac
commit 09980caa67
8 changed files with 58 additions and 10 deletions

View file

@ -5,7 +5,7 @@ import path from 'path';
import test from 'ava';
import {Application} from 'spectron';
let app;
let app: Application;
test.before(async () => {
let pathToBinary;
@ -40,5 +40,5 @@ test.after(async () => {
test('see if dev tools are open', async t => {
await app.client.waitUntilWindowLoaded();
t.false(await app.browserWindow.isDevToolsOpened());
t.false(await app.webContents.isDevToolsOpened());
});

View file

@ -1,5 +1,5 @@
function isHexColor(color) {
function isHexColor(color: string) {
return /(^#[0-9A-F]{6,8}$)|(^#[0-9A-F]{3}$)/i.test(color); // https://regex101.com/
}
module.exports.isHexColor = isHexColor;
export {isHexColor};

View file

@ -2,10 +2,10 @@ import test from 'ava';
const proxyquire = require('proxyquire').noCallThru();
test('existsOnNpm() builds the url for non-scoped packages', t => {
let getUrl;
let getUrl: string;
const {existsOnNpm} = proxyquire('../../cli/api', {
got: {
get(url) {
get(url: string) {
getUrl = url;
return Promise.resolve({
body: {
@ -23,10 +23,10 @@ test('existsOnNpm() builds the url for non-scoped packages', t => {
});
test('existsOnNpm() builds the url for scoped packages', t => {
let getUrl;
let getUrl: string;
const {existsOnNpm} = proxyquire('../../cli/api', {
got: {
get(url) {
get(url: string) {
getUrl = url;
return Promise.resolve({
body: {