Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
2837fd51
Commit
2837fd51
authored
Nov 01, 2018
by
Peter Holmberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests
parent
7fc4b193
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
199 additions
and
1 deletions
+199
-1
public/app/features/datasources/settings/BasicSettings.test.tsx
+20
-0
public/app/features/datasources/settings/ButtonRow.test.tsx
+31
-0
public/app/features/datasources/settings/DataSourceSettings.test.tsx
+63
-0
public/app/features/datasources/settings/PluginSettings.tsx
+1
-1
public/app/features/datasources/settings/__snapshots__/BasicSettings.test.tsx.snap
+25
-0
public/app/features/datasources/settings/__snapshots__/ButtonRow.test.tsx.snap
+59
-0
public/app/features/datasources/settings/__snapshots__/DataSourceSettings.test.tsx.snap
+0
-0
No files found.
public/app/features/datasources/settings/BasicSettings.test.tsx
0 → 100644
View file @
2837fd51
import
React
from
'react'
;
import
{
shallow
}
from
'enzyme'
;
import
BasicSettings
,
{
Props
}
from
'./BasicSettings'
;
const
setup
=
()
=>
{
const
props
:
Props
=
{
dataSourceName
:
'Graphite'
,
onChange
:
jest
.
fn
(),
};
return
shallow
(<
BasicSettings
{
...
props
}
/>);
};
describe
(
'Render'
,
()
=>
{
it
(
'should render component'
,
()
=>
{
const
wrapper
=
setup
();
expect
(
wrapper
).
toMatchSnapshot
();
});
});
public/app/features/datasources/settings/ButtonRow.test.tsx
0 → 100644
View file @
2837fd51
import
React
from
'react'
;
import
{
shallow
}
from
'enzyme'
;
import
ButtonRow
,
{
Props
}
from
'./ButtonRow'
;
const
setup
=
(
propOverrides
?:
object
)
=>
{
const
props
:
Props
=
{
isReadOnly
:
true
,
onSubmit
:
jest
.
fn
(),
onDelete
:
jest
.
fn
(),
};
Object
.
assign
(
props
,
propOverrides
);
return
shallow
(<
ButtonRow
{
...
props
}
/>);
};
describe
(
'Render'
,
()
=>
{
it
(
'should render component'
,
()
=>
{
const
wrapper
=
setup
();
expect
(
wrapper
).
toMatchSnapshot
();
});
it
(
'should render with buttons enabled'
,
()
=>
{
const
wrapper
=
setup
({
isReadOnly
:
false
,
});
expect
(
wrapper
).
toMatchSnapshot
();
});
});
public/app/features/datasources/settings/DataSourceSettings.test.tsx
0 → 100644
View file @
2837fd51
import
React
from
'react'
;
import
{
shallow
}
from
'enzyme'
;
import
{
DataSourceSettings
,
Props
}
from
'./DataSourceSettings'
;
import
{
DataSource
,
NavModel
}
from
'../../../types'
;
import
{
getMockDataSource
}
from
'../__mocks__/dataSourcesMocks'
;
import
{
getMockPlugin
}
from
'../../plugins/__mocks__/pluginMocks'
;
const
setup
=
(
propOverrides
?:
object
)
=>
{
const
props
:
Props
=
{
navModel
:
{}
as
NavModel
,
dataSource
:
getMockDataSource
(),
dataSourceMeta
:
getMockPlugin
(),
pageId
:
1
,
deleteDataSource
:
jest
.
fn
(),
loadDataSource
:
jest
.
fn
(),
setDataSourceName
:
jest
.
fn
(),
updateDataSource
:
jest
.
fn
(),
};
Object
.
assign
(
props
,
propOverrides
);
return
shallow
(<
DataSourceSettings
{
...
props
}
/>);
};
describe
(
'Render'
,
()
=>
{
it
(
'should render component'
,
()
=>
{
const
wrapper
=
setup
();
expect
(
wrapper
).
toMatchSnapshot
();
});
it
(
'should render loader'
,
()
=>
{
const
wrapper
=
setup
({
dataSource
:
{}
as
DataSource
,
});
expect
(
wrapper
).
toMatchSnapshot
();
});
it
(
'should render beta info text'
,
()
=>
{
const
wrapper
=
setup
({
dataSourceMeta
:
{
...
getMockPlugin
(),
state
:
'beta'
},
});
expect
(
wrapper
).
toMatchSnapshot
();
});
it
(
'should render alpha info text'
,
()
=>
{
const
wrapper
=
setup
({
dataSourceMeta
:
{
...
getMockPlugin
(),
state
:
'alpha'
},
});
expect
(
wrapper
).
toMatchSnapshot
();
});
it
(
'should render is ready only message'
,
()
=>
{
const
wrapper
=
setup
({
dataSource
:
{
...
getMockDataSource
(),
readOnly
:
true
},
});
expect
(
wrapper
).
toMatchSnapshot
();
});
});
public/app/features/datasources/settings/PluginSettings.tsx
View file @
2837fd51
...
...
@@ -3,7 +3,7 @@ import _ from 'lodash';
import
{
DataSource
,
Plugin
}
from
'app/types/'
;
import
{
getAngularLoader
,
AngularComponent
}
from
'app/core/services/AngularLoader'
;
interface
Props
{
export
interface
Props
{
dataSource
:
DataSource
;
dataSourceMeta
:
Plugin
;
onModelChange
:
(
dataSource
:
DataSource
)
=>
void
;
...
...
public/app/features/datasources/settings/__snapshots__/BasicSettings.test.tsx.snap
0 → 100644
View file @
2837fd51
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Render should render component 1`] = `
<div
className="gf-form-group"
>
<div
className="gf-form max-width-30"
>
<Component
tooltip="The name is used when you select the data source in panels. The Default data source ispreselected in new panels."
>
Name
</Component>
<input
className="gf-form-input max-width-23"
onChange={[Function]}
placeholder="Name"
required={true}
type="text"
value="Graphite"
/>
</div>
</div>
`;
public/app/features/datasources/settings/__snapshots__/ButtonRow.test.tsx.snap
0 → 100644
View file @
2837fd51
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Render should render component 1`] = `
<div
className="gf-form-button-row"
>
<button
className="btn btn-success"
disabled={true}
onClick={[Function]}
type="submit"
>
Save & Test
</button>
<button
className="btn btn-danger"
disabled={true}
onClick={[MockFunction]}
type="submit"
>
Delete
</button>
<a
className="btn btn-inverse"
href="/datasources"
>
Back
</a>
</div>
`;
exports[`Render should render with buttons enabled 1`] = `
<div
className="gf-form-button-row"
>
<button
className="btn btn-success"
disabled={false}
onClick={[Function]}
type="submit"
>
Save & Test
</button>
<button
className="btn btn-danger"
disabled={false}
onClick={[MockFunction]}
type="submit"
>
Delete
</button>
<a
className="btn btn-inverse"
href="/datasources"
>
Back
</a>
</div>
`;
public/app/features/datasources/settings/__snapshots__/DataSourceSettings.test.tsx.snap
0 → 100644
View file @
2837fd51
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment