eslint - rules updated
This commit is contained in:
@@ -7,7 +7,7 @@ import {getUserName} from '../src/SomeModule';
|
||||
import {setConfig, UserInfo} from '../src/utils/utils';
|
||||
|
||||
describe('frontend:SomeModule', () => {
|
||||
const CONFIG = {EXTERNAL_BASE_URL: "http://demo.url"};
|
||||
const CONFIG = {EXTERNAL_BASE_URL: 'http://demo.url'};
|
||||
before(() => {
|
||||
setConfig(CONFIG);
|
||||
fetchMock.config.overwriteRoutes = true;
|
||||
@@ -15,14 +15,14 @@ describe('frontend:SomeModule', () => {
|
||||
it('should return username', async () => {
|
||||
const tests: [Partial<UserInfo>, string][] = [
|
||||
[
|
||||
{name: "John Doe"},
|
||||
"John Doe",
|
||||
{name: 'John Doe'},
|
||||
'John Doe',
|
||||
], [
|
||||
{name: "John Doe", email: "some.mail@example.com"},
|
||||
"John Doe",
|
||||
{name: 'John Doe', email: 'some.mail@example.com'},
|
||||
'John Doe',
|
||||
], [
|
||||
{name: "", email: "some.mail@example.com"},
|
||||
"",
|
||||
{name: '', email: 'some.mail@example.com'},
|
||||
'',
|
||||
],
|
||||
];
|
||||
for (const [USER_INFO, RESULT] of tests) {
|
||||
@@ -35,13 +35,13 @@ describe('frontend:SomeModule', () => {
|
||||
}
|
||||
});
|
||||
it('should return default string', async () => {
|
||||
const RESULT = "No name found!";
|
||||
const RESULT = 'No name found!';
|
||||
const tests: (Partial<UserInfo>|unknown)[] = [
|
||||
// eslint-disable-next-line no-null/no-null
|
||||
{name: null},
|
||||
// eslint-disable-next-line no-null/no-null
|
||||
null,
|
||||
{email: "some.mail@example.com"},
|
||||
{email: 'some.mail@example.com'},
|
||||
{name: undefined},
|
||||
{},
|
||||
];
|
||||
|
||||
@@ -7,13 +7,13 @@ import {JSDOM} from 'jsdom';
|
||||
// @ts-ignore
|
||||
import * as rewire from 'rewire';
|
||||
|
||||
describe("frontend:index", () => {
|
||||
const updateUserName = rewire("../src/index").__get__("updateUserName") as (name: string) => void;
|
||||
describe('frontend:index', () => {
|
||||
const updateUserName = rewire('../src/index').__get__('updateUserName') as (name: string) => void;
|
||||
|
||||
beforeEach(() => {
|
||||
const dom = new JSDOM(
|
||||
`
|
||||
<html>
|
||||
<html lang="en">
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
@@ -27,13 +27,13 @@ describe("frontend:index", () => {
|
||||
global.document = dom.window.document;
|
||||
});
|
||||
|
||||
it("updateUserName", (done) => {
|
||||
const NAME = "Patrick Star";
|
||||
const RESULT = "This user name is fetched with Javascript: Patrick Star";
|
||||
it('updateUserName', (done) => {
|
||||
const NAME = 'Patrick Star';
|
||||
const RESULT = 'This user name is fetched with Javascript: Patrick Star';
|
||||
updateUserName(NAME);
|
||||
// give the browser a chance to update the DOM
|
||||
setTimeout(() => {
|
||||
const span = document.getElementsByTagName("span");
|
||||
const span = document.getElementsByTagName('span');
|
||||
expect(span).to.not.be.null;
|
||||
expect(span.length).to.be.greaterThan(0);
|
||||
expect(span[0].innerText).to.deep.equal(RESULT);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable promise/catch-or-return,promise/no-callback-in-promise */
|
||||
import {setConfig, getConfig, resetConfig, getUserInfo, UserInfo} from '../src/utils/utils';
|
||||
import {Resolvable, WaitForSync} from '../src/utils/resolvable';
|
||||
import {describe, it} from 'mocha';
|
||||
@@ -7,7 +8,7 @@ import {expect} from 'chai';
|
||||
import * as fetchMock from 'fetch-mock';
|
||||
|
||||
describe('frontend:utils - setConfig/getConfig', () => {
|
||||
const CONFIG = {EXTERNAL_BASE_URL: "http://demo.url"};
|
||||
const CONFIG = {EXTERNAL_BASE_URL: 'http://demo.url'};
|
||||
afterEach(() => resetConfig());
|
||||
|
||||
it('should return config (afterwards)', async () => {
|
||||
@@ -25,9 +26,9 @@ describe('frontend:utils - setConfig/getConfig', () => {
|
||||
});
|
||||
|
||||
describe('frontend:utils - getUserInfo', () => {
|
||||
const CONFIG = {EXTERNAL_BASE_URL: "http://demo.url"};
|
||||
const CONFIG = {EXTERNAL_BASE_URL: 'http://demo.url'};
|
||||
const USER_INFO: Partial<UserInfo> = {
|
||||
name: "John Doe",
|
||||
name: 'John Doe',
|
||||
};
|
||||
|
||||
beforeEach(() => setConfig(CONFIG));
|
||||
@@ -46,7 +47,7 @@ describe('frontend:utils - getUserInfo', () => {
|
||||
|
||||
describe('frontend:utils - resolvable', () => {
|
||||
const DATA = 5;
|
||||
const ERROR = new Error("Custom error!");
|
||||
const ERROR = new Error('Custom error!');
|
||||
|
||||
it('waitForSync should return data (afterwards)', async () => {
|
||||
const resolvable = new WaitForSync<number>();
|
||||
|
||||
Reference in New Issue
Block a user