mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Prettier: Upgrade to 2 (#30387)
* Updated package json but not updated source files * Update eslint plugin * updated files
This commit is contained in:
@@ -47,7 +47,7 @@ const getTestContext = (overides?: object) => {
|
||||
user,
|
||||
} as any) as ContextSrv;
|
||||
const logoutMock = jest.fn();
|
||||
const parseRequestOptionsMock = jest.fn().mockImplementation(options => options);
|
||||
const parseRequestOptionsMock = jest.fn().mockImplementation((options) => options);
|
||||
|
||||
const backendSrv = new BackendSrv({
|
||||
fromFetch: fromFetchMock,
|
||||
@@ -167,7 +167,7 @@ describe('backendSrv', () => {
|
||||
|
||||
await backendSrv
|
||||
.request({ url, method: 'GET', retry: 0 })
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
expect(error.status).toBe(401);
|
||||
expect(error.statusText).toBe('UnAuthorized');
|
||||
expect(error.data).toEqual({ message: 'UnAuthorized' });
|
||||
@@ -177,7 +177,7 @@ describe('backendSrv', () => {
|
||||
expectRequestCallChain({ url, method: 'GET', retry: 0 });
|
||||
jest.advanceTimersByTime(50);
|
||||
})
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
expect(error).toEqual({ message: 'UnAuthorized' });
|
||||
expect(appEventsMock.emit).toHaveBeenCalledTimes(1);
|
||||
expect(appEventsMock.emit).toHaveBeenCalledWith(AppEvents.alertWarning, ['UnAuthorized', '']);
|
||||
@@ -202,7 +202,7 @@ describe('backendSrv', () => {
|
||||
|
||||
await backendSrv
|
||||
.request({ url, method: 'GET', retry: 0 })
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
expect(error.status).toBe(403);
|
||||
expect(error.statusText).toBe('Forbidden');
|
||||
expect(error.data).toEqual({ message: 'Forbidden' });
|
||||
@@ -212,7 +212,7 @@ describe('backendSrv', () => {
|
||||
expectRequestCallChain({ url, method: 'GET', retry: 0 });
|
||||
jest.advanceTimersByTime(50);
|
||||
})
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
expect(error).toEqual({ message: 'Forbidden' });
|
||||
expect(appEventsMock.emit).toHaveBeenCalledTimes(1);
|
||||
expect(appEventsMock.emit).toHaveBeenCalledWith(AppEvents.alertWarning, ['Forbidden', '']);
|
||||
@@ -253,7 +253,7 @@ describe('backendSrv', () => {
|
||||
|
||||
await backendSrv
|
||||
.request({ url, method: 'GET' })
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
expect(error.status).toBe(422);
|
||||
expect(error.statusText).toBe('Unprocessable Entity');
|
||||
expect(error.data).toEqual({ message: 'Unprocessable Entity' });
|
||||
@@ -262,7 +262,7 @@ describe('backendSrv', () => {
|
||||
expectRequestCallChain({ url, method: 'GET' });
|
||||
jest.advanceTimersByTime(50);
|
||||
})
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
expect(error).toEqual({ message: 'Unprocessable Entity' });
|
||||
expect(appEventsMock.emit).toHaveBeenCalledTimes(1);
|
||||
expect(appEventsMock.emit).toHaveBeenCalledWith(AppEvents.alertWarning, [
|
||||
@@ -284,7 +284,7 @@ describe('backendSrv', () => {
|
||||
});
|
||||
const url = '/api/dashboard/';
|
||||
|
||||
await backendSrv.request({ url, method: 'GET' }).catch(error => {
|
||||
await backendSrv.request({ url, method: 'GET' }).catch((error) => {
|
||||
expect(error.status).toBe(404);
|
||||
expect(error.statusText).toBe('Not found');
|
||||
expect(error.data).toEqual({ message: 'Not found' });
|
||||
@@ -306,7 +306,7 @@ describe('backendSrv', () => {
|
||||
const { backendSrv, fromFetchMock } = getTestContext({ url });
|
||||
const unsubscribe = jest.fn();
|
||||
const slowData = { message: 'Slow Request' };
|
||||
const slowFetch = new Observable(subscriber => {
|
||||
const slowFetch = new Observable((subscriber) => {
|
||||
subscriber.next({
|
||||
ok: true,
|
||||
status: 200,
|
||||
@@ -340,7 +340,7 @@ describe('backendSrv', () => {
|
||||
};
|
||||
|
||||
let slowError: any = null;
|
||||
backendSrv.request(options).catch(err => {
|
||||
backendSrv.request(options).catch((err) => {
|
||||
slowError = err;
|
||||
});
|
||||
|
||||
@@ -379,10 +379,10 @@ describe('backendSrv', () => {
|
||||
|
||||
let inspectorPacket: any = null;
|
||||
backendSrv.getInspectorStream().subscribe({
|
||||
next: rsp => (inspectorPacket = rsp),
|
||||
next: (rsp) => (inspectorPacket = rsp),
|
||||
});
|
||||
|
||||
await backendSrv.datasourceRequest({ url, method: 'GET', retry: 0 }).catch(error => {
|
||||
await backendSrv.datasourceRequest({ url, method: 'GET', retry: 0 }).catch((error) => {
|
||||
expect(error.status).toBe(401);
|
||||
expect(error.statusText).toBe('UnAuthorized');
|
||||
expect(error.data).toEqual({ message: 'UnAuthorized' });
|
||||
@@ -413,7 +413,7 @@ describe('backendSrv', () => {
|
||||
.fn()
|
||||
.mockRejectedValue({ status: 403, statusText: 'Forbidden', data: { message: 'Forbidden' } });
|
||||
|
||||
await backendSrv.datasourceRequest(options).catch(error => {
|
||||
await backendSrv.datasourceRequest(options).catch((error) => {
|
||||
expect(error.status).toBe(403);
|
||||
expect(error.statusText).toBe('Forbidden');
|
||||
expect(error.data).toEqual({ message: 'Forbidden' });
|
||||
@@ -438,7 +438,7 @@ describe('backendSrv', () => {
|
||||
method: 'GET',
|
||||
};
|
||||
|
||||
await backendSrv.datasourceRequest(options).catch(error => {
|
||||
await backendSrv.datasourceRequest(options).catch((error) => {
|
||||
expect(error).toEqual({
|
||||
status: 500,
|
||||
statusText: 'Internal Server Error',
|
||||
@@ -470,10 +470,10 @@ describe('backendSrv', () => {
|
||||
|
||||
let inspectorPacket: any = null;
|
||||
backendSrv.getInspectorStream().subscribe({
|
||||
next: rsp => (inspectorPacket = rsp),
|
||||
next: (rsp) => (inspectorPacket = rsp),
|
||||
});
|
||||
|
||||
await backendSrv.datasourceRequest(options).catch(error => {
|
||||
await backendSrv.datasourceRequest(options).catch((error) => {
|
||||
expect(error).toEqual({
|
||||
status: 403,
|
||||
statusText: 'Forbidden',
|
||||
@@ -496,7 +496,7 @@ describe('backendSrv', () => {
|
||||
const url = '/api/dashboard/';
|
||||
|
||||
const getRequestObservable = (message: string, unsubscribe: any) =>
|
||||
new Observable(subscriber => {
|
||||
new Observable((subscriber) => {
|
||||
subscriber.next({
|
||||
ok: true,
|
||||
status: 200,
|
||||
|
||||
@@ -48,7 +48,7 @@ describe('SearchSrv', () => {
|
||||
|
||||
impressionSrv.getDashboardOpened = jest.fn().mockReturnValue([1, 2]);
|
||||
|
||||
return searchSrv.search({ query: '' }).then(res => {
|
||||
return searchSrv.search({ query: '' }).then((res) => {
|
||||
results = res;
|
||||
});
|
||||
});
|
||||
@@ -80,7 +80,7 @@ describe('SearchSrv', () => {
|
||||
|
||||
impressionSrv.getDashboardOpened = jest.fn().mockReturnValue([4, 5, 1, 2, 3]);
|
||||
|
||||
return searchSrv.search({ query: '' }).then(res => {
|
||||
return searchSrv.search({ query: '' }).then((res) => {
|
||||
results = res;
|
||||
});
|
||||
});
|
||||
@@ -99,7 +99,7 @@ describe('SearchSrv', () => {
|
||||
beforeEach(() => {
|
||||
searchMock.mockImplementation(jest.fn().mockReturnValue(Promise.resolve([{ id: 1, title: 'starred' }])));
|
||||
|
||||
return searchSrv.search({ query: '' }).then(res => {
|
||||
return searchSrv.search({ query: '' }).then((res) => {
|
||||
results = res;
|
||||
});
|
||||
});
|
||||
@@ -127,7 +127,7 @@ describe('SearchSrv', () => {
|
||||
);
|
||||
|
||||
impressionSrv.getDashboardOpened = jest.fn().mockReturnValue([1, 2]);
|
||||
return searchSrv.search({ query: '' }).then(res => {
|
||||
return searchSrv.search({ query: '' }).then((res) => {
|
||||
results = res;
|
||||
});
|
||||
});
|
||||
@@ -179,7 +179,7 @@ describe('SearchSrv', () => {
|
||||
)
|
||||
);
|
||||
|
||||
return searchSrv.search({ query: '' }).then(res => {
|
||||
return searchSrv.search({ query: '' }).then((res) => {
|
||||
results = res;
|
||||
});
|
||||
});
|
||||
@@ -218,7 +218,7 @@ describe('SearchSrv', () => {
|
||||
)
|
||||
);
|
||||
|
||||
return searchSrv.search({ query: 'search' }).then(res => {
|
||||
return searchSrv.search({ query: 'search' }).then((res) => {
|
||||
results = res;
|
||||
});
|
||||
});
|
||||
|
||||
@@ -77,25 +77,25 @@ describe('when sorting with nulls', () => {
|
||||
|
||||
it('numbers with nulls at end with asc sort', () => {
|
||||
table.sort({ col: 0, desc: false });
|
||||
values = table.rows.map(row => row[0]);
|
||||
values = table.rows.map((row) => row[0]);
|
||||
expect(values).toEqual([-8, 0, 0, 2, 19, 42, null, null]);
|
||||
});
|
||||
|
||||
it('numbers with nulls at start with desc sort', () => {
|
||||
table.sort({ col: 0, desc: true });
|
||||
values = table.rows.map(row => row[0]);
|
||||
values = table.rows.map((row) => row[0]);
|
||||
expect(values).toEqual([null, null, 42, 19, 2, 0, 0, -8]);
|
||||
});
|
||||
|
||||
it('strings with nulls at end with asc sort', () => {
|
||||
table.sort({ col: 1, desc: false });
|
||||
values = table.rows.map(row => row[1]);
|
||||
values = table.rows.map((row) => row[1]);
|
||||
expect(values).toEqual(['', '', 'a', 'b', 'c', 'd', null, null]);
|
||||
});
|
||||
|
||||
it('strings with nulls at start with desc sort', () => {
|
||||
table.sort({ col: 1, desc: true });
|
||||
values = table.rows.map(row => row[1]);
|
||||
values = table.rows.map((row) => row[1]);
|
||||
expect(values).toEqual([null, null, 'd', 'c', 'b', 'a', '', '']);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user