added react-ioc-tests sample web part (#815)
This commit is contained in:
parent
ebb56d3da5
commit
09609b9587
|
@ -0,0 +1,25 @@
|
|||
# EditorConfig helps developers define and maintain consistent
|
||||
# coding styles between different editors and IDEs
|
||||
# editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
|
||||
[*]
|
||||
|
||||
# change these settings to your own preference
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
# we recommend you to keep these unchanged
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[{package,bower}.json]
|
||||
indent_style = space
|
||||
indent_size = 2
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"@microsoft/generator-sharepoint": {
|
||||
"isCreatingSolution": true,
|
||||
"environment": "spo",
|
||||
"version": "1.8.0",
|
||||
"libraryName": "ioc-tests",
|
||||
"libraryId": "d831edc5-e461-4c60-8ebe-178f5270e58e",
|
||||
"packageManager": "npm",
|
||||
"componentType": "webpart"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
# React Inversion Of Control Web Part with Unit Tests using Jest and Enzyme
|
||||
|
||||
## Summary
|
||||
This web part is provided as an example of implementing an IoC (Inversion of Control) pattern in the context of a SharePoint Framework web part.
|
||||
|
||||
Following this pattern greatly improves the modularity, maintainability, and testability of the code.
|
||||
|
||||
The example includes 100% test coverage, using Jest and Enzyme, of .ts and .tsx files, excluding *WebPart.ts files. A dependency injector class specific to a web part class is used to map web part properties to component properties and create dependencies. This pattern is designed to remove logic from the *WebPart.ts file, the only ts file that isn't unit tested, and hence ensure that all relevant web part logic is tested.
|
||||
|
||||
Included in the coverage is a cache and logger class, along with a service class that fetches data asychronously using @PnP/sp and dynamic bundling.
|
||||
|
||||
The example also includes a pipeline definition .yaml file for Azure DevOps CI build pipeline (/pipelines/) which includes the build, running tests, and posting the test coverage results.
|
||||
|
||||
![Sample SPFx Web Part implementing IoC pattern](./assets/preview.jpg)
|
||||
|
||||
## Used SharePoint Framework Version
|
||||
![drop](https://img.shields.io/badge/version-1.8.0-green.svg)
|
||||
|
||||
## Applies to
|
||||
|
||||
* [SharePoint Framework](https:/dev.office.com/sharepoint)
|
||||
* [Office 365 tenant](https://dev.office.com/sharepoint/docs/spfx/set-up-your-development-environment)
|
||||
|
||||
|
||||
## Solution
|
||||
|
||||
Solution|Author(s)
|
||||
--------|---------
|
||||
react-ioc-tests | Paul Ryan
|
||||
|
||||
## Version history
|
||||
|
||||
Version|Date|Comments
|
||||
-------|----|--------
|
||||
1.0|March 20, 2019|Initial release
|
||||
|
||||
## Disclaimer
|
||||
**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**
|
||||
|
||||
---
|
||||
|
||||
## Minimal Path to Awesome
|
||||
|
||||
- Clone this repository
|
||||
- in the command line run:
|
||||
- `npm install`
|
||||
- *`npm test`*
|
||||
- `gulp serve`
|
||||
|
||||
## Features
|
||||
This web part is provided as an example of implementing an IoC (Inversion of Control) pattern in the context of a SharePoint Framework web part.
|
||||
This Web Part illustrates the following concepts on top of the SharePoint Framework:
|
||||
|
||||
- Inversion of Control pattern
|
||||
- Unit testing with Jest and Enzyme
|
||||
- Azure DevOps CI Build Pipeline yaml definition file, includes running tests and checking code coverage
|
||||
|
||||
## References
|
||||
|
||||
https://github.com/SharePoint/sp-dev-fx-webparts/tree/master/samples/react-jest-testing
|
||||
|
||||
https://blog.velingeorgiev.com/unit-test-your-sharepoint-framework-solution-with-jest
|
||||
|
||||
https://www.eliostruyf.com/sharepoint-framework-unit-tests-with-jest/
|
||||
|
||||
https://github.com/estruyf/spfx-testing-jest
|
||||
|
||||
|
||||
|
||||
<img src="https://telemetry.sharepointpnp.com/sp-dev-fx-webparts/samples/react-ioc-tests" />
|
Binary file not shown.
After Width: | Height: | Size: 77 KiB |
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json",
|
||||
"version": "2.0",
|
||||
"bundles": {
|
||||
"ioc-tests-web-part": {
|
||||
"components": [
|
||||
{
|
||||
"entrypoint": "./lib/webparts/iocTests/IocTestsWebPart.js",
|
||||
"manifest": "./src/webparts/iocTests/IocTestsWebPart.manifest.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"externals": {},
|
||||
"localizedResources": {
|
||||
"IocTestsWebPartStrings": "lib/webparts/iocTests/loc/{locale}.js"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/copy-assets.schema.json",
|
||||
"deployCdnPath": "temp/deploy"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/deploy-azure-storage.schema.json",
|
||||
"workingDir": "./temp/deploy/",
|
||||
"account": "<!-- STORAGE ACCOUNT NAME -->",
|
||||
"container": "ioc-tests",
|
||||
"accessKey": "<!-- ACCESS KEY -->"
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
|
||||
"solution": {
|
||||
"name": "ioc-tests-client-side-solution",
|
||||
"id": "d831edc5-e461-4c60-8ebe-178f5270e58e",
|
||||
"version": "1.0.0.0",
|
||||
"includeClientSideAssets": true
|
||||
},
|
||||
"paths": {
|
||||
"zippedPackage": "solution/ioc-tests.sppkg"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/core-build/serve.schema.json",
|
||||
"port": 4321,
|
||||
"https": true,
|
||||
"initialPage": "https://localhost:5432/workbench",
|
||||
"api": {
|
||||
"port": 5432,
|
||||
"entryPath": "node_modules/@microsoft/sp-webpart-workbench/lib/api/"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json",
|
||||
"cdnBasePath": "<!-- PATH TO CDN -->"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
const gulp = require('gulp');
|
||||
const build = require('@microsoft/sp-build-web');
|
||||
build.addSuppression(`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`);
|
||||
|
||||
build.initialize(gulp);
|
|
@ -0,0 +1,397 @@
|
|||
<?xml version="1.0" ?>
|
||||
<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
|
||||
<coverage lines-valid="152" lines-covered="152" line-rate="1" branches-valid="62" branches-covered="62" branch-rate="1" timestamp="1553050544090" complexity="0" version="0.1">
|
||||
<sources>
|
||||
<source>C:\PWR\Repos\SPFxIoCTests</source>
|
||||
</sources>
|
||||
<packages>
|
||||
<package name="common.providers.Cache" line-rate="1" branch-rate="1">
|
||||
<classes>
|
||||
<class name="ICacheProvider.ts" filename="src\common\providers\Cache\ICacheProvider.ts" line-rate="1" branch-rate="1">
|
||||
<methods>
|
||||
<method name="(anonymous_0)" hits="3" signature="()V">
|
||||
<lines>
|
||||
<line number="2" hits="3"/>
|
||||
</lines>
|
||||
</method>
|
||||
</methods>
|
||||
<lines>
|
||||
<line number="2" hits="3" branch="true" condition-coverage="100% (2/2)"/>
|
||||
<line number="3" hits="3" branch="false"/>
|
||||
<line number="4" hits="3" branch="false"/>
|
||||
<line number="5" hits="3" branch="false"/>
|
||||
<line number="6" hits="3" branch="false"/>
|
||||
<line number="7" hits="3" branch="false"/>
|
||||
</lines>
|
||||
</class>
|
||||
<class name="StorageCacheProvider.ts" filename="src\common\providers\Cache\StorageCacheProvider.ts" line-rate="1" branch-rate="1">
|
||||
<methods>
|
||||
<method name="(anonymous_12)" hits="2" signature="()V">
|
||||
<lines>
|
||||
<line number="3" hits="2"/>
|
||||
</lines>
|
||||
</method>
|
||||
<method name="StorageCacheProvider" hits="15" signature="()V">
|
||||
<lines>
|
||||
<line number="7" hits="15"/>
|
||||
</lines>
|
||||
</method>
|
||||
<method name="(anonymous_14)" hits="22" signature="()V">
|
||||
<lines>
|
||||
<line number="11" hits="22"/>
|
||||
</lines>
|
||||
</method>
|
||||
<method name="(anonymous_15)" hits="11" signature="()V">
|
||||
<lines>
|
||||
<line number="28" hits="11"/>
|
||||
</lines>
|
||||
</method>
|
||||
<method name="(anonymous_18)" hits="11" signature="()V">
|
||||
<lines>
|
||||
<line number="42" hits="11"/>
|
||||
</lines>
|
||||
</method>
|
||||
<method name="(anonymous_21)" hits="1" signature="()V">
|
||||
<lines>
|
||||
<line number="66" hits="1"/>
|
||||
</lines>
|
||||
</method>
|
||||
<method name="(anonymous_24)" hits="21" signature="()V">
|
||||
<lines>
|
||||
<line number="72" hits="21"/>
|
||||
</lines>
|
||||
</method>
|
||||
<method name="(anonymous_25)" hits="10" signature="()V">
|
||||
<lines>
|
||||
<line number="76" hits="10"/>
|
||||
</lines>
|
||||
</method>
|
||||
<method name="(anonymous_26)" hits="23" signature="()V">
|
||||
<lines>
|
||||
<line number="88" hits="23"/>
|
||||
</lines>
|
||||
</method>
|
||||
<method name="(anonymous_27)" hits="10" signature="()V">
|
||||
<lines>
|
||||
<line number="98" hits="10"/>
|
||||
</lines>
|
||||
</method>
|
||||
</methods>
|
||||
<lines>
|
||||
<line number="1" hits="2" branch="false"/>
|
||||
<line number="3" hits="2" branch="false"/>
|
||||
<line number="4" hits="15" branch="false"/>
|
||||
<line number="7" hits="19" branch="true" condition-coverage="100% (2/2)"/>
|
||||
<line number="8" hits="15" branch="false"/>
|
||||
<line number="11" hits="2" branch="false"/>
|
||||
<line number="12" hits="22" branch="false"/>
|
||||
<line number="13" hits="22" branch="true" condition-coverage="100% (4/4)"/>
|
||||
<line number="14" hits="22" branch="true" condition-coverage="100% (2/2)"/>
|
||||
<line number="16" hits="20" branch="false"/>
|
||||
<line number="17" hits="20" branch="false"/>
|
||||
<line number="18" hits="20" branch="false"/>
|
||||
<line number="19" hits="20" branch="false"/>
|
||||
<line number="20" hits="20" branch="false"/>
|
||||
<line number="25" hits="22" branch="false"/>
|
||||
<line number="28" hits="2" branch="false"/>
|
||||
<line number="29" hits="11" branch="false"/>
|
||||
<line number="30" hits="11" branch="false"/>
|
||||
<line number="31" hits="11" branch="true" condition-coverage="100% (2/2)"/>
|
||||
<line number="32" hits="10" branch="true" condition-coverage="100% (2/2)"/>
|
||||
<line number="33" hits="8" branch="false"/>
|
||||
<line number="34" hits="8" branch="true" condition-coverage="100% (5/5)"/>
|
||||
<line number="35" hits="1" branch="false"/>
|
||||
<line number="39" hits="11" branch="false"/>
|
||||
<line number="42" hits="12" branch="true" condition-coverage="100% (2/2)"/>
|
||||
<line number="43" hits="11" branch="false"/>
|
||||
<line number="44" hits="11" branch="false"/>
|
||||
<line number="45" hits="11" branch="true" condition-coverage="100% (2/2)"/>
|
||||
<line number="47" hits="10" branch="false"/>
|
||||
<line number="48" hits="10" branch="true" condition-coverage="100% (4/4)"/>
|
||||
<line number="49" hits="1" branch="false"/>
|
||||
<line number="50" hits="9" branch="true" condition-coverage="100% (2/2)"/>
|
||||
<line number="51" hits="1" branch="false"/>
|
||||
<line number="53" hits="8" branch="false"/>
|
||||
<line number="57" hits="10" branch="false"/>
|
||||
<line number="58" hits="10" branch="false"/>
|
||||
<line number="60" hits="10" branch="false"/>
|
||||
<line number="61" hits="10" branch="false"/>
|
||||
<line number="63" hits="11" branch="false"/>
|
||||
<line number="66" hits="2" branch="false"/>
|
||||
<line number="67" hits="1" branch="false"/>
|
||||
<line number="68" hits="1" branch="false"/>
|
||||
<line number="69" hits="1" branch="false"/>
|
||||
<line number="72" hits="2" branch="false"/>
|
||||
<line number="73" hits="21" branch="false"/>
|
||||
<line number="76" hits="2" branch="false"/>
|
||||
<line number="77" hits="10" branch="false"/>
|
||||
<line number="78" hits="10" branch="false"/>
|
||||
<line number="79" hits="10" branch="true" condition-coverage="100% (4/4)"/>
|
||||
<line number="80" hits="9" branch="false"/>
|
||||
<line number="81" hits="9" branch="true" condition-coverage="100% (2/2)"/>
|
||||
<line number="82" hits="8" branch="false"/>
|
||||
<line number="85" hits="10" branch="false"/>
|
||||
<line number="88" hits="2" branch="false"/>
|
||||
<line number="89" hits="23" branch="false"/>
|
||||
<line number="90" hits="23" branch="true" condition-coverage="100% (4/4)"/>
|
||||
<line number="91" hits="21" branch="false"/>
|
||||
<line number="93" hits="2" branch="false"/>
|
||||
<line number="95" hits="23" branch="false"/>
|
||||
<line number="98" hits="2" branch="false"/>
|
||||
<line number="99" hits="10" branch="false"/>
|
||||
<line number="101" hits="10" branch="false"/>
|
||||
<line number="103" hits="1" branch="false"/>
|
||||
<line number="104" hits="1" branch="false"/>
|
||||
<line number="106" hits="1" branch="false"/>
|
||||
<line number="107" hits="1" branch="false"/>
|
||||
<line number="109" hits="1" branch="false"/>
|
||||
<line number="110" hits="1" branch="false"/>
|
||||
<line number="112" hits="1" branch="false"/>
|
||||
<line number="113" hits="1" branch="false"/>
|
||||
<line number="115" hits="6" branch="false"/>
|
||||
<line number="116" hits="6" branch="false"/>
|
||||
<line number="118" hits="10" branch="false"/>
|
||||
<line number="120" hits="2" branch="false"/>
|
||||
</lines>
|
||||
</class>
|
||||
</classes>
|
||||
</package>
|
||||
<package name="common.providers.DependencyResolver" line-rate="1" branch-rate="1">
|
||||
<classes>
|
||||
<class name="DependencyResolver.ts" filename="src\common\providers\DependencyResolver\DependencyResolver.ts" line-rate="1" branch-rate="1">
|
||||
<methods>
|
||||
<method name="(anonymous_0)" hits="4" signature="()V">
|
||||
<lines>
|
||||
<line number="9" hits="4"/>
|
||||
</lines>
|
||||
</method>
|
||||
<method name="(anonymous_2)" hits="3" signature="()V">
|
||||
<lines>
|
||||
<line number="16" hits="3"/>
|
||||
</lines>
|
||||
</method>
|
||||
<method name="(anonymous_3)" hits="3" signature="()V">
|
||||
<lines>
|
||||
<line number="20" hits="3"/>
|
||||
</lines>
|
||||
</method>
|
||||
<method name="(anonymous_4)" hits="3" signature="()V">
|
||||
<lines>
|
||||
<line number="24" hits="3"/>
|
||||
</lines>
|
||||
</method>
|
||||
</methods>
|
||||
<lines>
|
||||
<line number="1" hits="1" branch="false"/>
|
||||
<line number="2" hits="1" branch="false"/>
|
||||
<line number="3" hits="1" branch="false"/>
|
||||
<line number="4" hits="1" branch="false"/>
|
||||
<line number="9" hits="1" branch="false"/>
|
||||
<line number="16" hits="1" branch="false"/>
|
||||
<line number="17" hits="3" branch="false"/>
|
||||
<line number="20" hits="1" branch="false"/>
|
||||
<line number="21" hits="3" branch="false"/>
|
||||
<line number="24" hits="1" branch="false"/>
|
||||
<line number="25" hits="3" branch="false"/>
|
||||
<line number="27" hits="1" branch="false"/>
|
||||
</lines>
|
||||
</class>
|
||||
</classes>
|
||||
</package>
|
||||
<package name="common.providers.Log" line-rate="1" branch-rate="1">
|
||||
<classes>
|
||||
<class name="ConsoleLogProvider.ts" filename="src\common\providers\Log\ConsoleLogProvider.ts" line-rate="1" branch-rate="1">
|
||||
<methods>
|
||||
<method name="(anonymous_12)" hits="2" signature="()V">
|
||||
<lines>
|
||||
<line number="4" hits="2"/>
|
||||
</lines>
|
||||
</method>
|
||||
<method name="ConsoleLogProvider" hits="11" signature="()V">
|
||||
<lines>
|
||||
<line number="6" hits="11"/>
|
||||
</lines>
|
||||
</method>
|
||||
<method name="(anonymous_14)" hits="2" signature="()V">
|
||||
<lines>
|
||||
<line number="10" hits="2"/>
|
||||
</lines>
|
||||
</method>
|
||||
<method name="(anonymous_17)" hits="2" signature="()V">
|
||||
<lines>
|
||||
<line number="14" hits="2"/>
|
||||
</lines>
|
||||
</method>
|
||||
<method name="(anonymous_20)" hits="2" signature="()V">
|
||||
<lines>
|
||||
<line number="18" hits="2"/>
|
||||
</lines>
|
||||
</method>
|
||||
<method name="(anonymous_23)" hits="2" signature="()V">
|
||||
<lines>
|
||||
<line number="22" hits="2"/>
|
||||
</lines>
|
||||
</method>
|
||||
<method name="(anonymous_26)" hits="8" signature="()V">
|
||||
<lines>
|
||||
<line number="27" hits="8"/>
|
||||
</lines>
|
||||
</method>
|
||||
<method name="(anonymous_27)" hits="8" signature="()V">
|
||||
<lines>
|
||||
<line number="32" hits="8"/>
|
||||
</lines>
|
||||
</method>
|
||||
</methods>
|
||||
<lines>
|
||||
<line number="4" hits="2" branch="false"/>
|
||||
<line number="6" hits="14" branch="true" condition-coverage="100% (2/2)"/>
|
||||
<line number="7" hits="11" branch="false"/>
|
||||
<line number="10" hits="3" branch="true" condition-coverage="100% (2/2)"/>
|
||||
<line number="11" hits="2" branch="false"/>
|
||||
<line number="12" hits="2" branch="false"/>
|
||||
<line number="14" hits="3" branch="true" condition-coverage="100% (2/2)"/>
|
||||
<line number="15" hits="2" branch="false"/>
|
||||
<line number="16" hits="2" branch="false"/>
|
||||
<line number="18" hits="3" branch="true" condition-coverage="100% (2/2)"/>
|
||||
<line number="19" hits="2" branch="false"/>
|
||||
<line number="20" hits="2" branch="false"/>
|
||||
<line number="22" hits="3" branch="true" condition-coverage="100% (2/2)"/>
|
||||
<line number="23" hits="2" branch="false"/>
|
||||
<line number="24" hits="2" branch="false"/>
|
||||
<line number="27" hits="2" branch="false"/>
|
||||
<line number="28" hits="8" branch="true" condition-coverage="100% (2/2)"/>
|
||||
<line number="29" hits="8" branch="false"/>
|
||||
<line number="32" hits="2" branch="false"/>
|
||||
<line number="33" hits="8" branch="false"/>
|
||||
<line number="34" hits="8" branch="false"/>
|
||||
<line number="36" hits="2" branch="false"/>
|
||||
</lines>
|
||||
</class>
|
||||
</classes>
|
||||
</package>
|
||||
<package name="common.services.Lists" line-rate="1" branch-rate="1">
|
||||
<classes>
|
||||
<class name="PnPListsService.ts" filename="src\common\services\Lists\PnPListsService.ts" line-rate="1" branch-rate="1">
|
||||
<methods>
|
||||
<method name="(anonymous_12)" hits="2" signature="()V">
|
||||
<lines>
|
||||
<line number="4" hits="2"/>
|
||||
</lines>
|
||||
</method>
|
||||
<method name="PnPListsService" hits="6" signature="()V">
|
||||
<lines>
|
||||
<line number="7" hits="6"/>
|
||||
</lines>
|
||||
</method>
|
||||
<method name="(anonymous_14)" hits="3" signature="()V">
|
||||
<lines>
|
||||
<line number="11" hits="3"/>
|
||||
</lines>
|
||||
</method>
|
||||
<method name="(anonymous_17)" hits="4" signature="()V">
|
||||
<lines>
|
||||
<line number="13" hits="4"/>
|
||||
</lines>
|
||||
</method>
|
||||
</methods>
|
||||
<lines>
|
||||
<line number="4" hits="2" branch="false"/>
|
||||
<line number="8" hits="6" branch="false"/>
|
||||
<line number="11" hits="2" branch="false"/>
|
||||
<line number="12" hits="3" branch="false"/>
|
||||
<line number="13" hits="3" branch="false"/>
|
||||
<line number="14" hits="4" branch="false"/>
|
||||
<line number="19" hits="3" branch="false"/>
|
||||
<line number="21" hits="2" branch="false"/>
|
||||
</lines>
|
||||
</class>
|
||||
</classes>
|
||||
</package>
|
||||
<package name="webparts.iocTests" line-rate="1" branch-rate="1">
|
||||
<classes>
|
||||
<class name="IoCTestsWebPartPropsDependencyResolver.ts" filename="src\webparts\iocTests\IoCTestsWebPartPropsDependencyResolver.ts" line-rate="1" branch-rate="1">
|
||||
<methods>
|
||||
<method name="(anonymous_0)" hits="4" signature="()V">
|
||||
<lines>
|
||||
<line number="8" hits="4"/>
|
||||
</lines>
|
||||
</method>
|
||||
<method name="(anonymous_2)" hits="3" signature="()V">
|
||||
<lines>
|
||||
<line number="9" hits="3"/>
|
||||
</lines>
|
||||
</method>
|
||||
</methods>
|
||||
<lines>
|
||||
<line number="6" hits="1" branch="false"/>
|
||||
<line number="8" hits="1" branch="false"/>
|
||||
<line number="9" hits="1" branch="false"/>
|
||||
<line number="11" hits="3" branch="false"/>
|
||||
<line number="13" hits="3" branch="false"/>
|
||||
<line number="14" hits="3" branch="false"/>
|
||||
<line number="15" hits="3" branch="false"/>
|
||||
<line number="17" hits="3" branch="false"/>
|
||||
<line number="24" hits="3" branch="false"/>
|
||||
<line number="26" hits="1" branch="false"/>
|
||||
</lines>
|
||||
</class>
|
||||
</classes>
|
||||
</package>
|
||||
<package name="webparts.iocTests.components" line-rate="1" branch-rate="1">
|
||||
<classes>
|
||||
<class name="ListOfLists.tsx" filename="src\webparts\iocTests\components\ListOfLists.tsx" line-rate="1" branch-rate="1">
|
||||
<methods>
|
||||
<method name="(anonymous_17)" hits="1" signature="()V">
|
||||
<lines>
|
||||
<line number="19" hits="1"/>
|
||||
</lines>
|
||||
</method>
|
||||
<method name="ListOfLists" hits="7" signature="()V">
|
||||
<lines>
|
||||
<line number="22" hits="7"/>
|
||||
</lines>
|
||||
</method>
|
||||
<method name="(anonymous_19)" hits="13" signature="()V">
|
||||
<lines>
|
||||
<line number="30" hits="13"/>
|
||||
</lines>
|
||||
</method>
|
||||
<method name="(anonymous_22)" hits="20" signature="()V">
|
||||
<lines>
|
||||
<line number="51" hits="20"/>
|
||||
</lines>
|
||||
</method>
|
||||
<method name="(anonymous_23)" hits="13" signature="()V">
|
||||
<lines>
|
||||
<line number="63" hits="13"/>
|
||||
</lines>
|
||||
</method>
|
||||
</methods>
|
||||
<lines>
|
||||
<line number="1" hits="1" branch="false"/>
|
||||
<line number="2" hits="1" branch="false"/>
|
||||
<line number="4" hits="1" branch="false"/>
|
||||
<line number="19" hits="1" branch="false"/>
|
||||
<line number="20" hits="7" branch="false"/>
|
||||
<line number="23" hits="7" branch="true" condition-coverage="100% (2/2)"/>
|
||||
<line number="24" hits="7" branch="false"/>
|
||||
<line number="30" hits="1" branch="false"/>
|
||||
<line number="32" hits="13" branch="false"/>
|
||||
<line number="35" hits="13" branch="false"/>
|
||||
<line number="36" hits="13" branch="false"/>
|
||||
<line number="37" hits="8" branch="false"/>
|
||||
<line number="39" hits="5" branch="false"/>
|
||||
<line number="42" hits="5" branch="false"/>
|
||||
<line number="45" hits="13" branch="false"/>
|
||||
<line number="51" hits="1" branch="false"/>
|
||||
<line number="52" hits="20" branch="false"/>
|
||||
<line number="54" hits="20" branch="false"/>
|
||||
<line number="64" hits="13" branch="false"/>
|
||||
<line number="75" hits="1" branch="false"/>
|
||||
</lines>
|
||||
</class>
|
||||
</classes>
|
||||
</package>
|
||||
</packages>
|
||||
</coverage>
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,269 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for IocTests.tsx</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="prettify.css" />
|
||||
<link rel="stylesheet" href="base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="index.html">All files</a> IocTests.tsx
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">96% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>24/25</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>6/6</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>5/5</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">95% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>19/20</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
25
|
||||
26
|
||||
27
|
||||
28
|
||||
29
|
||||
30
|
||||
31
|
||||
32
|
||||
33
|
||||
34
|
||||
35
|
||||
36
|
||||
37
|
||||
38
|
||||
39
|
||||
40
|
||||
41
|
||||
42
|
||||
43
|
||||
44
|
||||
45
|
||||
46
|
||||
47
|
||||
48
|
||||
49
|
||||
50
|
||||
51
|
||||
52
|
||||
53
|
||||
54
|
||||
55
|
||||
56
|
||||
57
|
||||
58
|
||||
59
|
||||
60
|
||||
61
|
||||
62
|
||||
63
|
||||
64
|
||||
65
|
||||
66
|
||||
67
|
||||
68
|
||||
69</td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import * as React from 'react';
|
||||
import styles from './IocTests.module.scss';
|
||||
import IListsService, { IList } from '../../../common/services/Lists/IListsService';
|
||||
import ICacheProvider, { CacheTimeout } from '../../../common/providers/Cache/ICacheProvider';
|
||||
import ILogProvider from '../../../common/providers/Log/ILogProvider';
|
||||
|
||||
export interface IocTestsProps {
|
||||
cacheProvider: ICacheProvider;
|
||||
logProvider: ILogProvider;
|
||||
listsService: IListsService;
|
||||
}
|
||||
|
||||
export interface IocTestsState {
|
||||
lists: IList[];
|
||||
}
|
||||
|
||||
export default class IocTests extends React.Component<IocTestsProps, IocTestsState> {
|
||||
private className: string = "IocTests";
|
||||
|
||||
constructor(props: IocTestsProps) {
|
||||
super(props);
|
||||
this.state = {
|
||||
lists: null
|
||||
};
|
||||
}
|
||||
|
||||
public async componentDidMount(): Promise<void> {
|
||||
// LOG PROVIDER
|
||||
await this.props.logProvider.Debug(this.className, "componentDidMount", null);
|
||||
|
||||
// CACHE PROVIDER
|
||||
const cacheKey = "IocTestsGetLists";
|
||||
let lists: IList[] = await this.props.cacheProvider.Get(cacheKey);
|
||||
if (<span class="cstat-no" title="statement not covered" >!lists)</span> {
|
||||
// LISTS SERVICE
|
||||
lists = await this.props.listsService.GetLists();
|
||||
|
||||
// CACHE PROVIDER
|
||||
await this.props.cacheProvider.Set(cacheKey, lists, CacheTimeout.default);
|
||||
}
|
||||
|
||||
this.setState({
|
||||
lists: lists
|
||||
});
|
||||
}
|
||||
|
||||
public render(): React.ReactElement<IocTestsProps> {
|
||||
this.props.logProvider.Debug(this.className, "render", null);
|
||||
|
||||
return (
|
||||
<div id={ styles.iocTests } className={ styles.iocTests }>
|
||||
<div className={ styles.container }>
|
||||
{ !this.state.lists &&
|
||||
<span> Loading... </span>
|
||||
}
|
||||
{ !!this.state.lists && this.state.lists.map(l => {
|
||||
return (
|
||||
<div key={l.Title}>
|
||||
<a href={l.DefaultViewUrl} target={"_blank"}>{l.Title}</a>
|
||||
</div>
|
||||
);
|
||||
})
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Fri Mar 01 2019 14:46:10 GMT+1100 (AUS Eastern Summer Time)
|
||||
</div>
|
||||
</div>
|
||||
<script src="prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="sorter.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,212 @@
|
|||
body, html {
|
||||
margin:0; padding: 0;
|
||||
height: 100%;
|
||||
}
|
||||
body {
|
||||
font-family: Helvetica Neue, Helvetica, Arial;
|
||||
font-size: 14px;
|
||||
color:#333;
|
||||
}
|
||||
.small { font-size: 12px; }
|
||||
*, *:after, *:before {
|
||||
-webkit-box-sizing:border-box;
|
||||
-moz-box-sizing:border-box;
|
||||
box-sizing:border-box;
|
||||
}
|
||||
h1 { font-size: 20px; margin: 0;}
|
||||
h2 { font-size: 14px; }
|
||||
pre {
|
||||
font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
-moz-tab-size: 2;
|
||||
-o-tab-size: 2;
|
||||
tab-size: 2;
|
||||
}
|
||||
a { color:#0074D9; text-decoration:none; }
|
||||
a:hover { text-decoration:underline; }
|
||||
.strong { font-weight: bold; }
|
||||
.space-top1 { padding: 10px 0 0 0; }
|
||||
.pad2y { padding: 20px 0; }
|
||||
.pad1y { padding: 10px 0; }
|
||||
.pad2x { padding: 0 20px; }
|
||||
.pad2 { padding: 20px; }
|
||||
.pad1 { padding: 10px; }
|
||||
.space-left2 { padding-left:55px; }
|
||||
.space-right2 { padding-right:20px; }
|
||||
.center { text-align:center; }
|
||||
.clearfix { display:block; }
|
||||
.clearfix:after {
|
||||
content:'';
|
||||
display:block;
|
||||
height:0;
|
||||
clear:both;
|
||||
visibility:hidden;
|
||||
}
|
||||
.fl { float: left; }
|
||||
@media only screen and (max-width:640px) {
|
||||
.col3 { width:100%; max-width:100%; }
|
||||
.hide-mobile { display:none!important; }
|
||||
}
|
||||
|
||||
.quiet {
|
||||
color: #7f7f7f;
|
||||
color: rgba(0,0,0,0.5);
|
||||
}
|
||||
.quiet a { opacity: 0.7; }
|
||||
|
||||
.fraction {
|
||||
font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
|
||||
font-size: 10px;
|
||||
color: #555;
|
||||
background: #E8E8E8;
|
||||
padding: 4px 5px;
|
||||
border-radius: 3px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
div.path a:link, div.path a:visited { color: #333; }
|
||||
table.coverage {
|
||||
border-collapse: collapse;
|
||||
margin: 10px 0 0 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
table.coverage td {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
vertical-align: top;
|
||||
}
|
||||
table.coverage td.line-count {
|
||||
text-align: right;
|
||||
padding: 0 5px 0 20px;
|
||||
}
|
||||
table.coverage td.line-coverage {
|
||||
text-align: right;
|
||||
padding-right: 10px;
|
||||
min-width:20px;
|
||||
}
|
||||
|
||||
table.coverage td span.cline-any {
|
||||
display: inline-block;
|
||||
padding: 0 5px;
|
||||
width: 100%;
|
||||
}
|
||||
.missing-if-branch {
|
||||
display: inline-block;
|
||||
margin-right: 5px;
|
||||
border-radius: 3px;
|
||||
position: relative;
|
||||
padding: 0 4px;
|
||||
background: #333;
|
||||
color: yellow;
|
||||
}
|
||||
|
||||
.skip-if-branch {
|
||||
display: none;
|
||||
margin-right: 10px;
|
||||
position: relative;
|
||||
padding: 0 4px;
|
||||
background: #ccc;
|
||||
color: white;
|
||||
}
|
||||
.missing-if-branch .typ, .skip-if-branch .typ {
|
||||
color: inherit !important;
|
||||
}
|
||||
.coverage-summary {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
.coverage-summary tr { border-bottom: 1px solid #bbb; }
|
||||
.keyline-all { border: 1px solid #ddd; }
|
||||
.coverage-summary td, .coverage-summary th { padding: 10px; }
|
||||
.coverage-summary tbody { border: 1px solid #bbb; }
|
||||
.coverage-summary td { border-right: 1px solid #bbb; }
|
||||
.coverage-summary td:last-child { border-right: none; }
|
||||
.coverage-summary th {
|
||||
text-align: left;
|
||||
font-weight: normal;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.coverage-summary th.file { border-right: none !important; }
|
||||
.coverage-summary th.pct { }
|
||||
.coverage-summary th.pic,
|
||||
.coverage-summary th.abs,
|
||||
.coverage-summary td.pct,
|
||||
.coverage-summary td.abs { text-align: right; }
|
||||
.coverage-summary td.file { white-space: nowrap; }
|
||||
.coverage-summary td.pic { min-width: 120px !important; }
|
||||
.coverage-summary tfoot td { }
|
||||
|
||||
.coverage-summary .sorter {
|
||||
height: 10px;
|
||||
width: 7px;
|
||||
display: inline-block;
|
||||
margin-left: 0.5em;
|
||||
background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent;
|
||||
}
|
||||
.coverage-summary .sorted .sorter {
|
||||
background-position: 0 -20px;
|
||||
}
|
||||
.coverage-summary .sorted-desc .sorter {
|
||||
background-position: 0 -10px;
|
||||
}
|
||||
.status-line { height: 10px; }
|
||||
/* dark red */
|
||||
.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 }
|
||||
.low .chart { border:1px solid #C21F39 }
|
||||
/* medium red */
|
||||
.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE }
|
||||
/* light red */
|
||||
.low, .cline-no { background:#FCE1E5 }
|
||||
/* light green */
|
||||
.high, .cline-yes { background:rgb(230,245,208) }
|
||||
/* medium green */
|
||||
.cstat-yes { background:rgb(161,215,106) }
|
||||
/* dark green */
|
||||
.status-line.high, .high .cover-fill { background:rgb(77,146,33) }
|
||||
.high .chart { border:1px solid rgb(77,146,33) }
|
||||
|
||||
|
||||
.medium .chart { border:1px solid #666; }
|
||||
.medium .cover-fill { background: #666; }
|
||||
|
||||
.cbranch-no { background: yellow !important; color: #111; }
|
||||
|
||||
.cstat-skip { background: #ddd; color: #111; }
|
||||
.fstat-skip { background: #ddd; color: #111 !important; }
|
||||
.cbranch-skip { background: #ddd !important; color: #111; }
|
||||
|
||||
span.cline-neutral { background: #eaeaea; }
|
||||
.medium { background: #eaeaea; }
|
||||
|
||||
.cover-fill, .cover-empty {
|
||||
display:inline-block;
|
||||
height: 12px;
|
||||
}
|
||||
.chart {
|
||||
line-height: 0;
|
||||
}
|
||||
.cover-empty {
|
||||
background: white;
|
||||
}
|
||||
.cover-full {
|
||||
border-right: none !important;
|
||||
}
|
||||
pre.prettyprint {
|
||||
border: none !important;
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
}
|
||||
.com { color: #999 !important; }
|
||||
.ignore-none { color: #999; font-weight: normal; }
|
||||
|
||||
.wrapper {
|
||||
min-height: 100%;
|
||||
height: auto !important;
|
||||
height: 100%;
|
||||
margin: 0 auto -48px;
|
||||
}
|
||||
.footer, .push {
|
||||
height: 48px;
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for common/providers/Cache/ICacheProvider.ts</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="..\..\..\prettify.css" />
|
||||
<link rel="stylesheet" href="..\..\..\base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(..\..\..\sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="..\..\..\index.html">All files</a> / <a href="index.html">common/providers/Cache</a> ICacheProvider.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>6/6</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>2/2</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>1/1</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>6/6</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14</td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">
|
||||
export enum CacheTimeout {
|
||||
oneSecond,
|
||||
short,
|
||||
default,
|
||||
long,
|
||||
verylong
|
||||
}
|
||||
|
||||
export default interface ICacheProvider {
|
||||
Get(key: string): Promise<any>;
|
||||
Set(key: string, valueObj: any, cacheTimeout: CacheTimeout): Promise<boolean>;
|
||||
Clear(key: string): Promise<void>;
|
||||
}</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Mar 20 2019 13:55:44 GMT+1100 (AUS Eastern Summer Time)
|
||||
</div>
|
||||
</div>
|
||||
<script src="..\..\..\prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="..\..\..\sorter.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,125 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for common/providers/Cache/MockCacheProvider.ts</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="..\..\..\prettify.css" />
|
||||
<link rel="stylesheet" href="..\..\..\base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(..\..\..\sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="..\..\..\index.html">All files</a> / <a href="index.html">common/providers/Cache</a> MockCacheProvider.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>10/10</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">80% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>4/5</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>10/10</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
20
|
||||
21</td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">9x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span></td><td class="text"><pre class="prettyprint lang-js">import ICacheProvider, { CacheTimeout } from "./ICacheProvider";
|
||||
|
||||
export default class MockCacheProvider implements ICacheProvider {
|
||||
private valueObj: any = null;
|
||||
|
||||
constructor(valueObj?: any) {
|
||||
this.valueObj = valueObj;
|
||||
}
|
||||
|
||||
public async Get(key: string): Promise<any> {
|
||||
return this.valueObj;
|
||||
}
|
||||
public async Set(key: string, valueObj: any, cacheTimeout: CacheTimeout): Promise<boolean> {
|
||||
this.valueObj = valueObj;
|
||||
return true;
|
||||
}
|
||||
<span class="fstat-no" title="function not covered" > public async Clear(</span>key: string): Promise<void> {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
}</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sat Mar 02 2019 17:14:03 GMT+1100 (AUS Eastern Summer Time)
|
||||
</div>
|
||||
</div>
|
||||
<script src="..\..\..\prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="..\..\..\sorter.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,146 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for common/providers/Cache/MockStorage.ts</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="..\..\..\prettify.css" />
|
||||
<link rel="stylesheet" href="..\..\..\base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(..\..\..\sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="..\..\..\index.html">All files</a> / <a href="index.html">common/providers/Cache</a> MockStorage.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">66.67% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>10/15</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">50% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>1/2</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">42.86% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>3/7</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">66.67% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>10/15</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='status-line medium'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
25
|
||||
26
|
||||
27
|
||||
28</td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span></td><td class="text"><pre class="prettyprint lang-js">export default class MockStorage implements Storage {
|
||||
constructor(storedKey?: string, storedItem?: any) {
|
||||
this.length = 0;
|
||||
<span class="missing-if-branch" title="if path not taken" >I</span>if (!!storedKey) {
|
||||
<span class="cstat-no" title="statement not covered" > this[storedKey] = storedItem;</span>
|
||||
<span class="cstat-no" title="statement not covered" > this.length = 1;</span>
|
||||
}
|
||||
}
|
||||
|
||||
[name: string]: any;
|
||||
length: number;
|
||||
|
||||
<span class="fstat-no" title="function not covered" > public clear(): void {</span>
|
||||
// do nothing
|
||||
}
|
||||
<span class="fstat-no" title="function not covered" > public getItem(</span>key: string): string {
|
||||
<span class="cstat-no" title="statement not covered" > return this[key];</span>
|
||||
}
|
||||
<span class="fstat-no" title="function not covered" > public key(</span>index: number): string {
|
||||
<span class="cstat-no" title="statement not covered" > return "";</span>
|
||||
}
|
||||
public removeItem(key: string): void {
|
||||
this[key] = undefined;
|
||||
}
|
||||
<span class="fstat-no" title="function not covered" > public setItem(</span>key: string, value: string): void {
|
||||
<span class="cstat-no" title="statement not covered" > this[key] = value;</span>
|
||||
}
|
||||
}</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sat Mar 02 2019 17:14:03 GMT+1100 (AUS Eastern Summer Time)
|
||||
</div>
|
||||
</div>
|
||||
<script src="..\..\..\prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="..\..\..\sorter.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,422 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for common/providers/Cache/StorageCacheProvider.ts</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="..\..\..\prettify.css" />
|
||||
<link rel="stylesheet" href="..\..\..\base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(..\..\..\sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="..\..\..\index.html">All files</a> / <a href="index.html">common/providers/Cache</a> StorageCacheProvider.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>75/75</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>42/42</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>10/10</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>74/74</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
25
|
||||
26
|
||||
27
|
||||
28
|
||||
29
|
||||
30
|
||||
31
|
||||
32
|
||||
33
|
||||
34
|
||||
35
|
||||
36
|
||||
37
|
||||
38
|
||||
39
|
||||
40
|
||||
41
|
||||
42
|
||||
43
|
||||
44
|
||||
45
|
||||
46
|
||||
47
|
||||
48
|
||||
49
|
||||
50
|
||||
51
|
||||
52
|
||||
53
|
||||
54
|
||||
55
|
||||
56
|
||||
57
|
||||
58
|
||||
59
|
||||
60
|
||||
61
|
||||
62
|
||||
63
|
||||
64
|
||||
65
|
||||
66
|
||||
67
|
||||
68
|
||||
69
|
||||
70
|
||||
71
|
||||
72
|
||||
73
|
||||
74
|
||||
75
|
||||
76
|
||||
77
|
||||
78
|
||||
79
|
||||
80
|
||||
81
|
||||
82
|
||||
83
|
||||
84
|
||||
85
|
||||
86
|
||||
87
|
||||
88
|
||||
89
|
||||
90
|
||||
91
|
||||
92
|
||||
93
|
||||
94
|
||||
95
|
||||
96
|
||||
97
|
||||
98
|
||||
99
|
||||
100
|
||||
101
|
||||
102
|
||||
103
|
||||
104
|
||||
105
|
||||
106
|
||||
107
|
||||
108
|
||||
109
|
||||
110
|
||||
111
|
||||
112
|
||||
113
|
||||
114
|
||||
115
|
||||
116
|
||||
117
|
||||
118
|
||||
119
|
||||
120</td><td class="line-coverage quiet"><span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">15x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">19x</span>
|
||||
<span class="cline-any cline-yes">15x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">22x</span>
|
||||
<span class="cline-any cline-yes">22x</span>
|
||||
<span class="cline-any cline-yes">22x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">20x</span>
|
||||
<span class="cline-any cline-yes">20x</span>
|
||||
<span class="cline-any cline-yes">20x</span>
|
||||
<span class="cline-any cline-yes">20x</span>
|
||||
<span class="cline-any cline-yes">20x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">22x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">11x</span>
|
||||
<span class="cline-any cline-yes">11x</span>
|
||||
<span class="cline-any cline-yes">11x</span>
|
||||
<span class="cline-any cline-yes">10x</span>
|
||||
<span class="cline-any cline-yes">8x</span>
|
||||
<span class="cline-any cline-yes">8x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">11x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">12x</span>
|
||||
<span class="cline-any cline-yes">11x</span>
|
||||
<span class="cline-any cline-yes">11x</span>
|
||||
<span class="cline-any cline-yes">11x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">10x</span>
|
||||
<span class="cline-any cline-yes">10x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">9x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">8x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">10x</span>
|
||||
<span class="cline-any cline-yes">10x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">10x</span>
|
||||
<span class="cline-any cline-yes">10x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">11x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">21x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">10x</span>
|
||||
<span class="cline-any cline-yes">10x</span>
|
||||
<span class="cline-any cline-yes">10x</span>
|
||||
<span class="cline-any cline-yes">9x</span>
|
||||
<span class="cline-any cline-yes">9x</span>
|
||||
<span class="cline-any cline-yes">8x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">10x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">23x</span>
|
||||
<span class="cline-any cline-yes">23x</span>
|
||||
<span class="cline-any cline-yes">21x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">23x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">10x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">10x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">10x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span></td><td class="text"><pre class="prettyprint lang-js">import ICacheProvider, { CacheTimeout } from "./ICacheProvider";
|
||||
|
||||
export default class StorageCacheProvider implements ICacheProvider {
|
||||
private cacheKeyPrefix: string = "__E2.";
|
||||
private storage: Storage;
|
||||
|
||||
constructor(storage: Storage = window.sessionStorage) {
|
||||
this.storage = storage;
|
||||
}
|
||||
|
||||
public IsSupportStorage(): boolean {
|
||||
let isSupportStorage: boolean = false;
|
||||
const supportsStorage: boolean = this.storage && JSON && typeof JSON.parse === "function" && typeof JSON.stringify === "function";
|
||||
if (supportsStorage) {
|
||||
// check for dodgy behaviour from iOS Safari in private browsing mode
|
||||
try {
|
||||
const testKey: string = "e2-cache-isSupportStorage-testKey";
|
||||
this.storage[testKey] = "1";
|
||||
this.storage.removeItem(testKey);
|
||||
isSupportStorage = true;
|
||||
} catch (ex) {
|
||||
// private browsing mode in iOS Safari, or possible full cache
|
||||
}
|
||||
}
|
||||
return isSupportStorage;
|
||||
}
|
||||
|
||||
public async Get(key: string): Promise<any> {
|
||||
key = this.ensureCacheKeyPrefix(key);
|
||||
let returnValue: any = undefined;
|
||||
if (this.IsSupportStorage()) {
|
||||
if (!this.isCacheExpired(key)) {
|
||||
returnValue = this.storage[key];
|
||||
if (typeof returnValue === "string" && (returnValue.indexOf("{") === 0 || returnValue.indexOf("[") === 0)) {
|
||||
returnValue = JSON.parse(returnValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public async Set(key: string, valueObj: any, cacheTimeout: CacheTimeout = CacheTimeout.default): Promise<boolean> {
|
||||
key = this.ensureCacheKeyPrefix(key);
|
||||
let didSetInCache: boolean = false;
|
||||
if (this.IsSupportStorage()) {
|
||||
// get value as a string
|
||||
let cacheValue: any = undefined;
|
||||
if (valueObj === null || valueObj === undefined) {
|
||||
cacheValue = valueObj;
|
||||
} else if (typeof valueObj === "object") {
|
||||
cacheValue = JSON.stringify(valueObj);
|
||||
} else {
|
||||
cacheValue = `${valueObj}`;
|
||||
}
|
||||
|
||||
// cache value
|
||||
this.storage[key] = cacheValue;
|
||||
const validityPeriodMs: number = this.getCacheTimeout(cacheTimeout);
|
||||
// cache expiry
|
||||
this.storage[this.getExpiryKey(key)] = ((new Date()).getTime() + validityPeriodMs).toString();
|
||||
didSetInCache = true;
|
||||
}
|
||||
return didSetInCache;
|
||||
}
|
||||
|
||||
public async Clear(key: string): Promise<void> {
|
||||
key = this.ensureCacheKeyPrefix(key);
|
||||
this.storage.removeItem(key);
|
||||
this.storage.removeItem(this.getExpiryKey(key));
|
||||
}
|
||||
|
||||
private getExpiryKey(key: string): string {
|
||||
return key + "_expiry";
|
||||
}
|
||||
|
||||
private isCacheExpired(key: string): boolean {
|
||||
let isCacheExpired: boolean = true;
|
||||
const cacheExpiryString: string = this.storage[this.getExpiryKey(key)];
|
||||
if (typeof cacheExpiryString === "string" && cacheExpiryString.length > 0) {
|
||||
const cacheExpiryInt: number = parseInt(cacheExpiryString, 10);
|
||||
if (cacheExpiryInt > (new Date()).getTime()) {
|
||||
isCacheExpired = false;
|
||||
}
|
||||
}
|
||||
return isCacheExpired;
|
||||
}
|
||||
|
||||
private ensureCacheKeyPrefix(key: string): string {
|
||||
let prefixedKey: string = "";
|
||||
if (!key || key.indexOf(this.cacheKeyPrefix) !== 0) {
|
||||
prefixedKey = `${this.cacheKeyPrefix}${key}`;
|
||||
} else {
|
||||
prefixedKey = key;
|
||||
}
|
||||
return prefixedKey;
|
||||
}
|
||||
|
||||
private getCacheTimeout(cacheTimeout: CacheTimeout): number {
|
||||
const oneMinute: number = 60000;
|
||||
let timeout: number;
|
||||
switch (cacheTimeout) {
|
||||
case CacheTimeout.oneSecond:
|
||||
timeout = 1000;
|
||||
break;
|
||||
case CacheTimeout.short:
|
||||
timeout = oneMinute;
|
||||
break;
|
||||
case CacheTimeout.long:
|
||||
timeout = oneMinute * 60; // 1 hour
|
||||
break;
|
||||
case CacheTimeout.verylong:
|
||||
timeout = oneMinute * 60 * 24; // 24 hours
|
||||
break;
|
||||
default:
|
||||
timeout = oneMinute * 10; // 10 minutes
|
||||
break;
|
||||
}
|
||||
return timeout;
|
||||
}
|
||||
}</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Mar 20 2019 13:55:44 GMT+1100 (AUS Eastern Summer Time)
|
||||
</div>
|
||||
</div>
|
||||
<script src="..\..\..\prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="..\..\..\sorter.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,106 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for common/providers/Cache</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="..\..\..\prettify.css" />
|
||||
<link rel="stylesheet" href="..\..\..\base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(..\..\..\sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="..\..\..\index.html">All files</a> common/providers/Cache
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>81/81</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>44/44</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>11/11</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>80/80</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<div class="pad1">
|
||||
<table class="coverage-summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
||||
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
||||
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
||||
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
||||
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
||||
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
||||
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr>
|
||||
<td class="file high" data-value="ICacheProvider.ts"><a href="ICacheProvider.ts.html">ICacheProvider.ts</a></td>
|
||||
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="6" class="abs high">6/6</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="2" class="abs high">2/2</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="1" class="abs high">1/1</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="6" class="abs high">6/6</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="StorageCacheProvider.ts"><a href="StorageCacheProvider.ts.html">StorageCacheProvider.ts</a></td>
|
||||
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="75" class="abs high">75/75</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="42" class="abs high">42/42</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="10" class="abs high">10/10</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="74" class="abs high">74/74</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div><div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Mar 20 2019 13:55:44 GMT+1100 (AUS Eastern Summer Time)
|
||||
</div>
|
||||
</div>
|
||||
<script src="..\..\..\prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="..\..\..\sorter.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,143 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for common/providers/DependencyResolver/DependencyResolver.ts</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="..\..\..\prettify.css" />
|
||||
<link rel="stylesheet" href="..\..\..\base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(..\..\..\sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="..\..\..\index.html">All files</a> / <a href="index.html">common/providers/DependencyResolver</a> DependencyResolver.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>12/12</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>4/4</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>12/12</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
25
|
||||
26
|
||||
27</td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span></td><td class="text"><pre class="prettyprint lang-js">import StorageCacheProvider from "../Cache/StorageCacheProvider";
|
||||
import ConsoleLogProvider from "../Log/ConsoleLogProvider";
|
||||
import PnPListsService from "../../services/Lists/PnPListsService";
|
||||
import PnPListsServiceExecutor from "../../services/Lists/executor/PnPListsServiceExecutor";
|
||||
import ICacheProvider from "../Cache/ICacheProvider";
|
||||
import ILogProvider from "../Log/ILogProvider";
|
||||
import IListsService from "../../services/Lists/IListsService";
|
||||
|
||||
export default class DependencyResolver { // implements IDependencyResolver
|
||||
// private useMockServices: boolean;
|
||||
|
||||
// constructor(useMockServices: boolean = false) {
|
||||
// this.useMockServices = useMockServices;
|
||||
// }
|
||||
|
||||
public ResolveICacheProvider(): ICacheProvider {
|
||||
return new StorageCacheProvider(window.sessionStorage);
|
||||
}
|
||||
|
||||
public ResolveILogProvider(): ILogProvider {
|
||||
return new ConsoleLogProvider();
|
||||
}
|
||||
|
||||
public ResolveIListsService(webUrl: string): IListsService {
|
||||
return new PnPListsService(new PnPListsServiceExecutor(webUrl));
|
||||
}
|
||||
}</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Mar 20 2019 13:55:44 GMT+1100 (AUS Eastern Summer Time)
|
||||
</div>
|
||||
</div>
|
||||
<script src="..\..\..\prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="..\..\..\sorter.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,93 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for common/providers/DependencyResolver</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="..\..\..\prettify.css" />
|
||||
<link rel="stylesheet" href="..\..\..\base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(..\..\..\sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="..\..\..\index.html">All files</a> common/providers/DependencyResolver
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>12/12</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>4/4</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>12/12</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<div class="pad1">
|
||||
<table class="coverage-summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
||||
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
||||
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
||||
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
||||
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
||||
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
||||
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr>
|
||||
<td class="file high" data-value="DependencyResolver.ts"><a href="DependencyResolver.ts.html">DependencyResolver.ts</a></td>
|
||||
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="12" class="abs high">12/12</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="0" class="abs high">0/0</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="4" class="abs high">4/4</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="12" class="abs high">12/12</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div><div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Mar 20 2019 13:55:44 GMT+1100 (AUS Eastern Summer Time)
|
||||
</div>
|
||||
</div>
|
||||
<script src="..\..\..\prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="..\..\..\sorter.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,170 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for common/providers/Log/ConsoleLogProvider.ts</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="..\..\..\prettify.css" />
|
||||
<link rel="stylesheet" href="..\..\..\base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(..\..\..\sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="..\..\..\index.html">All files</a> / <a href="index.html">common/providers/Log</a> ConsoleLogProvider.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>26/26</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>12/12</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>8/8</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>22/22</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
25
|
||||
26
|
||||
27
|
||||
28
|
||||
29
|
||||
30
|
||||
31
|
||||
32
|
||||
33
|
||||
34
|
||||
35
|
||||
36</td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">14x</span>
|
||||
<span class="cline-any cline-yes">11x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">8x</span>
|
||||
<span class="cline-any cline-yes">8x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">8x</span>
|
||||
<span class="cline-any cline-yes">8x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span></td><td class="text"><pre class="prettyprint lang-js">import ILogProvider from "./ILogProvider";
|
||||
import IConsole from "./IConsole";
|
||||
|
||||
export default class ConsoleLogProvider implements ILogProvider {
|
||||
private consolelog: IConsole;
|
||||
constructor(consolelog: IConsole = window.console) {
|
||||
this.consolelog = consolelog;
|
||||
}
|
||||
|
||||
public async Debug(className: string, message: string, json: any = undefined): Promise<void> {
|
||||
const jsonString: string = this.getJsonString(json);
|
||||
this.internalLog(this.consolelog.debug, className, message, jsonString);
|
||||
}
|
||||
public async Info(className: string, message: string, json: any = undefined): Promise<void> {
|
||||
const jsonString: string = this.getJsonString(json);
|
||||
this.internalLog(this.consolelog.info, className, message, jsonString);
|
||||
}
|
||||
public async Warning(className: string, message: string, json: any = undefined): Promise<void> {
|
||||
const jsonString: string = this.getJsonString(json);
|
||||
this.internalLog(this.consolelog.warn, className, message, jsonString);
|
||||
}
|
||||
public async Error(className: string, message: string, json: any = undefined): Promise<void> {
|
||||
const jsonString: string = this.getJsonString(json);
|
||||
this.internalLog(this.consolelog.error, className, message, jsonString);
|
||||
}
|
||||
|
||||
private getJsonString(json: any): string {
|
||||
const jsonString: string = !!json ? JSON.stringify(json) : "";
|
||||
return jsonString;
|
||||
}
|
||||
|
||||
private internalLog(log: (message:string) => void, className: string, message: string, jsonString: string): void {
|
||||
const logMessage: string = `${className}, ${message}, ${jsonString}`;
|
||||
log(logMessage);
|
||||
}
|
||||
}</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Mar 20 2019 13:55:44 GMT+1100 (AUS Eastern Summer Time)
|
||||
</div>
|
||||
</div>
|
||||
<script src="..\..\..\prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="..\..\..\sorter.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,113 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for common/providers/Log/MockLogProvider.ts</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="..\..\..\prettify.css" />
|
||||
<link rel="stylesheet" href="..\..\..\base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(..\..\..\sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="..\..\..\index.html">All files</a> / <a href="index.html">common/providers/Log</a> MockLogProvider.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>6/6</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">40% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>2/5</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>6/6</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17</td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span></td><td class="text"><pre class="prettyprint lang-js">import ILogProvider from "./ILogProvider";
|
||||
|
||||
export default class MockLogProvider implements ILogProvider {
|
||||
public async Debug(className: string, message: string, json: any): Promise<void> {
|
||||
// do nothing
|
||||
}
|
||||
<span class="fstat-no" title="function not covered" > public async Info(</span>className: string, message: string, json: any): Promise<void> {
|
||||
// do nothing
|
||||
}
|
||||
<span class="fstat-no" title="function not covered" > public async Warning(</span>className: string, message: string, json: any): Promise<void> {
|
||||
// do nothing
|
||||
}
|
||||
<span class="fstat-no" title="function not covered" > public async Error(</span>className: string, message: string, json: any): Promise<void> {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
}</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sat Mar 02 2019 17:14:03 GMT+1100 (AUS Eastern Summer Time)
|
||||
</div>
|
||||
</div>
|
||||
<script src="..\..\..\prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="..\..\..\sorter.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,93 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for common/providers/Log</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="..\..\..\prettify.css" />
|
||||
<link rel="stylesheet" href="..\..\..\base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(..\..\..\sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="..\..\..\index.html">All files</a> common/providers/Log
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>26/26</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>12/12</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>8/8</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>22/22</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<div class="pad1">
|
||||
<table class="coverage-summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
||||
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
||||
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
||||
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
||||
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
||||
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
||||
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr>
|
||||
<td class="file high" data-value="ConsoleLogProvider.ts"><a href="ConsoleLogProvider.ts.html">ConsoleLogProvider.ts</a></td>
|
||||
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="26" class="abs high">26/26</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="12" class="abs high">12/12</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="8" class="abs high">8/8</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="22" class="abs high">22/22</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div><div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Mar 20 2019 13:55:44 GMT+1100 (AUS Eastern Summer Time)
|
||||
</div>
|
||||
</div>
|
||||
<script src="..\..\..\prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="..\..\..\sorter.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,101 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for common/services/Lists/MockListsService.ts</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="..\..\..\prettify.css" />
|
||||
<link rel="stylesheet" href="..\..\..\base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(..\..\..\sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="..\..\..\index.html">All files</a> / <a href="index.html">common/services/Lists</a> MockListsService.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>6/6</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>3/3</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>6/6</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13</td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span></td><td class="text"><pre class="prettyprint lang-js">import IListsService, { IList } from "./IListsService";
|
||||
|
||||
export default class MockListsService implements IListsService {
|
||||
private lists: IList[] = [];
|
||||
|
||||
constructor(lists: IList[]) {
|
||||
this.lists = lists;
|
||||
}
|
||||
|
||||
public async GetLists(): Promise<IList[]> {
|
||||
return this.lists;
|
||||
}
|
||||
}</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sat Mar 02 2019 17:14:03 GMT+1100 (AUS Eastern Summer Time)
|
||||
</div>
|
||||
</div>
|
||||
<script src="..\..\..\prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="..\..\..\sorter.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,125 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for common/services/Lists/PnPListsService.ts</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="..\..\..\prettify.css" />
|
||||
<link rel="stylesheet" href="..\..\..\base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(..\..\..\sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="..\..\..\index.html">All files</a> / <a href="index.html">common/services/Lists</a> PnPListsService.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>9/9</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>4/4</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>8/8</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
20
|
||||
21</td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span></td><td class="text"><pre class="prettyprint lang-js">import IListsService, { IList } from "./IListsService";
|
||||
import IListsServiceExecutor from "./executor/IListsServiceExecutor";
|
||||
|
||||
export default class PnPListsService implements IListsService {
|
||||
private executor: IListsServiceExecutor;
|
||||
|
||||
constructor(executor: IListsServiceExecutor) {
|
||||
this.executor = executor;
|
||||
}
|
||||
|
||||
public async GetLists(): Promise<IList[]> {
|
||||
const listsData = await this.executor.Get();
|
||||
const lists = listsData.map(l => {
|
||||
return {
|
||||
Title: l.Title,
|
||||
DefaultViewUrl: l.DefaultViewUrl
|
||||
};
|
||||
});
|
||||
return lists;
|
||||
}
|
||||
}</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Mar 20 2019 13:55:44 GMT+1100 (AUS Eastern Summer Time)
|
||||
</div>
|
||||
</div>
|
||||
<script src="..\..\..\prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="..\..\..\sorter.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,93 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for common/services/Lists</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="..\..\..\prettify.css" />
|
||||
<link rel="stylesheet" href="..\..\..\base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(..\..\..\sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="..\..\..\index.html">All files</a> common/services/Lists
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>9/9</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>4/4</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>8/8</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<div class="pad1">
|
||||
<table class="coverage-summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
||||
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
||||
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
||||
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
||||
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
||||
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
||||
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr>
|
||||
<td class="file high" data-value="PnPListsService.ts"><a href="PnPListsService.ts.html">PnPListsService.ts</a></td>
|
||||
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="9" class="abs high">9/9</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="0" class="abs high">0/0</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="4" class="abs high">4/4</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="8" class="abs high">8/8</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div><div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Mar 20 2019 13:55:44 GMT+1100 (AUS Eastern Summer Time)
|
||||
</div>
|
||||
</div>
|
||||
<script src="..\..\..\prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="..\..\..\sorter.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,158 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for All files</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="prettify.css" />
|
||||
<link rel="stylesheet" href="base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
All files
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>163/163</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>62/62</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>34/34</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>152/152</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<div class="pad1">
|
||||
<table class="coverage-summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
||||
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
||||
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
||||
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
||||
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
||||
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
||||
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr>
|
||||
<td class="file high" data-value="common/providers/Cache"><a href="common\providers\Cache\index.html">common/providers/Cache</a></td>
|
||||
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="81" class="abs high">81/81</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="44" class="abs high">44/44</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="11" class="abs high">11/11</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="80" class="abs high">80/80</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="common/providers/DependencyResolver"><a href="common\providers\DependencyResolver\index.html">common/providers/DependencyResolver</a></td>
|
||||
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="12" class="abs high">12/12</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="0" class="abs high">0/0</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="4" class="abs high">4/4</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="12" class="abs high">12/12</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="common/providers/Log"><a href="common\providers\Log\index.html">common/providers/Log</a></td>
|
||||
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="26" class="abs high">26/26</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="12" class="abs high">12/12</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="8" class="abs high">8/8</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="22" class="abs high">22/22</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="common/services/Lists"><a href="common\services\Lists\index.html">common/services/Lists</a></td>
|
||||
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="9" class="abs high">9/9</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="0" class="abs high">0/0</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="4" class="abs high">4/4</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="8" class="abs high">8/8</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="webparts/iocTests"><a href="webparts\iocTests\index.html">webparts/iocTests</a></td>
|
||||
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="10" class="abs high">10/10</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="0" class="abs high">0/0</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="2" class="abs high">2/2</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="10" class="abs high">10/10</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="webparts/iocTests/components"><a href="webparts\iocTests\components\index.html">webparts/iocTests/components</a></td>
|
||||
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="25" class="abs high">25/25</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="6" class="abs high">6/6</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="5" class="abs high">5/5</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="20" class="abs high">20/20</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div><div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Mar 20 2019 13:55:44 GMT+1100 (AUS Eastern Summer Time)
|
||||
</div>
|
||||
</div>
|
||||
<script src="prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="sorter.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,317 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for iocTests/IocTestsWebPart.ts</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="..\prettify.css" />
|
||||
<link rel="stylesheet" href="..\base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(..\sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="..\index.html">All files</a> / <a href="index.html">iocTests</a> IocTestsWebPart.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>0/28</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/8</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>0/5</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>0/27</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='status-line low'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
25
|
||||
26
|
||||
27
|
||||
28
|
||||
29
|
||||
30
|
||||
31
|
||||
32
|
||||
33
|
||||
34
|
||||
35
|
||||
36
|
||||
37
|
||||
38
|
||||
39
|
||||
40
|
||||
41
|
||||
42
|
||||
43
|
||||
44
|
||||
45
|
||||
46
|
||||
47
|
||||
48
|
||||
49
|
||||
50
|
||||
51
|
||||
52
|
||||
53
|
||||
54
|
||||
55
|
||||
56
|
||||
57
|
||||
58
|
||||
59
|
||||
60
|
||||
61
|
||||
62
|
||||
63
|
||||
64
|
||||
65
|
||||
66
|
||||
67
|
||||
68
|
||||
69
|
||||
70
|
||||
71
|
||||
72
|
||||
73
|
||||
74
|
||||
75
|
||||
76
|
||||
77
|
||||
78
|
||||
79
|
||||
80
|
||||
81
|
||||
82
|
||||
83
|
||||
84
|
||||
85</td><td class="line-coverage quiet"><span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js"><span class="cstat-no" title="statement not covered" >import * as React from 'react';</span>
|
||||
<span class="cstat-no" title="statement not covered" >import * as ReactDom from 'react-dom';</span>
|
||||
<span class="cstat-no" title="statement not covered" >import { Version, Environment, EnvironmentType } from '@microsoft/sp-core-library';</span>
|
||||
<span class="cstat-no" title="statement not covered" >import {</span>
|
||||
BaseClientSideWebPart,
|
||||
IPropertyPaneConfiguration,
|
||||
PropertyPaneTextField
|
||||
} from '@microsoft/sp-webpart-base';
|
||||
|
||||
<span class="cstat-no" title="statement not covered" >import * as strings from 'IocTestsWebPartStrings';</span>
|
||||
<span class="cstat-no" title="statement not covered" >import IocTests, { IocTestsProps } from './components/IocTests';</span>
|
||||
<span class="cstat-no" title="statement not covered" >import PnPListsService from '../../common/services/Lists/PnPListsService';</span>
|
||||
import IListsService from '../../common/services/Lists/IListsService';
|
||||
<span class="cstat-no" title="statement not covered" >import MockListsService from '../../common/services/Lists/MockListsService';</span>
|
||||
import ICacheProvider from '../../common/providers/Cache/ICacheProvider';
|
||||
<span class="cstat-no" title="statement not covered" >import MockCacheProvider from '../../common/providers/Cache/MockCacheProvider';</span>
|
||||
<span class="cstat-no" title="statement not covered" >import StorageCacheProvider, { StorageType } from '../../common/providers/Cache/StorageCacheProvider';</span>
|
||||
import ILogProvider from '../../common/providers/Log/ILogProvider';
|
||||
<span class="cstat-no" title="statement not covered" >import MockLogProvider from '../../common/providers/Log/MockLogProvider';</span>
|
||||
<span class="cstat-no" title="statement not covered" >import ConsoleLogProvider from '../../common/providers/Log/ConsoleLogProvider';</span>
|
||||
|
||||
export interface IIocTestsWebPartProps {
|
||||
description: string;
|
||||
}
|
||||
|
||||
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >export default class IocTestsWebPart extends <span class="cstat-no" title="statement not covered" >BaseClientSideWebPart<IIocTestsWebPartProps> {</span></span></span>
|
||||
|
||||
<span class="fstat-no" title="function not covered" > public <span class="cstat-no" title="statement not covered" >render(): void {</span></span>
|
||||
const useMockServices = <span class="cstat-no" title="statement not covered" >Environment.type !== EnvironmentType.SharePoint && Environment.type !== EnvironmentType.ClassicSharePoint;</span>
|
||||
|
||||
const listsService: IListsService = <span class="cstat-no" title="statement not covered" >useMockServices </span>
|
||||
? new MockListsService([{ Title: "Mocked List", DefaultViewUrl: "https://bing.com" }])
|
||||
: new PnPListsService(this.context.pageContext.web.absoluteUrl);
|
||||
|
||||
const cacheProvider: ICacheProvider = <span class="cstat-no" title="statement not covered" >useMockServices </span>
|
||||
? new MockCacheProvider()
|
||||
: new StorageCacheProvider(StorageType.local);
|
||||
|
||||
const logProvider: ILogProvider = <span class="cstat-no" title="statement not covered" >useMockServices </span>
|
||||
? new MockLogProvider()
|
||||
: new ConsoleLogProvider(this.context);
|
||||
|
||||
const element: React.ReactElement<IocTestsProps> = <span class="cstat-no" title="statement not covered" >React.createElement(</span>
|
||||
IocTests,
|
||||
{
|
||||
listsService: listsService,
|
||||
cacheProvider: cacheProvider,
|
||||
logProvider: logProvider
|
||||
}
|
||||
);
|
||||
|
||||
<span class="cstat-no" title="statement not covered" > ReactDom.render(element, this.domElement);</span>
|
||||
}
|
||||
|
||||
<span class="fstat-no" title="function not covered" > protected <span class="cstat-no" title="statement not covered" >onDispose(): void {</span></span>
|
||||
<span class="cstat-no" title="statement not covered" > ReactDom.unmountComponentAtNode(this.domElement);</span>
|
||||
}
|
||||
|
||||
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" > protected get dataVersion(): Version {</span></span>
|
||||
<span class="cstat-no" title="statement not covered" > return Version.parse('1.0');</span>
|
||||
}
|
||||
|
||||
<span class="fstat-no" title="function not covered" > protected <span class="cstat-no" title="statement not covered" >getPropertyPaneConfiguration(): IPropertyPaneConfiguration {</span></span>
|
||||
<span class="cstat-no" title="statement not covered" > return {</span>
|
||||
pages: [
|
||||
{
|
||||
header: {
|
||||
description: strings.PropertyPaneDescription
|
||||
},
|
||||
groups: [
|
||||
{
|
||||
groupName: strings.BasicGroupName,
|
||||
groupFields: [
|
||||
PropertyPaneTextField('description', {
|
||||
label: strings.DescriptionFieldLabel
|
||||
})
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
<span class="cstat-no" title="statement not covered" >}</span>
|
||||
</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Fri Mar 01 2019 14:45:12 GMT+1100 (AUS Eastern Summer Time)
|
||||
</div>
|
||||
</div>
|
||||
<script src="..\prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="..\sorter.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,269 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for iocTests/components/IocTests.tsx</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="..\..\prettify.css" />
|
||||
<link rel="stylesheet" href="..\..\base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(..\..\sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="..\..\index.html">All files</a> / <a href="index.html">iocTests/components</a> IocTests.tsx
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">96% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>24/25</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>6/6</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>5/5</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">95% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>19/20</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
25
|
||||
26
|
||||
27
|
||||
28
|
||||
29
|
||||
30
|
||||
31
|
||||
32
|
||||
33
|
||||
34
|
||||
35
|
||||
36
|
||||
37
|
||||
38
|
||||
39
|
||||
40
|
||||
41
|
||||
42
|
||||
43
|
||||
44
|
||||
45
|
||||
46
|
||||
47
|
||||
48
|
||||
49
|
||||
50
|
||||
51
|
||||
52
|
||||
53
|
||||
54
|
||||
55
|
||||
56
|
||||
57
|
||||
58
|
||||
59
|
||||
60
|
||||
61
|
||||
62
|
||||
63
|
||||
64
|
||||
65
|
||||
66
|
||||
67
|
||||
68
|
||||
69</td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import * as React from 'react';
|
||||
import styles from './IocTests.module.scss';
|
||||
import IListsService, { IList } from '../../../common/services/Lists/IListsService';
|
||||
import ICacheProvider, { CacheTimeout } from '../../../common/providers/Cache/ICacheProvider';
|
||||
import ILogProvider from '../../../common/providers/Log/ILogProvider';
|
||||
|
||||
export interface IocTestsProps {
|
||||
cacheProvider: ICacheProvider;
|
||||
logProvider: ILogProvider;
|
||||
listsService: IListsService;
|
||||
}
|
||||
|
||||
export interface IocTestsState {
|
||||
lists: IList[];
|
||||
}
|
||||
|
||||
export default class IocTests extends React.Component<IocTestsProps, IocTestsState> {
|
||||
private className: string = "IocTests";
|
||||
|
||||
constructor(props: IocTestsProps) {
|
||||
super(props);
|
||||
this.state = {
|
||||
lists: null
|
||||
};
|
||||
}
|
||||
|
||||
public async componentDidMount(): Promise<void> {
|
||||
// LOG PROVIDER
|
||||
await this.props.logProvider.Debug(this.className, "componentDidMount", null);
|
||||
|
||||
// CACHE PROVIDER
|
||||
const cacheKey = "IocTestsGetLists";
|
||||
let lists: IList[] = await this.props.cacheProvider.Get(cacheKey);
|
||||
if (<span class="cstat-no" title="statement not covered" >!lists)</span> {
|
||||
// LISTS SERVICE
|
||||
lists = await this.props.listsService.GetLists();
|
||||
|
||||
// CACHE PROVIDER
|
||||
await this.props.cacheProvider.Set(cacheKey, lists, CacheTimeout.default);
|
||||
}
|
||||
|
||||
this.setState({
|
||||
lists: lists
|
||||
});
|
||||
}
|
||||
|
||||
public render(): React.ReactElement<IocTestsProps> {
|
||||
this.props.logProvider.Debug(this.className, "render", null);
|
||||
|
||||
return (
|
||||
<div id={ styles.iocTests } className={ styles.iocTests }>
|
||||
<div className={ styles.container }>
|
||||
{ !this.state.lists &&
|
||||
<span> Loading... </span>
|
||||
}
|
||||
{ !!this.state.lists && this.state.lists.map(l => {
|
||||
return (
|
||||
<div key={l.Title}>
|
||||
<a href={l.DefaultViewUrl} target={"_blank"}>{l.Title}</a>
|
||||
</div>
|
||||
);
|
||||
})
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Fri Mar 01 2019 14:45:12 GMT+1100 (AUS Eastern Summer Time)
|
||||
</div>
|
||||
</div>
|
||||
<script src="..\..\prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="..\..\sorter.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,93 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for iocTests/components</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="..\..\prettify.css" />
|
||||
<link rel="stylesheet" href="..\..\base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(..\..\sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="..\..\index.html">All files</a> iocTests/components
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">96% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>24/25</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>6/6</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>5/5</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">95% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>19/20</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<div class="pad1">
|
||||
<table class="coverage-summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
||||
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
||||
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
||||
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
||||
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
||||
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
||||
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr>
|
||||
<td class="file high" data-value="IocTests.tsx"><a href="IocTests.tsx.html">IocTests.tsx</a></td>
|
||||
<td data-value="96" class="pic high"><div class="chart"><div class="cover-fill" style="width: 96%;"></div><div class="cover-empty" style="width:4%;"></div></div></td>
|
||||
<td data-value="96" class="pct high">96%</td>
|
||||
<td data-value="25" class="abs high">24/25</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="6" class="abs high">6/6</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="5" class="abs high">5/5</td>
|
||||
<td data-value="95" class="pct high">95%</td>
|
||||
<td data-value="20" class="abs high">19/20</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div><div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Fri Mar 01 2019 14:45:12 GMT+1100 (AUS Eastern Summer Time)
|
||||
</div>
|
||||
</div>
|
||||
<script src="..\..\prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="..\..\sorter.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,93 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for iocTests</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="..\prettify.css" />
|
||||
<link rel="stylesheet" href="..\base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(..\sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="..\index.html">All files</a> iocTests
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>0/28</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/8</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>0/5</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>0/27</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='status-line low'></div>
|
||||
<div class="pad1">
|
||||
<table class="coverage-summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
||||
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
||||
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
||||
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
||||
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
||||
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
||||
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr>
|
||||
<td class="file low" data-value="IocTestsWebPart.ts"><a href="IocTestsWebPart.ts.html">IocTestsWebPart.ts</a></td>
|
||||
<td data-value="0" class="pic low"><div class="chart"><div class="cover-fill" style="width: 0%;"></div><div class="cover-empty" style="width:100%;"></div></div></td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="28" class="abs low">0/28</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="8" class="abs low">0/8</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="5" class="abs low">0/5</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="27" class="abs low">0/27</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div><div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Fri Mar 01 2019 14:45:12 GMT+1100 (AUS Eastern Summer Time)
|
||||
</div>
|
||||
</div>
|
||||
<script src="..\prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="..\sorter.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1 @@
|
|||
.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}
|
File diff suppressed because one or more lines are too long
Binary file not shown.
After Width: | Height: | Size: 209 B |
|
@ -0,0 +1,158 @@
|
|||
var addSorting = (function () {
|
||||
"use strict";
|
||||
var cols,
|
||||
currentSort = {
|
||||
index: 0,
|
||||
desc: false
|
||||
};
|
||||
|
||||
// returns the summary table element
|
||||
function getTable() { return document.querySelector('.coverage-summary'); }
|
||||
// returns the thead element of the summary table
|
||||
function getTableHeader() { return getTable().querySelector('thead tr'); }
|
||||
// returns the tbody element of the summary table
|
||||
function getTableBody() { return getTable().querySelector('tbody'); }
|
||||
// returns the th element for nth column
|
||||
function getNthColumn(n) { return getTableHeader().querySelectorAll('th')[n]; }
|
||||
|
||||
// loads all columns
|
||||
function loadColumns() {
|
||||
var colNodes = getTableHeader().querySelectorAll('th'),
|
||||
colNode,
|
||||
cols = [],
|
||||
col,
|
||||
i;
|
||||
|
||||
for (i = 0; i < colNodes.length; i += 1) {
|
||||
colNode = colNodes[i];
|
||||
col = {
|
||||
key: colNode.getAttribute('data-col'),
|
||||
sortable: !colNode.getAttribute('data-nosort'),
|
||||
type: colNode.getAttribute('data-type') || 'string'
|
||||
};
|
||||
cols.push(col);
|
||||
if (col.sortable) {
|
||||
col.defaultDescSort = col.type === 'number';
|
||||
colNode.innerHTML = colNode.innerHTML + '<span class="sorter"></span>';
|
||||
}
|
||||
}
|
||||
return cols;
|
||||
}
|
||||
// attaches a data attribute to every tr element with an object
|
||||
// of data values keyed by column name
|
||||
function loadRowData(tableRow) {
|
||||
var tableCols = tableRow.querySelectorAll('td'),
|
||||
colNode,
|
||||
col,
|
||||
data = {},
|
||||
i,
|
||||
val;
|
||||
for (i = 0; i < tableCols.length; i += 1) {
|
||||
colNode = tableCols[i];
|
||||
col = cols[i];
|
||||
val = colNode.getAttribute('data-value');
|
||||
if (col.type === 'number') {
|
||||
val = Number(val);
|
||||
}
|
||||
data[col.key] = val;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
// loads all row data
|
||||
function loadData() {
|
||||
var rows = getTableBody().querySelectorAll('tr'),
|
||||
i;
|
||||
|
||||
for (i = 0; i < rows.length; i += 1) {
|
||||
rows[i].data = loadRowData(rows[i]);
|
||||
}
|
||||
}
|
||||
// sorts the table using the data for the ith column
|
||||
function sortByIndex(index, desc) {
|
||||
var key = cols[index].key,
|
||||
sorter = function (a, b) {
|
||||
a = a.data[key];
|
||||
b = b.data[key];
|
||||
return a < b ? -1 : a > b ? 1 : 0;
|
||||
},
|
||||
finalSorter = sorter,
|
||||
tableBody = document.querySelector('.coverage-summary tbody'),
|
||||
rowNodes = tableBody.querySelectorAll('tr'),
|
||||
rows = [],
|
||||
i;
|
||||
|
||||
if (desc) {
|
||||
finalSorter = function (a, b) {
|
||||
return -1 * sorter(a, b);
|
||||
};
|
||||
}
|
||||
|
||||
for (i = 0; i < rowNodes.length; i += 1) {
|
||||
rows.push(rowNodes[i]);
|
||||
tableBody.removeChild(rowNodes[i]);
|
||||
}
|
||||
|
||||
rows.sort(finalSorter);
|
||||
|
||||
for (i = 0; i < rows.length; i += 1) {
|
||||
tableBody.appendChild(rows[i]);
|
||||
}
|
||||
}
|
||||
// removes sort indicators for current column being sorted
|
||||
function removeSortIndicators() {
|
||||
var col = getNthColumn(currentSort.index),
|
||||
cls = col.className;
|
||||
|
||||
cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, '');
|
||||
col.className = cls;
|
||||
}
|
||||
// adds sort indicators for current column being sorted
|
||||
function addSortIndicators() {
|
||||
getNthColumn(currentSort.index).className += currentSort.desc ? ' sorted-desc' : ' sorted';
|
||||
}
|
||||
// adds event listeners for all sorter widgets
|
||||
function enableUI() {
|
||||
var i,
|
||||
el,
|
||||
ithSorter = function ithSorter(i) {
|
||||
var col = cols[i];
|
||||
|
||||
return function () {
|
||||
var desc = col.defaultDescSort;
|
||||
|
||||
if (currentSort.index === i) {
|
||||
desc = !currentSort.desc;
|
||||
}
|
||||
sortByIndex(i, desc);
|
||||
removeSortIndicators();
|
||||
currentSort.index = i;
|
||||
currentSort.desc = desc;
|
||||
addSortIndicators();
|
||||
};
|
||||
};
|
||||
for (i =0 ; i < cols.length; i += 1) {
|
||||
if (cols[i].sortable) {
|
||||
// add the click event handler on the th so users
|
||||
// dont have to click on those tiny arrows
|
||||
el = getNthColumn(i).querySelector('.sorter').parentElement;
|
||||
if (el.addEventListener) {
|
||||
el.addEventListener('click', ithSorter(i));
|
||||
} else {
|
||||
el.attachEvent('onclick', ithSorter(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// adds sorting functionality to the UI
|
||||
return function () {
|
||||
if (!getTable()) {
|
||||
return;
|
||||
}
|
||||
cols = loadColumns();
|
||||
loadData(cols);
|
||||
addSortIndicators();
|
||||
enableUI();
|
||||
};
|
||||
})();
|
||||
|
||||
window.addEventListener('load', addSorting);
|
|
@ -0,0 +1,140 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for webparts/iocTests/IoCTestsWebPartPropsDependencyResolver.ts</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="..\..\prettify.css" />
|
||||
<link rel="stylesheet" href="..\..\base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(..\..\sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="..\..\index.html">All files</a> / <a href="index.html">webparts/iocTests</a> IoCTestsWebPartPropsDependencyResolver.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>10/10</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>2/2</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>10/10</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
25
|
||||
26</td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span></td><td class="text"><pre class="prettyprint lang-js">import { IIocTestsWebPartProps } from "./IocTestsWebPart";
|
||||
import { IListOfListsProps } from "./components/ListOfLists";
|
||||
import IListsService from "../../common/services/Lists/IListsService";
|
||||
import ICacheProvider from "../../common/providers/Cache/ICacheProvider";
|
||||
import ILogProvider from "../../common/providers/Log/ILogProvider";
|
||||
import DependencyResolver from "../../common/providers/DependencyResolver/DependencyResolver";
|
||||
|
||||
export default class IoCTestsWebPartPropsDependencyResolver {
|
||||
public resolve(properties: IIocTestsWebPartProps, webUrl: string): IListOfListsProps {
|
||||
|
||||
const resolver = new DependencyResolver();
|
||||
|
||||
const listsService: IListsService = resolver.ResolveIListsService(webUrl);
|
||||
const cacheProvider: ICacheProvider = resolver.ResolveICacheProvider();
|
||||
const logProvider: ILogProvider = resolver.ResolveILogProvider();
|
||||
|
||||
const props: IListOfListsProps = {
|
||||
description: properties.description,
|
||||
listsService: listsService,
|
||||
cacheProvider: cacheProvider,
|
||||
logProvider: logProvider
|
||||
};
|
||||
|
||||
return props;
|
||||
}
|
||||
}</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Mar 20 2019 13:55:44 GMT+1100 (AUS Eastern Summer Time)
|
||||
</div>
|
||||
</div>
|
||||
<script src="..\..\prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="..\..\sorter.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,173 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for webparts/iocTests/IoCTestsWebPartPropsTransformer.ts</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="..\..\prettify.css" />
|
||||
<link rel="stylesheet" href="..\..\base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(..\..\sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="..\..\index.html">All files</a> / <a href="index.html">webparts/iocTests</a> IoCTestsWebPartPropsTransformer.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>15/15</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>6/6</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>2/2</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>15/15</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
25
|
||||
26
|
||||
27
|
||||
28
|
||||
29
|
||||
30
|
||||
31
|
||||
32
|
||||
33
|
||||
34
|
||||
35
|
||||
36
|
||||
37</td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span></td><td class="text"><pre class="prettyprint lang-js">import { IIocTestsWebPartProps } from "./IocTestsWebPart";
|
||||
import { IocTestsProps } from "./components/IocTests";
|
||||
import IListsService from "../../common/services/Lists/IListsService";
|
||||
import MockListsService from "../../common/services/Lists/MockListsService";
|
||||
import PnPListsService from "../../common/services/Lists/PnPListsService";
|
||||
import PnPListsServiceExecutor from "../../common/services/Lists/executor/PnPListsServiceExecutor";
|
||||
import ICacheProvider from "../../common/providers/Cache/ICacheProvider";
|
||||
import MockCacheProvider from "../../common/providers/Cache/MockCacheProvider";
|
||||
import StorageCacheProvider from "../../common/providers/Cache/StorageCacheProvider";
|
||||
import ILogProvider from "../../common/providers/Log/ILogProvider";
|
||||
import MockLogProvider from "../../common/providers/Log/MockLogProvider";
|
||||
import ConsoleLogProvider from "../../common/providers/Log/ConsoleLogProvider";
|
||||
|
||||
export default class IoCTestsWebPartPropsTransformer {
|
||||
public transform(properties: IIocTestsWebPartProps, webUrl: string, useMockServices: boolean): IocTestsProps {
|
||||
const listsService: IListsService = useMockServices
|
||||
? new MockListsService([{ Title: "Mocked List", DefaultViewUrl: "https://bing.com" }])
|
||||
: new PnPListsService(new PnPListsServiceExecutor(webUrl));
|
||||
|
||||
const cacheProvider: ICacheProvider = useMockServices
|
||||
? new MockCacheProvider()
|
||||
: new StorageCacheProvider();
|
||||
|
||||
const logProvider: ILogProvider = useMockServices
|
||||
? new MockLogProvider()
|
||||
: new ConsoleLogProvider();
|
||||
|
||||
const props: IocTestsProps = {
|
||||
description: properties.description,
|
||||
listsService: listsService,
|
||||
cacheProvider: cacheProvider,
|
||||
logProvider: logProvider
|
||||
};
|
||||
|
||||
return props;
|
||||
}
|
||||
}</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Mar 03 2019 17:24:04 GMT+1100 (AUS Eastern Summer Time)
|
||||
</div>
|
||||
</div>
|
||||
<script src="..\..\prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="..\..\sorter.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,317 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for webparts/iocTests/IocTestsWebPart.ts</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="..\..\prettify.css" />
|
||||
<link rel="stylesheet" href="..\..\base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(..\..\sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="..\..\index.html">All files</a> / <a href="index.html">webparts/iocTests</a> IocTestsWebPart.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>0/28</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/8</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>0/5</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>0/27</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='status-line low'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
25
|
||||
26
|
||||
27
|
||||
28
|
||||
29
|
||||
30
|
||||
31
|
||||
32
|
||||
33
|
||||
34
|
||||
35
|
||||
36
|
||||
37
|
||||
38
|
||||
39
|
||||
40
|
||||
41
|
||||
42
|
||||
43
|
||||
44
|
||||
45
|
||||
46
|
||||
47
|
||||
48
|
||||
49
|
||||
50
|
||||
51
|
||||
52
|
||||
53
|
||||
54
|
||||
55
|
||||
56
|
||||
57
|
||||
58
|
||||
59
|
||||
60
|
||||
61
|
||||
62
|
||||
63
|
||||
64
|
||||
65
|
||||
66
|
||||
67
|
||||
68
|
||||
69
|
||||
70
|
||||
71
|
||||
72
|
||||
73
|
||||
74
|
||||
75
|
||||
76
|
||||
77
|
||||
78
|
||||
79
|
||||
80
|
||||
81
|
||||
82
|
||||
83
|
||||
84
|
||||
85</td><td class="line-coverage quiet"><span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js"><span class="cstat-no" title="statement not covered" >import * as React from 'react';</span>
|
||||
<span class="cstat-no" title="statement not covered" >import * as ReactDom from 'react-dom';</span>
|
||||
<span class="cstat-no" title="statement not covered" >import { Version, Environment, EnvironmentType } from '@microsoft/sp-core-library';</span>
|
||||
<span class="cstat-no" title="statement not covered" >import {</span>
|
||||
BaseClientSideWebPart,
|
||||
IPropertyPaneConfiguration,
|
||||
PropertyPaneTextField
|
||||
} from '@microsoft/sp-webpart-base';
|
||||
|
||||
<span class="cstat-no" title="statement not covered" >import * as strings from 'IocTestsWebPartStrings';</span>
|
||||
<span class="cstat-no" title="statement not covered" >import IocTests, { IocTestsProps } from './components/IocTests';</span>
|
||||
<span class="cstat-no" title="statement not covered" >import PnPListsService from '../../common/services/Lists/PnPListsService';</span>
|
||||
import IListsService from '../../common/services/Lists/IListsService';
|
||||
<span class="cstat-no" title="statement not covered" >import MockListsService from '../../common/services/Lists/MockListsService';</span>
|
||||
import ICacheProvider from '../../common/providers/Cache/ICacheProvider';
|
||||
<span class="cstat-no" title="statement not covered" >import MockCacheProvider from '../../common/providers/Cache/MockCacheProvider';</span>
|
||||
<span class="cstat-no" title="statement not covered" >import StorageCacheProvider, { StorageType } from '../../common/providers/Cache/StorageCacheProvider';</span>
|
||||
import ILogProvider from '../../common/providers/Log/ILogProvider';
|
||||
<span class="cstat-no" title="statement not covered" >import MockLogProvider from '../../common/providers/Log/MockLogProvider';</span>
|
||||
<span class="cstat-no" title="statement not covered" >import ConsoleLogProvider from '../../common/providers/Log/ConsoleLogProvider';</span>
|
||||
|
||||
export interface IIocTestsWebPartProps {
|
||||
description: string;
|
||||
}
|
||||
|
||||
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >export default class IocTestsWebPart extends <span class="cstat-no" title="statement not covered" >BaseClientSideWebPart<IIocTestsWebPartProps> {</span></span></span>
|
||||
|
||||
<span class="fstat-no" title="function not covered" > public <span class="cstat-no" title="statement not covered" >render(): void {</span></span>
|
||||
const useMockServices = <span class="cstat-no" title="statement not covered" >Environment.type !== EnvironmentType.SharePoint && Environment.type !== EnvironmentType.ClassicSharePoint;</span>
|
||||
|
||||
const listsService: IListsService = <span class="cstat-no" title="statement not covered" >useMockServices </span>
|
||||
? new MockListsService([{ Title: "Mocked List", DefaultViewUrl: "https://bing.com" }])
|
||||
: new PnPListsService(this.context.pageContext.web.absoluteUrl);
|
||||
|
||||
const cacheProvider: ICacheProvider = <span class="cstat-no" title="statement not covered" >useMockServices </span>
|
||||
? new MockCacheProvider()
|
||||
: new StorageCacheProvider(StorageType.local);
|
||||
|
||||
const logProvider: ILogProvider = <span class="cstat-no" title="statement not covered" >useMockServices </span>
|
||||
? new MockLogProvider()
|
||||
: new ConsoleLogProvider(this.context);
|
||||
|
||||
const element: React.ReactElement<IocTestsProps> = <span class="cstat-no" title="statement not covered" >React.createElement(</span>
|
||||
IocTests,
|
||||
{
|
||||
listsService: listsService,
|
||||
cacheProvider: cacheProvider,
|
||||
logProvider: logProvider
|
||||
}
|
||||
);
|
||||
|
||||
<span class="cstat-no" title="statement not covered" > ReactDom.render(element, this.domElement);</span>
|
||||
}
|
||||
|
||||
<span class="fstat-no" title="function not covered" > protected <span class="cstat-no" title="statement not covered" >onDispose(): void {</span></span>
|
||||
<span class="cstat-no" title="statement not covered" > ReactDom.unmountComponentAtNode(this.domElement);</span>
|
||||
}
|
||||
|
||||
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" > protected get dataVersion(): Version {</span></span>
|
||||
<span class="cstat-no" title="statement not covered" > return Version.parse('1.0');</span>
|
||||
}
|
||||
|
||||
<span class="fstat-no" title="function not covered" > protected <span class="cstat-no" title="statement not covered" >getPropertyPaneConfiguration(): IPropertyPaneConfiguration {</span></span>
|
||||
<span class="cstat-no" title="statement not covered" > return {</span>
|
||||
pages: [
|
||||
{
|
||||
header: {
|
||||
description: strings.PropertyPaneDescription
|
||||
},
|
||||
groups: [
|
||||
{
|
||||
groupName: strings.BasicGroupName,
|
||||
groupFields: [
|
||||
PropertyPaneTextField('description', {
|
||||
label: strings.DescriptionFieldLabel
|
||||
})
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
<span class="cstat-no" title="statement not covered" >}</span>
|
||||
</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Fri Mar 01 2019 14:43:26 GMT+1100 (AUS Eastern Summer Time)
|
||||
</div>
|
||||
</div>
|
||||
<script src="..\..\prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="..\..\sorter.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,89 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for webparts/iocTests/components/IocTests.module.scss.ts</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="..\..\..\prettify.css" />
|
||||
<link rel="stylesheet" href="..\..\..\base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(..\..\..\sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="..\..\..\index.html">All files</a> / <a href="index.html">webparts/iocTests/components</a> IocTests.module.scss.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>0/3</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>0/3</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='status-line low'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9</td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/* tslint:disable */
|
||||
<span class="cstat-no" title="statement not covered" >require("./IocTests.module.css");</span>
|
||||
const styles = <span class="cstat-no" title="statement not covered" >{</span>
|
||||
iocTests: 'iocTests_886457bc',
|
||||
container: 'container_886457bc',
|
||||
};
|
||||
|
||||
<span class="cstat-no" title="statement not covered" >export default styles;</span>
|
||||
/* tslint:enable */</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sat Mar 02 2019 15:59:36 GMT+1100 (AUS Eastern Summer Time)
|
||||
</div>
|
||||
</div>
|
||||
<script src="..\..\..\prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="..\..\..\sorter.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,290 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for webparts/iocTests/components/IocTests.tsx</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="..\..\..\prettify.css" />
|
||||
<link rel="stylesheet" href="..\..\..\base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(..\..\..\sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="..\..\..\index.html">All files</a> / <a href="index.html">webparts/iocTests/components</a> IocTests.tsx
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>25/25</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>6/6</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>5/5</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>20/20</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
25
|
||||
26
|
||||
27
|
||||
28
|
||||
29
|
||||
30
|
||||
31
|
||||
32
|
||||
33
|
||||
34
|
||||
35
|
||||
36
|
||||
37
|
||||
38
|
||||
39
|
||||
40
|
||||
41
|
||||
42
|
||||
43
|
||||
44
|
||||
45
|
||||
46
|
||||
47
|
||||
48
|
||||
49
|
||||
50
|
||||
51
|
||||
52
|
||||
53
|
||||
54
|
||||
55
|
||||
56
|
||||
57
|
||||
58
|
||||
59
|
||||
60
|
||||
61
|
||||
62
|
||||
63
|
||||
64
|
||||
65
|
||||
66
|
||||
67
|
||||
68
|
||||
69
|
||||
70
|
||||
71
|
||||
72
|
||||
73
|
||||
74
|
||||
75
|
||||
76</td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">7x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">7x</span>
|
||||
<span class="cline-any cline-yes">7x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">13x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">13x</span>
|
||||
<span class="cline-any cline-yes">13x</span>
|
||||
<span class="cline-any cline-yes">8x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">13x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">20x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">20x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">13x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import * as React from 'react';
|
||||
import styles from './IocTests.module.scss';
|
||||
import IListsService, { IList } from '../../../common/services/Lists/IListsService';
|
||||
import ICacheProvider, { CacheTimeout } from '../../../common/providers/Cache/ICacheProvider';
|
||||
import ILogProvider from '../../../common/providers/Log/ILogProvider';
|
||||
|
||||
export interface IocTestsProps {
|
||||
description: string;
|
||||
cacheProvider: ICacheProvider;
|
||||
logProvider: ILogProvider;
|
||||
listsService: IListsService;
|
||||
}
|
||||
|
||||
export interface IocTestsState {
|
||||
lists: IList[];
|
||||
isLoading: boolean;
|
||||
}
|
||||
|
||||
export default class IocTests extends React.Component<IocTestsProps, IocTestsState> {
|
||||
private className: string = "IocTests";
|
||||
|
||||
constructor(props: IocTestsProps) {
|
||||
super(props);
|
||||
this.state = {
|
||||
lists: [],
|
||||
isLoading: true
|
||||
};
|
||||
}
|
||||
|
||||
public async componentDidMount(): Promise<void> {
|
||||
// LOG PROVIDER
|
||||
await this.props.logProvider.Debug(this.className, "componentDidMount", null);
|
||||
|
||||
// CACHE PROVIDER
|
||||
const cacheKey = "IocTestsGetLists";
|
||||
let lists: IList[] = await this.props.cacheProvider.Get(cacheKey);
|
||||
if (!lists) {
|
||||
// LISTS SERVICE
|
||||
lists = await this.props.listsService.GetLists();
|
||||
|
||||
// CACHE PROVIDER
|
||||
await this.props.cacheProvider.Set(cacheKey, lists, CacheTimeout.default);
|
||||
}
|
||||
|
||||
this.setState({
|
||||
lists: lists,
|
||||
isLoading: false
|
||||
});
|
||||
}
|
||||
|
||||
public render(): React.ReactElement<IocTestsProps> {
|
||||
this.props.logProvider.Debug(this.className, "render", null);
|
||||
|
||||
return (
|
||||
<div id={ styles.iocTests } className={ styles.iocTests }>
|
||||
<div className={ styles.container }>
|
||||
{ !!this.props.description &&
|
||||
<div>{this.props.description}</div>
|
||||
}
|
||||
{ !!this.state.isLoading &&
|
||||
<span> Loading... </span>
|
||||
}
|
||||
{ this.state.lists.map(l => {
|
||||
return (
|
||||
<div key={l.Title}>
|
||||
<a href={l.DefaultViewUrl} target={"_blank"}>{l.Title}</a>
|
||||
</div>
|
||||
);
|
||||
})
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Thu Mar 14 2019 12:20:31 GMT+1100 (AUS Eastern Summer Time)
|
||||
</div>
|
||||
</div>
|
||||
<script src="..\..\..\prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="..\..\..\sorter.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,290 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for webparts/iocTests/components/ListOfLists.tsx</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="..\..\..\prettify.css" />
|
||||
<link rel="stylesheet" href="..\..\..\base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(..\..\..\sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="..\..\..\index.html">All files</a> / <a href="index.html">webparts/iocTests/components</a> ListOfLists.tsx
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>25/25</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>6/6</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>5/5</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>20/20</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
25
|
||||
26
|
||||
27
|
||||
28
|
||||
29
|
||||
30
|
||||
31
|
||||
32
|
||||
33
|
||||
34
|
||||
35
|
||||
36
|
||||
37
|
||||
38
|
||||
39
|
||||
40
|
||||
41
|
||||
42
|
||||
43
|
||||
44
|
||||
45
|
||||
46
|
||||
47
|
||||
48
|
||||
49
|
||||
50
|
||||
51
|
||||
52
|
||||
53
|
||||
54
|
||||
55
|
||||
56
|
||||
57
|
||||
58
|
||||
59
|
||||
60
|
||||
61
|
||||
62
|
||||
63
|
||||
64
|
||||
65
|
||||
66
|
||||
67
|
||||
68
|
||||
69
|
||||
70
|
||||
71
|
||||
72
|
||||
73
|
||||
74
|
||||
75
|
||||
76</td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">7x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">7x</span>
|
||||
<span class="cline-any cline-yes">7x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">13x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">13x</span>
|
||||
<span class="cline-any cline-yes">13x</span>
|
||||
<span class="cline-any cline-yes">8x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">13x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">20x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">20x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">13x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import * as React from 'react';
|
||||
import styles from './ListOfLists.module.scss';
|
||||
import IListsService, { IList } from '../../../common/services/Lists/IListsService';
|
||||
import ICacheProvider, { CacheTimeout } from '../../../common/providers/Cache/ICacheProvider';
|
||||
import ILogProvider from '../../../common/providers/Log/ILogProvider';
|
||||
|
||||
export interface IListOfListsProps {
|
||||
description: string;
|
||||
cacheProvider: ICacheProvider;
|
||||
logProvider: ILogProvider;
|
||||
listsService: IListsService;
|
||||
}
|
||||
|
||||
export interface IListOfListsState {
|
||||
lists: IList[];
|
||||
isLoading: boolean;
|
||||
}
|
||||
|
||||
export default class ListOfLists extends React.Component<IListOfListsProps, IListOfListsState> {
|
||||
private className: string = "ListOfLists";
|
||||
|
||||
constructor(props: IListOfListsProps) {
|
||||
super(props);
|
||||
this.state = {
|
||||
lists: [],
|
||||
isLoading: true
|
||||
};
|
||||
}
|
||||
|
||||
public async componentDidMount(): Promise<void> {
|
||||
// LOG PROVIDER
|
||||
await this.props.logProvider.Debug(this.className, "componentDidMount", null);
|
||||
|
||||
// CACHE PROVIDER
|
||||
const cacheKey = "ListOfListsGetLists";
|
||||
let lists: IList[] = await this.props.cacheProvider.Get(cacheKey);
|
||||
if (!lists) {
|
||||
// LISTS SERVICE
|
||||
lists = await this.props.listsService.GetLists();
|
||||
|
||||
// CACHE PROVIDER
|
||||
await this.props.cacheProvider.Set(cacheKey, lists, CacheTimeout.default);
|
||||
}
|
||||
|
||||
this.setState({
|
||||
lists: lists,
|
||||
isLoading: false
|
||||
});
|
||||
}
|
||||
|
||||
public render(): React.ReactElement<IListOfListsProps> {
|
||||
this.props.logProvider.Debug(this.className, "render", null);
|
||||
|
||||
return (
|
||||
<div id={ styles.ListOfLists } className={ styles.ListOfLists }>
|
||||
<div className={ styles.container }>
|
||||
{ !!this.props.description &&
|
||||
<div>{this.props.description}</div>
|
||||
}
|
||||
{ !!this.state.isLoading &&
|
||||
<span> Loading... </span>
|
||||
}
|
||||
{ this.state.lists.map(l => {
|
||||
return (
|
||||
<div key={l.Title}>
|
||||
<a href={l.DefaultViewUrl} target={"_blank"}>{l.Title}</a>
|
||||
</div>
|
||||
);
|
||||
})
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Mar 20 2019 13:55:44 GMT+1100 (AUS Eastern Summer Time)
|
||||
</div>
|
||||
</div>
|
||||
<script src="..\..\..\prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="..\..\..\sorter.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,93 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for webparts/iocTests/components</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="..\..\..\prettify.css" />
|
||||
<link rel="stylesheet" href="..\..\..\base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(..\..\..\sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="..\..\..\index.html">All files</a> webparts/iocTests/components
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>25/25</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>6/6</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>5/5</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>20/20</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<div class="pad1">
|
||||
<table class="coverage-summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
||||
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
||||
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
||||
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
||||
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
||||
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
||||
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr>
|
||||
<td class="file high" data-value="ListOfLists.tsx"><a href="ListOfLists.tsx.html">ListOfLists.tsx</a></td>
|
||||
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="25" class="abs high">25/25</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="6" class="abs high">6/6</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="5" class="abs high">5/5</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="20" class="abs high">20/20</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div><div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Mar 20 2019 13:55:44 GMT+1100 (AUS Eastern Summer Time)
|
||||
</div>
|
||||
</div>
|
||||
<script src="..\..\..\prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="..\..\..\sorter.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,93 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for webparts/iocTests</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="..\..\prettify.css" />
|
||||
<link rel="stylesheet" href="..\..\base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(..\..\sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="..\..\index.html">All files</a> webparts/iocTests
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>10/10</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>2/2</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>10/10</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<div class="pad1">
|
||||
<table class="coverage-summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
||||
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
||||
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
||||
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
||||
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
||||
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
||||
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr>
|
||||
<td class="file high" data-value="IoCTestsWebPartPropsDependencyResolver.ts"><a href="IoCTestsWebPartPropsDependencyResolver.ts.html">IoCTestsWebPartPropsDependencyResolver.ts</a></td>
|
||||
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="10" class="abs high">10/10</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="0" class="abs high">0/0</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="2" class="abs high">2/2</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="10" class="abs high">10/10</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div><div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Mar 20 2019 13:55:44 GMT+1100 (AUS Eastern Summer Time)
|
||||
</div>
|
||||
</div>
|
||||
<script src="..\..\prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="..\..\sorter.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,345 @@
|
|||
TN:
|
||||
SF:C:\PWR\Repos\SPFxIoCTests\src\common\providers\Cache\ICacheProvider.ts
|
||||
FN:2,(anonymous_0)
|
||||
FNF:1
|
||||
FNH:1
|
||||
FNDA:3,(anonymous_0)
|
||||
DA:2,3
|
||||
DA:3,3
|
||||
DA:4,3
|
||||
DA:5,3
|
||||
DA:6,3
|
||||
DA:7,3
|
||||
LF:6
|
||||
LH:6
|
||||
BRDA:2,0,0,3
|
||||
BRDA:2,0,1,3
|
||||
BRF:2
|
||||
BRH:2
|
||||
end_of_record
|
||||
TN:
|
||||
SF:C:\PWR\Repos\SPFxIoCTests\src\common\providers\Cache\StorageCacheProvider.ts
|
||||
FN:3,(anonymous_12)
|
||||
FN:7,StorageCacheProvider
|
||||
FN:11,(anonymous_14)
|
||||
FN:28,(anonymous_15)
|
||||
FN:42,(anonymous_18)
|
||||
FN:66,(anonymous_21)
|
||||
FN:72,(anonymous_24)
|
||||
FN:76,(anonymous_25)
|
||||
FN:88,(anonymous_26)
|
||||
FN:98,(anonymous_27)
|
||||
FNF:10
|
||||
FNH:10
|
||||
FNDA:2,(anonymous_12)
|
||||
FNDA:15,StorageCacheProvider
|
||||
FNDA:22,(anonymous_14)
|
||||
FNDA:11,(anonymous_15)
|
||||
FNDA:11,(anonymous_18)
|
||||
FNDA:1,(anonymous_21)
|
||||
FNDA:21,(anonymous_24)
|
||||
FNDA:10,(anonymous_25)
|
||||
FNDA:23,(anonymous_26)
|
||||
FNDA:10,(anonymous_27)
|
||||
DA:1,2
|
||||
DA:3,2
|
||||
DA:4,15
|
||||
DA:7,19
|
||||
DA:8,15
|
||||
DA:11,2
|
||||
DA:12,22
|
||||
DA:13,22
|
||||
DA:14,22
|
||||
DA:16,20
|
||||
DA:17,20
|
||||
DA:18,20
|
||||
DA:19,20
|
||||
DA:20,20
|
||||
DA:25,22
|
||||
DA:28,2
|
||||
DA:29,11
|
||||
DA:30,11
|
||||
DA:31,11
|
||||
DA:32,10
|
||||
DA:33,8
|
||||
DA:34,8
|
||||
DA:35,1
|
||||
DA:39,11
|
||||
DA:42,12
|
||||
DA:43,11
|
||||
DA:44,11
|
||||
DA:45,11
|
||||
DA:47,10
|
||||
DA:48,10
|
||||
DA:49,1
|
||||
DA:50,9
|
||||
DA:51,1
|
||||
DA:53,8
|
||||
DA:57,10
|
||||
DA:58,10
|
||||
DA:60,10
|
||||
DA:61,10
|
||||
DA:63,11
|
||||
DA:66,2
|
||||
DA:67,1
|
||||
DA:68,1
|
||||
DA:69,1
|
||||
DA:72,2
|
||||
DA:73,21
|
||||
DA:76,2
|
||||
DA:77,10
|
||||
DA:78,10
|
||||
DA:79,10
|
||||
DA:80,9
|
||||
DA:81,9
|
||||
DA:82,8
|
||||
DA:85,10
|
||||
DA:88,2
|
||||
DA:89,23
|
||||
DA:90,23
|
||||
DA:91,21
|
||||
DA:93,2
|
||||
DA:95,23
|
||||
DA:98,2
|
||||
DA:99,10
|
||||
DA:101,10
|
||||
DA:103,1
|
||||
DA:104,1
|
||||
DA:106,1
|
||||
DA:107,1
|
||||
DA:109,1
|
||||
DA:110,1
|
||||
DA:112,1
|
||||
DA:113,1
|
||||
DA:115,6
|
||||
DA:116,6
|
||||
DA:118,10
|
||||
DA:120,2
|
||||
LF:74
|
||||
LH:74
|
||||
BRDA:7,0,0,4
|
||||
BRDA:7,0,1,11
|
||||
BRDA:13,1,0,22
|
||||
BRDA:13,1,1,20
|
||||
BRDA:13,1,2,20
|
||||
BRDA:13,1,3,20
|
||||
BRDA:14,2,0,20
|
||||
BRDA:14,2,1,2
|
||||
BRDA:31,3,0,10
|
||||
BRDA:31,3,1,1
|
||||
BRDA:32,4,0,8
|
||||
BRDA:32,4,1,2
|
||||
BRDA:34,5,0,1
|
||||
BRDA:34,5,1,7
|
||||
BRDA:34,6,0,8
|
||||
BRDA:34,6,1,7
|
||||
BRDA:34,6,2,6
|
||||
BRDA:42,7,0,1
|
||||
BRDA:42,7,1,10
|
||||
BRDA:45,8,0,10
|
||||
BRDA:45,8,1,1
|
||||
BRDA:48,9,0,1
|
||||
BRDA:48,9,1,9
|
||||
BRDA:48,10,0,10
|
||||
BRDA:48,10,1,9
|
||||
BRDA:50,11,0,1
|
||||
BRDA:50,11,1,8
|
||||
BRDA:79,12,0,9
|
||||
BRDA:79,12,1,1
|
||||
BRDA:79,13,0,10
|
||||
BRDA:79,13,1,9
|
||||
BRDA:81,14,0,8
|
||||
BRDA:81,14,1,1
|
||||
BRDA:90,15,0,21
|
||||
BRDA:90,15,1,2
|
||||
BRDA:90,16,0,23
|
||||
BRDA:90,16,1,23
|
||||
BRDA:102,17,0,1
|
||||
BRDA:102,17,1,1
|
||||
BRDA:102,17,2,1
|
||||
BRDA:102,17,3,1
|
||||
BRDA:102,17,4,6
|
||||
BRF:42
|
||||
BRH:42
|
||||
end_of_record
|
||||
TN:
|
||||
SF:C:\PWR\Repos\SPFxIoCTests\src\common\providers\DependencyResolver\DependencyResolver.ts
|
||||
FN:9,(anonymous_0)
|
||||
FN:16,(anonymous_2)
|
||||
FN:20,(anonymous_3)
|
||||
FN:24,(anonymous_4)
|
||||
FNF:4
|
||||
FNH:4
|
||||
FNDA:4,(anonymous_0)
|
||||
FNDA:3,(anonymous_2)
|
||||
FNDA:3,(anonymous_3)
|
||||
FNDA:3,(anonymous_4)
|
||||
DA:1,1
|
||||
DA:2,1
|
||||
DA:3,1
|
||||
DA:4,1
|
||||
DA:9,1
|
||||
DA:16,1
|
||||
DA:17,3
|
||||
DA:20,1
|
||||
DA:21,3
|
||||
DA:24,1
|
||||
DA:25,3
|
||||
DA:27,1
|
||||
LF:12
|
||||
LH:12
|
||||
BRF:0
|
||||
BRH:0
|
||||
end_of_record
|
||||
TN:
|
||||
SF:C:\PWR\Repos\SPFxIoCTests\src\common\providers\Log\ConsoleLogProvider.ts
|
||||
FN:4,(anonymous_12)
|
||||
FN:6,ConsoleLogProvider
|
||||
FN:10,(anonymous_14)
|
||||
FN:14,(anonymous_17)
|
||||
FN:18,(anonymous_20)
|
||||
FN:22,(anonymous_23)
|
||||
FN:27,(anonymous_26)
|
||||
FN:32,(anonymous_27)
|
||||
FNF:8
|
||||
FNH:8
|
||||
FNDA:2,(anonymous_12)
|
||||
FNDA:11,ConsoleLogProvider
|
||||
FNDA:2,(anonymous_14)
|
||||
FNDA:2,(anonymous_17)
|
||||
FNDA:2,(anonymous_20)
|
||||
FNDA:2,(anonymous_23)
|
||||
FNDA:8,(anonymous_26)
|
||||
FNDA:8,(anonymous_27)
|
||||
DA:4,2
|
||||
DA:6,14
|
||||
DA:7,11
|
||||
DA:10,3
|
||||
DA:11,2
|
||||
DA:12,2
|
||||
DA:14,3
|
||||
DA:15,2
|
||||
DA:16,2
|
||||
DA:18,3
|
||||
DA:19,2
|
||||
DA:20,2
|
||||
DA:22,3
|
||||
DA:23,2
|
||||
DA:24,2
|
||||
DA:27,2
|
||||
DA:28,8
|
||||
DA:29,8
|
||||
DA:32,2
|
||||
DA:33,8
|
||||
DA:34,8
|
||||
DA:36,2
|
||||
LF:22
|
||||
LH:22
|
||||
BRDA:6,0,0,3
|
||||
BRDA:6,0,1,8
|
||||
BRDA:10,1,0,1
|
||||
BRDA:10,1,1,1
|
||||
BRDA:14,2,0,1
|
||||
BRDA:14,2,1,1
|
||||
BRDA:18,3,0,1
|
||||
BRDA:18,3,1,1
|
||||
BRDA:22,4,0,1
|
||||
BRDA:22,4,1,1
|
||||
BRDA:28,5,0,4
|
||||
BRDA:28,5,1,4
|
||||
BRF:12
|
||||
BRH:12
|
||||
end_of_record
|
||||
TN:
|
||||
SF:C:\PWR\Repos\SPFxIoCTests\src\common\services\Lists\PnPListsService.ts
|
||||
FN:4,(anonymous_12)
|
||||
FN:7,PnPListsService
|
||||
FN:11,(anonymous_14)
|
||||
FN:13,(anonymous_17)
|
||||
FNF:4
|
||||
FNH:4
|
||||
FNDA:2,(anonymous_12)
|
||||
FNDA:6,PnPListsService
|
||||
FNDA:3,(anonymous_14)
|
||||
FNDA:4,(anonymous_17)
|
||||
DA:4,2
|
||||
DA:8,6
|
||||
DA:11,2
|
||||
DA:12,3
|
||||
DA:13,3
|
||||
DA:14,4
|
||||
DA:19,3
|
||||
DA:21,2
|
||||
LF:8
|
||||
LH:8
|
||||
BRF:0
|
||||
BRH:0
|
||||
end_of_record
|
||||
TN:
|
||||
SF:C:\PWR\Repos\SPFxIoCTests\src\webparts\iocTests\IoCTestsWebPartPropsDependencyResolver.ts
|
||||
FN:8,(anonymous_0)
|
||||
FN:9,(anonymous_2)
|
||||
FNF:2
|
||||
FNH:2
|
||||
FNDA:4,(anonymous_0)
|
||||
FNDA:3,(anonymous_2)
|
||||
DA:6,1
|
||||
DA:8,1
|
||||
DA:9,1
|
||||
DA:11,3
|
||||
DA:13,3
|
||||
DA:14,3
|
||||
DA:15,3
|
||||
DA:17,3
|
||||
DA:24,3
|
||||
DA:26,1
|
||||
LF:10
|
||||
LH:10
|
||||
BRF:0
|
||||
BRH:0
|
||||
end_of_record
|
||||
TN:
|
||||
SF:C:\PWR\Repos\SPFxIoCTests\src\webparts\iocTests\components\ListOfLists.tsx
|
||||
FN:19,(anonymous_17)
|
||||
FN:22,ListOfLists
|
||||
FN:30,(anonymous_19)
|
||||
FN:51,(anonymous_22)
|
||||
FN:63,(anonymous_23)
|
||||
FNF:5
|
||||
FNH:5
|
||||
FNDA:1,(anonymous_17)
|
||||
FNDA:7,ListOfLists
|
||||
FNDA:13,(anonymous_19)
|
||||
FNDA:20,(anonymous_22)
|
||||
FNDA:13,(anonymous_23)
|
||||
DA:1,1
|
||||
DA:2,1
|
||||
DA:4,1
|
||||
DA:19,1
|
||||
DA:20,7
|
||||
DA:23,7
|
||||
DA:24,7
|
||||
DA:30,1
|
||||
DA:32,13
|
||||
DA:35,13
|
||||
DA:36,13
|
||||
DA:37,8
|
||||
DA:39,5
|
||||
DA:42,5
|
||||
DA:45,13
|
||||
DA:51,1
|
||||
DA:52,20
|
||||
DA:54,20
|
||||
DA:64,13
|
||||
DA:75,1
|
||||
LF:20
|
||||
LH:20
|
||||
BRDA:23,0,0,7
|
||||
BRDA:23,0,1,7
|
||||
BRDA:57,1,0,20
|
||||
BRDA:57,1,1,15
|
||||
BRDA:60,2,0,20
|
||||
BRDA:60,2,1,7
|
||||
BRF:6
|
||||
BRH:6
|
||||
end_of_record
|
|
@ -0,0 +1,76 @@
|
|||
<testsuites name="jest tests" tests="32" failures="0" time="7.283">
|
||||
<testsuite name="Provider: ConsoleLogProvider" errors="0" failures="0" skipped="0" timestamp="2019-03-20T02:55:38" time="1.909" tests="8">
|
||||
<testcase classname="Provider: ConsoleLogProvider can log debug" name="Provider: ConsoleLogProvider can log debug" time="0.006">
|
||||
</testcase>
|
||||
<testcase classname="Provider: ConsoleLogProvider can log debug with json" name="Provider: ConsoleLogProvider can log debug with json" time="0.001">
|
||||
</testcase>
|
||||
<testcase classname="Provider: ConsoleLogProvider can log info" name="Provider: ConsoleLogProvider can log info" time="0.001">
|
||||
</testcase>
|
||||
<testcase classname="Provider: ConsoleLogProvider can log info with JSON" name="Provider: ConsoleLogProvider can log info with JSON" time="0.001">
|
||||
</testcase>
|
||||
<testcase classname="Provider: ConsoleLogProvider can log warn" name="Provider: ConsoleLogProvider can log warn" time="0.001">
|
||||
</testcase>
|
||||
<testcase classname="Provider: ConsoleLogProvider can log warn with json" name="Provider: ConsoleLogProvider can log warn with json" time="0">
|
||||
</testcase>
|
||||
<testcase classname="Provider: ConsoleLogProvider can log error" name="Provider: ConsoleLogProvider can log error" time="0.001">
|
||||
</testcase>
|
||||
<testcase classname="Provider: ConsoleLogProvider can log error with JSON" name="Provider: ConsoleLogProvider can log error with JSON" time="0">
|
||||
</testcase>
|
||||
</testsuite>
|
||||
<testsuite name="DependencyResolver: IoCTestsWebPartPropsDependencyResolver" errors="0" failures="0" skipped="0" timestamp="2019-03-20T02:55:38" time="1.999" tests="3">
|
||||
<testcase classname="DependencyResolver: IoCTestsWebPartPropsDependencyResolver should have valid props with mocked services" name="DependencyResolver: IoCTestsWebPartPropsDependencyResolver should have valid props with mocked services" time="0.005">
|
||||
</testcase>
|
||||
<testcase classname="DependencyResolver: IoCTestsWebPartPropsDependencyResolver should have valid props with real services" name="DependencyResolver: IoCTestsWebPartPropsDependencyResolver should have valid props with real services" time="0.001">
|
||||
</testcase>
|
||||
<testcase classname="DependencyResolver: IoCTestsWebPartPropsDependencyResolver should support empty property" name="DependencyResolver: IoCTestsWebPartPropsDependencyResolver should support empty property" time="0.001">
|
||||
</testcase>
|
||||
</testsuite>
|
||||
<testsuite name="Service: PnPListsService" errors="0" failures="0" skipped="0" timestamp="2019-03-20T02:55:38" time="2.016" tests="3">
|
||||
<testcase classname="Service: PnPListsService should get 1 list [Using explict class to mock]" name="Service: PnPListsService should get 1 list [Using explict class to mock]" time="0.005">
|
||||
</testcase>
|
||||
<testcase classname="Service: PnPListsService should get 1 list [Using Jest to mock]" name="Service: PnPListsService should get 1 list [Using Jest to mock]" time="0.001">
|
||||
</testcase>
|
||||
<testcase classname="Service: PnPListsService should get 2 lists" name="Service: PnPListsService should get 2 lists" time="0">
|
||||
</testcase>
|
||||
</testsuite>
|
||||
<testsuite name="Component: ListOfLists" errors="0" failures="0" skipped="0" timestamp="2019-03-20T02:55:38" time="2.76" tests="7">
|
||||
<testcase classname="Component: ListOfLists should render in loading state" name="Component: ListOfLists should render in loading state" time="0.011">
|
||||
</testcase>
|
||||
<testcase classname="Component: ListOfLists should render 1 item with no cache" name="Component: ListOfLists should render 1 item with no cache" time="0.003">
|
||||
</testcase>
|
||||
<testcase classname="Component: ListOfLists should render 2 items with no cache" name="Component: ListOfLists should render 2 items with no cache" time="0.001">
|
||||
</testcase>
|
||||
<testcase classname="Component: ListOfLists should render 1 item with primed cache" name="Component: ListOfLists should render 1 item with primed cache" time="0.001">
|
||||
</testcase>
|
||||
<testcase classname="Component: ListOfLists should render 1 item with primed cache" name="Component: ListOfLists should render 1 item with primed cache" time="0.001">
|
||||
</testcase>
|
||||
<testcase classname="Component: ListOfLists should render description" name="Component: ListOfLists should render description" time="0.001">
|
||||
</testcase>
|
||||
<testcase classname="Component: ListOfLists should not render empty description" name="Component: ListOfLists should not render empty description" time="0.001">
|
||||
</testcase>
|
||||
</testsuite>
|
||||
<testsuite name="Provider: StorageCacheProvider" errors="0" failures="0" skipped="0" timestamp="2019-03-20T02:55:38" time="3.019" tests="11">
|
||||
<testcase classname="Provider: StorageCacheProvider can set and get from storage with default timeout" name="Provider: StorageCacheProvider can set and get from storage with default timeout" time="0.009">
|
||||
</testcase>
|
||||
<testcase classname="Provider: StorageCacheProvider can set and get from storage with short timeout" name="Provider: StorageCacheProvider can set and get from storage with short timeout" time="0.001">
|
||||
</testcase>
|
||||
<testcase classname="Provider: StorageCacheProvider can set and get from storage with long timeout" name="Provider: StorageCacheProvider can set and get from storage with long timeout" time="0.001">
|
||||
</testcase>
|
||||
<testcase classname="Provider: StorageCacheProvider can set and get from storage with very long timeout" name="Provider: StorageCacheProvider can set and get from storage with very long timeout" time="0">
|
||||
</testcase>
|
||||
<testcase classname="Provider: StorageCacheProvider can set and get from storage with unspecified timeout" name="Provider: StorageCacheProvider can set and get from storage with unspecified timeout" time="0.001">
|
||||
</testcase>
|
||||
<testcase classname="Provider: StorageCacheProvider can set and clear from storage" name="Provider: StorageCacheProvider can set and clear from storage" time="0.001">
|
||||
</testcase>
|
||||
<testcase classname="Provider: StorageCacheProvider can set and get object from storage" name="Provider: StorageCacheProvider can set and get object from storage" time="0.001">
|
||||
</testcase>
|
||||
<testcase classname="Provider: StorageCacheProvider can set and get null from storage" name="Provider: StorageCacheProvider can set and get null from storage" time="0">
|
||||
</testcase>
|
||||
<testcase classname="Provider: StorageCacheProvider can support browsers that do not support storage" name="Provider: StorageCacheProvider can support browsers that do not support storage" time="0">
|
||||
</testcase>
|
||||
<testcase classname="Provider: StorageCacheProvider can set and get from storage using already prefixed key" name="Provider: StorageCacheProvider can set and get from storage using already prefixed key" time="0.001">
|
||||
</testcase>
|
||||
<testcase classname="Provider: StorageCacheProvider can expire entries" name="Provider: StorageCacheProvider can expire entries" time="1.003">
|
||||
</testcase>
|
||||
</testsuite>
|
||||
</testsuites>
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,108 @@
|
|||
{
|
||||
"name": "ioc-tests",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "gulp bundle",
|
||||
"clean": "gulp clean",
|
||||
"test": "jest"
|
||||
},
|
||||
"dependencies": {
|
||||
"@microsoft/sp-core-library": "1.8.0",
|
||||
"@microsoft/sp-lodash-subset": "1.8.0",
|
||||
"@microsoft/sp-office-ui-fabric-core": "1.8.0",
|
||||
"@microsoft/sp-webpart-base": "1.8.0",
|
||||
"@pnp/common": "^1.2.9",
|
||||
"@pnp/logging": "^1.2.9",
|
||||
"@pnp/odata": "^1.2.9",
|
||||
"@pnp/sp": "^1.2.9",
|
||||
"@types/es6-promise": "0.0.33",
|
||||
"@types/react": "16.7.22",
|
||||
"@types/react-dom": "16.0.5",
|
||||
"@types/webpack-env": "1.13.1",
|
||||
"enzyme-adapter-react-16.3": "^1.6.1",
|
||||
"react": "16.7.0",
|
||||
"react-dom": "16.7.0"
|
||||
},
|
||||
"resolutions": {
|
||||
"@types/react": "16.4.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@microsoft/rush-stack-compiler-2.7": "0.4.0",
|
||||
"@microsoft/rush-stack-compiler-3.3": "^0.1.7",
|
||||
"@microsoft/sp-build-web": "1.8.0",
|
||||
"@microsoft/sp-module-interfaces": "1.8.0",
|
||||
"@microsoft/sp-tslint-rules": "1.8.0",
|
||||
"@microsoft/sp-webpart-workbench": "1.8.0",
|
||||
"@types/chai": "3.4.34",
|
||||
"@types/enzyme": "^3.1.15",
|
||||
"@types/jest": "^22.2.3",
|
||||
"@types/mocha": "2.2.38",
|
||||
"ajv": "~5.2.2",
|
||||
"enzyme": "^3.8.0",
|
||||
"gulp": "~3.9.1",
|
||||
"identity-obj-proxy": "^3.0.0",
|
||||
"jest": "^22.4.3",
|
||||
"jest-junit": "^5.2.0",
|
||||
"react-test-renderer": "^16.6.3",
|
||||
"ts-jest": "^22.4.5",
|
||||
"typescript": "3.3.4000"
|
||||
},
|
||||
"jest": {
|
||||
"moduleFileExtensions": [
|
||||
"ts",
|
||||
"tsx",
|
||||
"js",
|
||||
"json"
|
||||
],
|
||||
"transform": {
|
||||
"^.+\\.(ts|tsx)$": "ts-jest"
|
||||
},
|
||||
"transformIgnorePatterns": [
|
||||
"node_modules/(?!(@microsoft/sp-core-library))"
|
||||
],
|
||||
"testMatch": [
|
||||
"**/src/**/*.test.+(ts|tsx|js)"
|
||||
],
|
||||
"collectCoverage": true,
|
||||
"coverageReporters": [
|
||||
"json",
|
||||
"lcov",
|
||||
"text",
|
||||
"cobertura"
|
||||
],
|
||||
"coverageDirectory": "<rootDir>/jest",
|
||||
"collectCoverageFrom": [
|
||||
"src/**/*.{ts,js,tsx}",
|
||||
"!src/**/*WebPart.{ts,js,tsx}",
|
||||
"!src/**/*ServiceExecutor.{ts,js,tsx}",
|
||||
"!src/**/Mock*.{ts,js,tsx}",
|
||||
"!src/**/*.scss.{ts,js}",
|
||||
"!**/loc/**"
|
||||
],
|
||||
"moduleNameMapper": {
|
||||
"\\.(css|less|scss|sass)$": "identity-obj-proxy"
|
||||
},
|
||||
"reporters": [
|
||||
"default",
|
||||
"jest-junit"
|
||||
],
|
||||
"moduleDirectories": [
|
||||
"node_modules"
|
||||
],
|
||||
"coverageThreshold": {
|
||||
"global": {
|
||||
"branches": 100,
|
||||
"functions": 100,
|
||||
"lines": 100,
|
||||
"statements": 100
|
||||
}
|
||||
}
|
||||
},
|
||||
"jest-junit": {
|
||||
"output": "./jest/summary-jest-junit.xml"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
resources:
|
||||
- repo: self
|
||||
queue:
|
||||
name: Hosted
|
||||
demands:
|
||||
- npm
|
||||
- node.js
|
||||
|
||||
steps:
|
||||
|
||||
- task: NodeTool@0
|
||||
displayName: 'Use Node 8.15.1'
|
||||
inputs:
|
||||
versionSpec: 8.15.1
|
||||
|
||||
|
||||
- task: Npm@1
|
||||
displayName: 'npm install'
|
||||
inputs:
|
||||
command: custom
|
||||
|
||||
verbose: false
|
||||
|
||||
customCommand: 'install'
|
||||
|
||||
- task: Npm@1
|
||||
displayName: 'npm test'
|
||||
inputs:
|
||||
command: custom
|
||||
|
||||
verbose: true
|
||||
|
||||
customCommand: 'test'
|
||||
|
||||
# Publish Test Results to Azure Pipelines/TFS
|
||||
- task: PublishTestResults@2
|
||||
inputs:
|
||||
testResultsFormat: 'JUnit'
|
||||
testResultsFiles: '**/summary-jest-junit.xml'
|
||||
searchFolder: '$(System.DefaultWorkingDirectory)'
|
||||
|
||||
|
||||
# Publish Cobertura or JaCoCo code coverage results from a build
|
||||
- task: PublishCodeCoverageResults@1
|
||||
inputs:
|
||||
codeCoverageTool: 'cobertura'
|
||||
summaryFileLocation: $(Build.SourcesDirectory)/jest/cobertura-coverage.xml
|
||||
reportDirectory: $(Build.SourcesDirectory)/jest/lcov-report/
|
||||
|
||||
- task: Gulp@0
|
||||
displayName: 'Run gulp clean'
|
||||
inputs:
|
||||
targets: 'clean'
|
||||
|
||||
|
||||
- task: Gulp@0
|
||||
displayName: 'Run gulp bundle'
|
||||
inputs:
|
||||
targets: bundle
|
||||
|
||||
arguments: '--ship'
|
||||
|
||||
|
||||
- task: Gulp@0
|
||||
displayName: 'Run gulp package-solution'
|
||||
inputs:
|
||||
targets: 'package-solution'
|
||||
|
||||
arguments: '--ship'
|
||||
|
||||
|
||||
- task: ArchiveFiles@2
|
||||
displayName: 'Archive SPFx Package file'
|
||||
inputs:
|
||||
rootFolderOrFile: '$(System.DefaultWorkingDirectory)/sharepoint/solution'
|
||||
|
||||
includeRootFolder: false
|
||||
|
||||
archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildNumber)-package.zip'
|
||||
|
||||
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: 'Publish artifacts: drop'
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
export enum CacheTimeout {
|
||||
oneSecond,
|
||||
short,
|
||||
default,
|
||||
long,
|
||||
verylong
|
||||
}
|
||||
|
||||
export default interface ICacheProvider {
|
||||
Get(key: string): Promise<any>;
|
||||
Set(key: string, valueObj: any, cacheTimeout: CacheTimeout): Promise<boolean>;
|
||||
Clear(key: string): Promise<void>;
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
import ICacheProvider, { CacheTimeout } from "./ICacheProvider";
|
||||
|
||||
export default class MockCacheProvider implements ICacheProvider {
|
||||
private valueObj: any = null;
|
||||
|
||||
constructor(valueObj?: any) {
|
||||
this.valueObj = valueObj;
|
||||
}
|
||||
|
||||
public async Get(key: string): Promise<any> {
|
||||
return this.valueObj;
|
||||
}
|
||||
public async Set(key: string, valueObj: any, cacheTimeout: CacheTimeout): Promise<boolean> {
|
||||
this.valueObj = valueObj;
|
||||
return true;
|
||||
}
|
||||
public async Clear(key: string): Promise<void> {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
export default class MockStorage implements Storage {
|
||||
constructor(storedKey?: string, storedItem?: any) {
|
||||
this.length = 0;
|
||||
if (!!storedKey) {
|
||||
this[storedKey] = storedItem;
|
||||
this.length = 1;
|
||||
}
|
||||
}
|
||||
|
||||
[name: string]: any;
|
||||
public length: number;
|
||||
|
||||
public clear(): void {
|
||||
// do nothign
|
||||
}
|
||||
public getItem(key: string): string {
|
||||
return this[key];
|
||||
}
|
||||
public key(index: number): string {
|
||||
return "";
|
||||
}
|
||||
public removeItem(key: string): void {
|
||||
this[key] = undefined;
|
||||
}
|
||||
public setItem(key: string, value: string): void {
|
||||
this[key] = value;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,153 @@
|
|||
/// <reference types="jest" />
|
||||
|
||||
import StorageCacheProvider from "./StorageCacheProvider";
|
||||
import MockStorage from "./MockStorage";
|
||||
import { CacheTimeout } from "./ICacheProvider";
|
||||
|
||||
describe('Provider: StorageCacheProvider', () => {
|
||||
|
||||
let cacheProvider: StorageCacheProvider;
|
||||
const key: string = "key";
|
||||
const stringVal: string = "value";
|
||||
|
||||
beforeEach(() => {
|
||||
cacheProvider = new StorageCacheProvider(new MockStorage());
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
// do nothing
|
||||
});
|
||||
|
||||
it('can set and get from storage with default timeout', async () => {
|
||||
// ARRANGE
|
||||
|
||||
// ACT
|
||||
cacheProvider.Set(key, stringVal, CacheTimeout.default);
|
||||
const cachedVal: string = await cacheProvider.Get(key);
|
||||
|
||||
// ASSERT
|
||||
expect(cachedVal).toEqual(stringVal);
|
||||
});
|
||||
|
||||
it('can set and get from storage with short timeout', async () => {
|
||||
// ARRANGE
|
||||
|
||||
// ACT
|
||||
cacheProvider.Set(key, stringVal, CacheTimeout.short);
|
||||
const cachedVal: string = await cacheProvider.Get(key);
|
||||
|
||||
// ASSERT
|
||||
expect(cachedVal).toEqual(stringVal);
|
||||
});
|
||||
|
||||
it('can set and get from storage with long timeout', async () => {
|
||||
// ARRANGE
|
||||
|
||||
// ACT
|
||||
cacheProvider.Set(key, stringVal, CacheTimeout.long);
|
||||
const cachedVal: string = await cacheProvider.Get(key);
|
||||
|
||||
// ASSERT
|
||||
expect(cachedVal).toEqual(stringVal);
|
||||
});
|
||||
|
||||
it('can set and get from storage with very long timeout', async () => {
|
||||
// ARRANGE
|
||||
|
||||
// ACT
|
||||
cacheProvider.Set(key, stringVal, CacheTimeout.verylong);
|
||||
const cachedVal: string = await cacheProvider.Get(key);
|
||||
|
||||
// ASSERT
|
||||
expect(cachedVal).toEqual(stringVal);
|
||||
});
|
||||
|
||||
it('can set and get from storage with unspecified timeout', async () => {
|
||||
// ARRANGE
|
||||
|
||||
// ACT
|
||||
cacheProvider.Set(key, stringVal);
|
||||
const cachedVal: string = await cacheProvider.Get(key);
|
||||
|
||||
// ASSERT
|
||||
expect(cachedVal).toEqual(stringVal);
|
||||
});
|
||||
|
||||
it('can set and clear from storage', async () => {
|
||||
// ARRANGE
|
||||
|
||||
// ACT
|
||||
cacheProvider.Set(key, stringVal, CacheTimeout.default);
|
||||
await cacheProvider.Clear(key);
|
||||
const cachedVal: string = await cacheProvider.Get(key);
|
||||
|
||||
// ASSERT
|
||||
expect(cachedVal).toBeUndefined();
|
||||
});
|
||||
|
||||
it('can set and get object from storage', async () => {
|
||||
// ARRANGE
|
||||
const val = {};
|
||||
|
||||
// ACT
|
||||
cacheProvider.Set(key, val, CacheTimeout.default);
|
||||
const cachedVal: string = await cacheProvider.Get(key);
|
||||
|
||||
// ASSERT
|
||||
expect(cachedVal).toEqual(val);
|
||||
});
|
||||
|
||||
it('can set and get null from storage', async () => {
|
||||
// ARRANGE
|
||||
const val = null;
|
||||
|
||||
// ACT
|
||||
cacheProvider.Set(key, val, CacheTimeout.default);
|
||||
const cachedVal: string = await cacheProvider.Get(key);
|
||||
|
||||
// ASSERT
|
||||
expect(cachedVal).toEqual(val);
|
||||
});
|
||||
|
||||
it('can support browsers that do not support storage', async () => {
|
||||
// ARRANGE
|
||||
const undefinedCacheProvider = new StorageCacheProvider(undefined);
|
||||
|
||||
// ACT
|
||||
undefinedCacheProvider.Set(key, stringVal, CacheTimeout.default);
|
||||
const cachedVal: string = await undefinedCacheProvider.Get(key);
|
||||
|
||||
// ASSERT
|
||||
expect(cachedVal).toBeUndefined();
|
||||
});
|
||||
|
||||
it('can set and get from storage using already prefixed key', async () => {
|
||||
// ARRANGE
|
||||
const prefixedKey = `__E2.${key}`;
|
||||
|
||||
// ACT
|
||||
cacheProvider.Set(prefixedKey, stringVal, CacheTimeout.default);
|
||||
const cachedVal: string = await cacheProvider.Get(prefixedKey);
|
||||
|
||||
// ASSERT
|
||||
expect(cachedVal).toEqual(stringVal);
|
||||
});
|
||||
|
||||
it('can expire entries', async () => {
|
||||
// ARRANGE
|
||||
const timeout = () => {
|
||||
return new Promise<void>(resolve => setTimeout(() => {
|
||||
resolve();
|
||||
}, 1001));
|
||||
};
|
||||
|
||||
// ACT
|
||||
cacheProvider.Set(key, stringVal, CacheTimeout.oneSecond);
|
||||
await timeout();
|
||||
const cachedVal: string = await cacheProvider.Get(key);
|
||||
|
||||
// ASSERT
|
||||
expect(cachedVal).toBeUndefined();
|
||||
});
|
||||
|
||||
});
|
|
@ -0,0 +1,120 @@
|
|||
import ICacheProvider, { CacheTimeout } from "./ICacheProvider";
|
||||
|
||||
export default class StorageCacheProvider implements ICacheProvider {
|
||||
private cacheKeyPrefix: string = "__E2.";
|
||||
private storage: Storage;
|
||||
|
||||
constructor(storage: Storage = window.sessionStorage) {
|
||||
this.storage = storage;
|
||||
}
|
||||
|
||||
public IsSupportStorage(): boolean {
|
||||
let isSupportStorage: boolean = false;
|
||||
const supportsStorage: boolean = this.storage && JSON && typeof JSON.parse === "function" && typeof JSON.stringify === "function";
|
||||
if (supportsStorage) {
|
||||
// check for dodgy behaviour from iOS Safari in private browsing mode
|
||||
try {
|
||||
const testKey: string = "e2-cache-isSupportStorage-testKey";
|
||||
this.storage[testKey] = "1";
|
||||
this.storage.removeItem(testKey);
|
||||
isSupportStorage = true;
|
||||
} catch (ex) {
|
||||
// private browsing mode in iOS Safari, or possible full cache
|
||||
}
|
||||
}
|
||||
return isSupportStorage;
|
||||
}
|
||||
|
||||
public async Get(key: string): Promise<any> {
|
||||
key = this.ensureCacheKeyPrefix(key);
|
||||
let returnValue: any = undefined;
|
||||
if (this.IsSupportStorage()) {
|
||||
if (!this.isCacheExpired(key)) {
|
||||
returnValue = this.storage[key];
|
||||
if (typeof returnValue === "string" && (returnValue.indexOf("{") === 0 || returnValue.indexOf("[") === 0)) {
|
||||
returnValue = JSON.parse(returnValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public async Set(key: string, valueObj: any, cacheTimeout: CacheTimeout = CacheTimeout.default): Promise<boolean> {
|
||||
key = this.ensureCacheKeyPrefix(key);
|
||||
let didSetInCache: boolean = false;
|
||||
if (this.IsSupportStorage()) {
|
||||
// get value as a string
|
||||
let cacheValue: any = undefined;
|
||||
if (valueObj === null || valueObj === undefined) {
|
||||
cacheValue = valueObj;
|
||||
} else if (typeof valueObj === "object") {
|
||||
cacheValue = JSON.stringify(valueObj);
|
||||
} else {
|
||||
cacheValue = `${valueObj}`;
|
||||
}
|
||||
|
||||
// cache value
|
||||
this.storage[key] = cacheValue;
|
||||
const validityPeriodMs: number = this.getCacheTimeout(cacheTimeout);
|
||||
// cache expiry
|
||||
this.storage[this.getExpiryKey(key)] = ((new Date()).getTime() + validityPeriodMs).toString();
|
||||
didSetInCache = true;
|
||||
}
|
||||
return didSetInCache;
|
||||
}
|
||||
|
||||
public async Clear(key: string): Promise<void> {
|
||||
key = this.ensureCacheKeyPrefix(key);
|
||||
this.storage.removeItem(key);
|
||||
this.storage.removeItem(this.getExpiryKey(key));
|
||||
}
|
||||
|
||||
private getExpiryKey(key: string): string {
|
||||
return key + "_expiry";
|
||||
}
|
||||
|
||||
private isCacheExpired(key: string): boolean {
|
||||
let isCacheExpired: boolean = true;
|
||||
const cacheExpiryString: string = this.storage[this.getExpiryKey(key)];
|
||||
if (typeof cacheExpiryString === "string" && cacheExpiryString.length > 0) {
|
||||
const cacheExpiryInt: number = parseInt(cacheExpiryString, 10);
|
||||
if (cacheExpiryInt > (new Date()).getTime()) {
|
||||
isCacheExpired = false;
|
||||
}
|
||||
}
|
||||
return isCacheExpired;
|
||||
}
|
||||
|
||||
private ensureCacheKeyPrefix(key: string): string {
|
||||
let prefixedKey: string = "";
|
||||
if (!key || key.indexOf(this.cacheKeyPrefix) !== 0) {
|
||||
prefixedKey = `${this.cacheKeyPrefix}${key}`;
|
||||
} else {
|
||||
prefixedKey = key;
|
||||
}
|
||||
return prefixedKey;
|
||||
}
|
||||
|
||||
private getCacheTimeout(cacheTimeout: CacheTimeout): number {
|
||||
const oneMinute: number = 60000;
|
||||
let timeout: number;
|
||||
switch (cacheTimeout) {
|
||||
case CacheTimeout.oneSecond:
|
||||
timeout = 1000;
|
||||
break;
|
||||
case CacheTimeout.short:
|
||||
timeout = oneMinute;
|
||||
break;
|
||||
case CacheTimeout.long:
|
||||
timeout = oneMinute * 60; // 1 hour
|
||||
break;
|
||||
case CacheTimeout.verylong:
|
||||
timeout = oneMinute * 60 * 24; // 24 hours
|
||||
break;
|
||||
default:
|
||||
timeout = oneMinute * 10; // 10 minutes
|
||||
break;
|
||||
}
|
||||
return timeout;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
import StorageCacheProvider from "../Cache/StorageCacheProvider";
|
||||
import ConsoleLogProvider from "../Log/ConsoleLogProvider";
|
||||
import PnPListsService from "../../services/Lists/PnPListsService";
|
||||
import PnPListsServiceExecutor from "../../services/Lists/executor/PnPListsServiceExecutor";
|
||||
import ICacheProvider from "../Cache/ICacheProvider";
|
||||
import ILogProvider from "../Log/ILogProvider";
|
||||
import IListsService from "../../services/Lists/IListsService";
|
||||
|
||||
export default class DependencyResolver { // implements IDependencyResolver
|
||||
// private useMockServices: boolean;
|
||||
|
||||
// constructor(useMockServices: boolean = false) {
|
||||
// this.useMockServices = useMockServices;
|
||||
// }
|
||||
|
||||
public ResolveICacheProvider(): ICacheProvider {
|
||||
return new StorageCacheProvider(window.sessionStorage);
|
||||
}
|
||||
|
||||
public ResolveILogProvider(): ILogProvider {
|
||||
return new ConsoleLogProvider();
|
||||
}
|
||||
|
||||
public ResolveIListsService(webUrl: string): IListsService {
|
||||
return new PnPListsService(new PnPListsServiceExecutor(webUrl));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,120 @@
|
|||
/// <reference types="jest" />
|
||||
|
||||
import ConsoleLogProvider from "./ConsoleLogProvider";
|
||||
import MockConsole from "./MockConsole";
|
||||
|
||||
describe('Provider: ConsoleLogProvider', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
// do nothing
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
// do nothing
|
||||
});
|
||||
|
||||
it('can log debug', async () => {
|
||||
// ARRANGE
|
||||
const mockConsole = new MockConsole();
|
||||
const logProvider = new ConsoleLogProvider(mockConsole);
|
||||
|
||||
// ACT
|
||||
await logProvider.Debug("class name", "my message");
|
||||
|
||||
// ASSERT
|
||||
expect(mockConsole.didDebug.indexOf("class name")).toBeGreaterThanOrEqual(0);
|
||||
expect(mockConsole.didDebug.indexOf("my message")).toBeGreaterThanOrEqual(0);
|
||||
});
|
||||
|
||||
it('can log debug with json', async () => {
|
||||
// ARRANGE
|
||||
const mockConsole = new MockConsole();
|
||||
const logProvider = new ConsoleLogProvider(mockConsole);
|
||||
|
||||
// ACT
|
||||
await logProvider.Debug("class name", "my message", {});
|
||||
|
||||
// ASSERT
|
||||
expect(mockConsole.didDebug.indexOf("class name")).toBeGreaterThanOrEqual(0);
|
||||
expect(mockConsole.didDebug.indexOf("my message")).toBeGreaterThanOrEqual(0);
|
||||
});
|
||||
|
||||
it('can log info', async () => {
|
||||
// ARRANGE
|
||||
const logConsole = new MockConsole();
|
||||
const logProvider = new ConsoleLogProvider(logConsole);
|
||||
|
||||
// ACT
|
||||
await logProvider.Info("class name", "my message");
|
||||
|
||||
// ASSERT
|
||||
expect(logConsole.didInfo.indexOf("class name")).toBeGreaterThanOrEqual(0);
|
||||
expect(logConsole.didInfo.indexOf("my message")).toBeGreaterThanOrEqual(0);
|
||||
});
|
||||
|
||||
it('can log info with JSON', async () => {
|
||||
// ARRANGE
|
||||
const logConsole = new MockConsole();
|
||||
const logProvider = new ConsoleLogProvider(logConsole);
|
||||
|
||||
// ACT
|
||||
await logProvider.Info("class name", "my message", {});
|
||||
|
||||
// ASSERT
|
||||
expect(logConsole.didInfo.indexOf("class name")).toBeGreaterThanOrEqual(0);
|
||||
expect(logConsole.didInfo.indexOf("my message")).toBeGreaterThanOrEqual(0);
|
||||
});
|
||||
|
||||
it('can log warn', async () => {
|
||||
// ARRANGE
|
||||
const logConsole = new MockConsole();
|
||||
const logProvider = new ConsoleLogProvider(logConsole);
|
||||
|
||||
// ACT
|
||||
await logProvider.Warning("class name", "my message");
|
||||
|
||||
// ASSERT
|
||||
expect(logConsole.didWarn.indexOf("class name")).toBeGreaterThanOrEqual(0);
|
||||
expect(logConsole.didWarn.indexOf("my message")).toBeGreaterThanOrEqual(0);
|
||||
});
|
||||
|
||||
it('can log warn with json', async () => {
|
||||
// ARRANGE
|
||||
const logConsole = new MockConsole();
|
||||
const logProvider = new ConsoleLogProvider(logConsole);
|
||||
|
||||
// ACT
|
||||
await logProvider.Warning("class name", "my message", {});
|
||||
|
||||
// ASSERT
|
||||
expect(logConsole.didWarn.indexOf("class name")).toBeGreaterThanOrEqual(0);
|
||||
expect(logConsole.didWarn.indexOf("my message")).toBeGreaterThanOrEqual(0);
|
||||
});
|
||||
|
||||
it('can log error', async () => {
|
||||
// ARRANGE
|
||||
const logConsole = new MockConsole();
|
||||
const logProvider = new ConsoleLogProvider(logConsole);
|
||||
|
||||
// ACT
|
||||
await logProvider.Error("class name", "my message");
|
||||
|
||||
// ASSERT
|
||||
expect(logConsole.didError.indexOf("class name")).toBeGreaterThanOrEqual(0);
|
||||
expect(logConsole.didError.indexOf("my message")).toBeGreaterThanOrEqual(0);
|
||||
});
|
||||
|
||||
it('can log error with JSON', async () => {
|
||||
// ARRANGE
|
||||
const logConsole = new MockConsole();
|
||||
const logProvider = new ConsoleLogProvider(logConsole);
|
||||
|
||||
// ACT
|
||||
await logProvider.Error("class name", "my message", {});
|
||||
|
||||
// ASSERT
|
||||
expect(logConsole.didError.indexOf("class name")).toBeGreaterThanOrEqual(0);
|
||||
expect(logConsole.didError.indexOf("my message")).toBeGreaterThanOrEqual(0);
|
||||
});
|
||||
|
||||
});
|
|
@ -0,0 +1,36 @@
|
|||
import ILogProvider from "./ILogProvider";
|
||||
import IConsole from "./IConsole";
|
||||
|
||||
export default class ConsoleLogProvider implements ILogProvider {
|
||||
private consolelog: IConsole;
|
||||
constructor(consolelog: IConsole = window.console) {
|
||||
this.consolelog = consolelog;
|
||||
}
|
||||
|
||||
public async Debug(className: string, message: string, json: any = undefined): Promise<void> {
|
||||
const jsonString: string = this.getJsonString(json);
|
||||
this.internalLog(this.consolelog.debug, className, message, jsonString);
|
||||
}
|
||||
public async Info(className: string, message: string, json: any = undefined): Promise<void> {
|
||||
const jsonString: string = this.getJsonString(json);
|
||||
this.internalLog(this.consolelog.info, className, message, jsonString);
|
||||
}
|
||||
public async Warning(className: string, message: string, json: any = undefined): Promise<void> {
|
||||
const jsonString: string = this.getJsonString(json);
|
||||
this.internalLog(this.consolelog.warn, className, message, jsonString);
|
||||
}
|
||||
public async Error(className: string, message: string, json: any = undefined): Promise<void> {
|
||||
const jsonString: string = this.getJsonString(json);
|
||||
this.internalLog(this.consolelog.error, className, message, jsonString);
|
||||
}
|
||||
|
||||
private getJsonString(json: any): string {
|
||||
const jsonString: string = !!json ? JSON.stringify(json) : "";
|
||||
return jsonString;
|
||||
}
|
||||
|
||||
private internalLog(log: (message:string) => void, className: string, message: string, jsonString: string): void {
|
||||
const logMessage: string = `${className}, ${message}, ${jsonString}`;
|
||||
log(logMessage);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
export default interface IConsole {
|
||||
debug(message?: any, ...optionalParams: any[]): void;
|
||||
info(message?: any, ...optionalParams: any[]): void;
|
||||
log(message?: any, ...optionalParams: any[]): void;
|
||||
warn(message?: any, ...optionalParams: any[]): void;
|
||||
error(message?: any, ...optionalParams: any[]): void;
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
export default interface ILogProvider {
|
||||
Debug(className: string, message: string, json: any): Promise<void>;
|
||||
Info(className: string, message: string, json: any): Promise<void>;
|
||||
Warning(className: string, message: string, json: any): Promise<void>;
|
||||
Error(className: string, message: string, json: any): Promise<void>;
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
import IConsole from "./IConsole";
|
||||
|
||||
export default class MockConsole implements IConsole {
|
||||
constructor() {
|
||||
this.debug = this.debug.bind(this);
|
||||
this.info = this.info.bind(this);
|
||||
this.log = this.log.bind(this);
|
||||
this.warn = this.warn.bind(this);
|
||||
this.error = this.error.bind(this);
|
||||
}
|
||||
|
||||
public didDebug: string = "";
|
||||
public didInfo: string = "";
|
||||
public didLog: string = "";
|
||||
public didWarn: string = "";
|
||||
public didError: string = "";
|
||||
|
||||
public debug(message?: any, ...optionalParams: any[]): void {
|
||||
this.didDebug = message;
|
||||
}
|
||||
public info(message?: any, ...optionalParams: any[]): void {
|
||||
this.didInfo = message;
|
||||
}
|
||||
public log(message?: any, ...optionalParams: any[]): void {
|
||||
this.didLog = message;
|
||||
}
|
||||
public warn(message?: any, ...optionalParams: any[]): void {
|
||||
this.didWarn = message;
|
||||
}
|
||||
public error(message?: any, ...optionalParams: any[]): void {
|
||||
this.didError = message;
|
||||
}
|
||||
}
|
||||
|
||||
// export default class MockConsole implements Console {
|
||||
// public didDebug: boolean = false;
|
||||
// public didInfo: boolean = false;
|
||||
// public didLog: boolean = false;
|
||||
// public didWarn: boolean = false;
|
||||
// public didError: boolean = false;
|
||||
|
||||
// public debug(message?: any, ...optionalParams: any[]): void {
|
||||
// this.didDebug = true;
|
||||
// }
|
||||
// public info(message?: any, ...optionalParams: any[]): void {
|
||||
// this.didInfo = true;
|
||||
// }
|
||||
// public log(message?: any, ...optionalParams: any[]): void {
|
||||
// this.didLog = true;
|
||||
// }
|
||||
// public warn(message?: any, ...optionalParams: any[]): void {
|
||||
// this.didWarn = true;
|
||||
// }
|
||||
// public error(message?: any, ...optionalParams: any[]): void {
|
||||
// this.didError = true;
|
||||
// }
|
||||
|
||||
// // Not required to mock for console logging
|
||||
// public trace(message?: any, ...optionalParams: any[]): void {
|
||||
// // do nothing
|
||||
// }
|
||||
// public memory: any;
|
||||
// public assert(condition?: boolean, message?: string, ...data: any[]): void {
|
||||
// // do nothing
|
||||
// }
|
||||
// public clear(): void {
|
||||
// // do nothing
|
||||
// }
|
||||
// public count(label?: string): void {
|
||||
// // do nothing
|
||||
// }
|
||||
// public dir(value?: any, ...optionalParams: any[]): void {
|
||||
// // do nothing
|
||||
// }
|
||||
// public dirxml(value: any): void {
|
||||
// // do nothing
|
||||
// }
|
||||
// public exception(message?: string, ...optionalParams: any[]): void {
|
||||
// // do nothing
|
||||
// }
|
||||
// public group(groupTitle?: string, ...optionalParams: any[]): void {
|
||||
// // do nothing
|
||||
// }
|
||||
// public groupCollapsed(groupTitle?: string, ...optionalParams: any[]): void {
|
||||
// // do nothing
|
||||
// }
|
||||
// public groupEnd(): void {
|
||||
// // do nothing
|
||||
// }
|
||||
// public markTimeline(label?: string): void {
|
||||
// // do nothing
|
||||
// }
|
||||
// public profile(reportName?: string): void {
|
||||
// // do nothing
|
||||
// }
|
||||
// public profileEnd(reportName?: string): void {
|
||||
// // do nothing
|
||||
// }
|
||||
// public table(...tabularData: any[]): void {
|
||||
// // do nothing
|
||||
// }
|
||||
// public time(label?: string): void {
|
||||
// // do nothing
|
||||
// }
|
||||
// public timeEnd(label?: string): void {
|
||||
// // do nothing
|
||||
// }
|
||||
// public timeStamp(label?: string): void {
|
||||
// // do nothing
|
||||
// }
|
||||
// public timeline(label?: string): void {
|
||||
// // do nothing
|
||||
// }
|
||||
// public timelineEnd(label?: string): void {
|
||||
// // do nothing
|
||||
// }
|
||||
// }
|
|
@ -0,0 +1,17 @@
|
|||
import ILogProvider from "./ILogProvider";
|
||||
|
||||
export default class MockLogProvider implements ILogProvider {
|
||||
public async Debug(className: string, message: string, json: any): Promise<void> {
|
||||
// do nothing
|
||||
}
|
||||
public async Info(className: string, message: string, json: any): Promise<void> {
|
||||
// do nothing
|
||||
}
|
||||
public async Warning(className: string, message: string, json: any): Promise<void> {
|
||||
// do nothing
|
||||
}
|
||||
public async Error(className: string, message: string, json: any): Promise<void> {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
export interface IList {
|
||||
Title: string;
|
||||
DefaultViewUrl: string;
|
||||
}
|
||||
|
||||
export default interface IListsService {
|
||||
GetLists(): Promise<IList[]>;
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
import IListsService, { IList } from "./IListsService";
|
||||
|
||||
export default class MockListsService implements IListsService {
|
||||
private lists: IList[] = [];
|
||||
|
||||
constructor(lists: IList[]) {
|
||||
this.lists = lists;
|
||||
}
|
||||
|
||||
public async GetLists(): Promise<IList[]> {
|
||||
return this.lists;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/// <reference types="jest" />
|
||||
|
||||
import PnPListsService from './PnPListsService';
|
||||
import MockListsServiceExecutor from './executor/MockListsServiceExecutor';
|
||||
import IListsServiceExecutor from './executor/IListsServiceExecutor';
|
||||
|
||||
describe('Service: PnPListsService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
// do nothing
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
// do nothing
|
||||
});
|
||||
|
||||
it('should get 1 list [Using explict class to mock]', async () => {
|
||||
// ARRANGE
|
||||
const service = new PnPListsService(new MockListsServiceExecutor([
|
||||
{ Title: "Mocked List", DefaultViewUrl: "https://bing.com" }
|
||||
]));
|
||||
|
||||
// ACT
|
||||
const lists = await service.GetLists();
|
||||
|
||||
// ASSERT
|
||||
expect(lists.length).toBe(1);
|
||||
});
|
||||
|
||||
it('should get 1 list [Using Jest to mock]', async () => {
|
||||
// ARRANGE
|
||||
const MockServiceExecutor = jest.fn<IListsServiceExecutor>(() => ({
|
||||
Get: jest.fn().mockReturnValue([{ Title: "Mocked List", DefaultViewUrl: "https://bing.com" }])
|
||||
}));
|
||||
const service = new PnPListsService(new MockServiceExecutor());
|
||||
|
||||
// ACT
|
||||
const lists = await service.GetLists();
|
||||
|
||||
// ASSERT
|
||||
expect(lists.length).toBe(1);
|
||||
});
|
||||
|
||||
it('should get 2 lists', async () => {
|
||||
// ARRANGE
|
||||
const service = new PnPListsService(new MockListsServiceExecutor([
|
||||
{ Title: "Mocked List", DefaultViewUrl: "https://bing.com" },
|
||||
{ Title: "Another List", DefaultViewUrl: "https://bing.com" }
|
||||
]));
|
||||
|
||||
// ACT
|
||||
const lists = await service.GetLists();
|
||||
|
||||
// ASSERT
|
||||
expect(lists.length).toBe(2);
|
||||
});
|
||||
|
||||
});
|
|
@ -0,0 +1,21 @@
|
|||
import IListsService, { IList } from "./IListsService";
|
||||
import IListsServiceExecutor from "./executor/IListsServiceExecutor";
|
||||
|
||||
export default class PnPListsService implements IListsService {
|
||||
private executor: IListsServiceExecutor;
|
||||
|
||||
constructor(executor: IListsServiceExecutor) {
|
||||
this.executor = executor;
|
||||
}
|
||||
|
||||
public async GetLists(): Promise<IList[]> {
|
||||
const listsData = await this.executor.Get();
|
||||
const lists = listsData.map(l => {
|
||||
return {
|
||||
Title: l.Title,
|
||||
DefaultViewUrl: l.DefaultViewUrl
|
||||
};
|
||||
});
|
||||
return lists;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
export default interface IListsServiceExecutor {
|
||||
Get(): Promise<any[]>;
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
import IListsServiceExecutor from "./IListsServiceExecutor";
|
||||
|
||||
export default class MockListsServiceExecutor implements IListsServiceExecutor {
|
||||
private listsData: any[];
|
||||
|
||||
constructor(listsData: any[]) {
|
||||
this.listsData = listsData;
|
||||
}
|
||||
|
||||
public async Get(): Promise<any[]> {
|
||||
return this.listsData;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
import IListsServiceExecutor from "./IListsServiceExecutor";
|
||||
|
||||
export default class PnPListsServiceExecutor implements IListsServiceExecutor {
|
||||
private webUrl: string;
|
||||
|
||||
constructor(webUrl: string) {
|
||||
this.webUrl = webUrl;
|
||||
}
|
||||
|
||||
public async Get(): Promise<any[]> {
|
||||
const { Web } = await import(/* webpackChunkName: 'pnp-sp-bundle' */"@pnp/sp");
|
||||
const listsData = await new Web(this.webUrl).lists.select("Title", "DefaultViewUrl").get();
|
||||
return listsData;
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
// A file is required to be in the root of the /src directory by the TypeScript compiler
|
|
@ -0,0 +1,68 @@
|
|||
{
|
||||
"rules": {
|
||||
"export-name": false,
|
||||
"no-duplicate-switch-case": true,
|
||||
"no-function-expression": false,
|
||||
"no-use-before-declare": true,
|
||||
"prefer-const": true,
|
||||
"member-ordering": [false],
|
||||
"no-constant-condition": [false],
|
||||
|
||||
"class-name": false,
|
||||
"forin": false,
|
||||
"label-position": false,
|
||||
"label-undefined": false,
|
||||
"member-access": true,
|
||||
"no-arg": true,
|
||||
"no-console": [true, "log", "error"],
|
||||
"no-construct": true,
|
||||
"no-duplicate-variable": true,
|
||||
"no-eval": true,
|
||||
"no-internal-module": true,
|
||||
"no-shadowed-variable": true,
|
||||
"no-switch-case-fall-through": true,
|
||||
"no-unused-expression": true,
|
||||
"no-unused-variable": false,
|
||||
"semicolon": [true, "always"],
|
||||
"typedef": [true, "call-signature", "parameter", "member-variable-declaration", "property-declaration"],
|
||||
"typedef-whitespace": [
|
||||
false,
|
||||
{
|
||||
"call-signature": "nospace",
|
||||
"index-signature": "nospace",
|
||||
"parameter": "nospace",
|
||||
"property-declaration": "nospace",
|
||||
"variable-declaration": "nospace"
|
||||
},
|
||||
{
|
||||
"call-signature": "onespace",
|
||||
"index-signature": "onespace",
|
||||
"parameter": "onespace",
|
||||
"property-declaration": "onespace",
|
||||
"variable-declaration": "onespace"
|
||||
}
|
||||
],
|
||||
"variable-name": false,
|
||||
"whitespace": [false],
|
||||
"comment-format": [false, "check-space"],
|
||||
"curly": true,
|
||||
"indent": [false],
|
||||
"interface-name": [true, "always-prefix"],
|
||||
"max-line-length": [true, 150],
|
||||
"no-any": false,
|
||||
"no-bitwise": true,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-debugger": true,
|
||||
"no-empty": true,
|
||||
"no-null-keyword": false,
|
||||
"no-string-literal": true,
|
||||
"no-trailing-whitespace": false,
|
||||
"no-var-keyword": true,
|
||||
"one-line": [true, "check-open-brace"],
|
||||
"quotemark": [false, "double", "jsx-double", "avoid-escape"],
|
||||
"radix": false,
|
||||
"triple-equals": true,
|
||||
"trailing-comma": [false, {"multiline": "never", "singleline": "never"}],
|
||||
"object-literal-sort-keys": false
|
||||
}
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
/// <reference types="jest" />
|
||||
|
||||
import IoCTestsWebPartPropsDependencyResolver from "./IoCTestsWebPartPropsDependencyResolver";
|
||||
import { IIocTestsWebPartProps } from "./IocTestsWebPart";
|
||||
|
||||
describe('DependencyResolver: IoCTestsWebPartPropsDependencyResolver', () => {
|
||||
|
||||
let resolver: IoCTestsWebPartPropsDependencyResolver;
|
||||
|
||||
beforeEach(() => {
|
||||
resolver = new IoCTestsWebPartPropsDependencyResolver();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
// do nothing
|
||||
});
|
||||
|
||||
it('should have valid props with mocked services', async () => {
|
||||
// ARRANGE
|
||||
const webUrl = "https://bing.com";
|
||||
const properties: IIocTestsWebPartProps = {
|
||||
description: "This is a description"
|
||||
};
|
||||
|
||||
// ACT
|
||||
const props = resolver.resolve(properties, webUrl);
|
||||
|
||||
// ASSERT
|
||||
expect(props.logProvider).toBeDefined();
|
||||
expect(props.cacheProvider).toBeDefined();
|
||||
expect(props.listsService).toBeDefined();
|
||||
});
|
||||
|
||||
it('should have valid props with real services', async () => {
|
||||
// ARRANGE
|
||||
const webUrl = "https://bing.com";
|
||||
const properties: IIocTestsWebPartProps = {
|
||||
description: "This is a description"
|
||||
};
|
||||
|
||||
// ACT
|
||||
const props = resolver.resolve(properties, webUrl);
|
||||
|
||||
// ASSERT
|
||||
expect(props.logProvider).toBeDefined();
|
||||
expect(props.cacheProvider).toBeDefined();
|
||||
expect(props.listsService).toBeDefined();
|
||||
});
|
||||
|
||||
it('should support empty property', async () => {
|
||||
// ARRANGE
|
||||
const webUrl = "https://bing.com";
|
||||
const properties: IIocTestsWebPartProps = {
|
||||
description: ""
|
||||
};
|
||||
|
||||
// ACT
|
||||
const props = resolver.resolve(properties, webUrl);
|
||||
|
||||
// ASSERT
|
||||
expect(props.logProvider).toBeDefined();
|
||||
expect(props.cacheProvider).toBeDefined();
|
||||
expect(props.listsService).toBeDefined();
|
||||
});
|
||||
|
||||
});
|
|
@ -0,0 +1,26 @@
|
|||
import { IIocTestsWebPartProps } from "./IocTestsWebPart";
|
||||
import { IListOfListsProps } from "./components/ListOfLists";
|
||||
import IListsService from "../../common/services/Lists/IListsService";
|
||||
import ICacheProvider from "../../common/providers/Cache/ICacheProvider";
|
||||
import ILogProvider from "../../common/providers/Log/ILogProvider";
|
||||
import DependencyResolver from "../../common/providers/DependencyResolver/DependencyResolver";
|
||||
|
||||
export default class IoCTestsWebPartPropsDependencyResolver {
|
||||
public resolve(properties: IIocTestsWebPartProps, webUrl: string): IListOfListsProps {
|
||||
|
||||
const resolver = new DependencyResolver();
|
||||
|
||||
const listsService: IListsService = resolver.ResolveIListsService(webUrl);
|
||||
const cacheProvider: ICacheProvider = resolver.ResolveICacheProvider();
|
||||
const logProvider: ILogProvider = resolver.ResolveILogProvider();
|
||||
|
||||
const props: IListOfListsProps = {
|
||||
description: properties.description,
|
||||
listsService: listsService,
|
||||
cacheProvider: cacheProvider,
|
||||
logProvider: logProvider
|
||||
};
|
||||
|
||||
return props;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx/client-side-web-part-manifest.schema.json",
|
||||
"id": "52a13e89-ec95-4f70-a66f-c95ddc682a4e",
|
||||
"alias": "IocTestsWebPart",
|
||||
"componentType": "WebPart",
|
||||
|
||||
// The "*" signifies that the version should be taken from the package.json
|
||||
"version": "*",
|
||||
"manifestVersion": 2,
|
||||
|
||||
// If true, the component can only be installed on sites where Custom Script is allowed.
|
||||
// Components that allow authors to embed arbitrary script code should set this to true.
|
||||
// https://support.office.com/en-us/article/Turn-scripting-capabilities-on-or-off-1f2c515f-5d7e-448a-9fd7-835da935584f
|
||||
"requiresCustomScript": false,
|
||||
"supportedHosts": ["SharePointWebPart"],
|
||||
|
||||
"preconfiguredEntries": [{
|
||||
"groupId": "5c03119e-3074-46fd-976b-c60198311f70", // Other
|
||||
"group": { "default": "Other" },
|
||||
"title": { "default": "Ioc Tests" },
|
||||
"description": { "default": "Ioc Tests description" },
|
||||
"officeFabricIconFontName": "Page",
|
||||
"properties": {
|
||||
"description": "Ioc Tests"
|
||||
}
|
||||
}]
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
import * as React from 'react';
|
||||
import * as ReactDom from 'react-dom';
|
||||
import { Version } from '@microsoft/sp-core-library';
|
||||
|
||||
import { BaseClientSideWebPart } from "@microsoft/sp-webpart-base";
|
||||
import { IPropertyPaneConfiguration, PropertyPaneTextField } from "@microsoft/sp-property-pane";
|
||||
|
||||
import * as strings from 'IocTestsWebPartStrings';
|
||||
import ListOfLists, { IListOfListsProps } from './components/ListOfLists';
|
||||
import IoCTestsWebPartPropsDependencyResolver from './IoCTestsWebPartPropsDependencyResolver';
|
||||
|
||||
export interface IIocTestsWebPartProps {
|
||||
description: string;
|
||||
}
|
||||
|
||||
export default class IocTestsWebPart extends BaseClientSideWebPart<IIocTestsWebPartProps> {
|
||||
|
||||
public render(): void {
|
||||
const weburl = this.context.pageContext.web.absoluteUrl;
|
||||
const props = (new IoCTestsWebPartPropsDependencyResolver()).resolve(this.properties, weburl);
|
||||
const element: React.ReactElement<IListOfListsProps> = React.createElement(
|
||||
ListOfLists,
|
||||
props
|
||||
);
|
||||
|
||||
ReactDom.render(element, this.domElement);
|
||||
}
|
||||
|
||||
protected onDispose(): void {
|
||||
ReactDom.unmountComponentAtNode(this.domElement);
|
||||
}
|
||||
|
||||
protected get dataVersion(): Version {
|
||||
return Version.parse('1.0');
|
||||
}
|
||||
|
||||
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
|
||||
return {
|
||||
pages: [
|
||||
{
|
||||
header: {
|
||||
description: strings.PropertyPaneDescription
|
||||
},
|
||||
groups: [
|
||||
{
|
||||
groupName: strings.BasicGroupName,
|
||||
groupFields: [
|
||||
PropertyPaneTextField('description', {
|
||||
label: strings.DescriptionFieldLabel
|
||||
})
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
.ListOfLists {
|
||||
.container {
|
||||
max-width: 700px;
|
||||
margin: 0px auto;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,189 @@
|
|||
/// <reference types="jest" />
|
||||
|
||||
import * as React from 'react';
|
||||
import { configure, shallow } from 'enzyme';
|
||||
import * as Adapter from 'enzyme-adapter-react-16.3';
|
||||
|
||||
configure({ adapter: new Adapter() });
|
||||
|
||||
import ListOfLists from './ListOfLists';
|
||||
import MockListsService from '../../../common/services/Lists/MockListsService';
|
||||
import MockCacheProvider from '../../../common/providers/Cache/MockCacheProvider';
|
||||
import MockLogProvider from '../../../common/providers/Log/MockLogProvider';
|
||||
|
||||
describe('Component: ListOfLists', () => {
|
||||
|
||||
let reactComponent;
|
||||
|
||||
beforeEach(() => {
|
||||
// do nothing
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
reactComponent.unmount();
|
||||
});
|
||||
|
||||
it('should render in loading state', async () => {
|
||||
// ARRANGE
|
||||
reactComponent = shallow(React.createElement(
|
||||
ListOfLists,
|
||||
{
|
||||
description: "",
|
||||
listsService: new MockListsService([{ Title: "Mocked List", DefaultViewUrl: "https://bing.com" }]),
|
||||
cacheProvider: new MockCacheProvider(),
|
||||
logProvider: new MockLogProvider()
|
||||
}
|
||||
));
|
||||
|
||||
// ACT
|
||||
const element = reactComponent.first("div");
|
||||
|
||||
// ASSERT
|
||||
expect(element.length).toBeGreaterThan(0);
|
||||
expect(element.text().trim()).toEqual("Loading...");
|
||||
});
|
||||
|
||||
it('should render 1 item with no cache', async () => {
|
||||
// ARRANGE
|
||||
reactComponent = shallow(React.createElement(
|
||||
ListOfLists,
|
||||
{
|
||||
description: "Web part desciption",
|
||||
listsService: new MockListsService([
|
||||
{ Title: "Mocked List", DefaultViewUrl: "https://bing.com" }
|
||||
]),
|
||||
cacheProvider: new MockCacheProvider(),
|
||||
logProvider: new MockLogProvider()
|
||||
}
|
||||
));
|
||||
|
||||
// ACT
|
||||
await (reactComponent.instance().componentDidMount() as Promise<void>);
|
||||
const element = reactComponent.find("a");
|
||||
|
||||
// ASSERT
|
||||
expect(element.length).toEqual(1);
|
||||
});
|
||||
|
||||
it('should render 2 items with no cache', async () => {
|
||||
// ARRANGE
|
||||
reactComponent = shallow(React.createElement(
|
||||
ListOfLists,
|
||||
{
|
||||
description: "Web part desciption",
|
||||
listsService: new MockListsService([
|
||||
{ Title: "Mocked List", DefaultViewUrl: "https://bing.com" },
|
||||
{ Title: "Another List", DefaultViewUrl: "https://bing.com" }
|
||||
]),
|
||||
cacheProvider: new MockCacheProvider(),
|
||||
logProvider: new MockLogProvider()
|
||||
}
|
||||
));
|
||||
|
||||
// ACT
|
||||
await (reactComponent.instance().componentDidMount() as Promise<void>);
|
||||
const element = reactComponent.find("a");
|
||||
|
||||
// ASSERT
|
||||
expect(element.length).toEqual(2);
|
||||
});
|
||||
|
||||
it('should render 1 item with primed cache', async () => {
|
||||
// ARRANGE
|
||||
reactComponent = shallow(React.createElement(
|
||||
ListOfLists,
|
||||
{
|
||||
description: "Web part desciption",
|
||||
listsService: new MockListsService(null),
|
||||
cacheProvider: new MockCacheProvider([
|
||||
{ Title: "Mocked List", DefaultViewUrl: "https://bing.com" }
|
||||
]),
|
||||
logProvider: new MockLogProvider()
|
||||
}
|
||||
));
|
||||
|
||||
// ACT
|
||||
await (reactComponent.instance().componentDidMount() as Promise<void>);
|
||||
const items = reactComponent.find("a");
|
||||
|
||||
// ASSERT
|
||||
expect(items.length).toEqual(1);
|
||||
});
|
||||
|
||||
it('should render 1 item with primed cache', async () => {
|
||||
// ARRANGE
|
||||
reactComponent = shallow(React.createElement(
|
||||
ListOfLists,
|
||||
{
|
||||
description: "Web part desciption",
|
||||
listsService: new MockListsService(null),
|
||||
cacheProvider: new MockCacheProvider([
|
||||
{ Title: "Mocked List", DefaultViewUrl: "https://bing.com" },
|
||||
{ Title: "Another List", DefaultViewUrl: "https://bing.com" }
|
||||
]),
|
||||
logProvider: new MockLogProvider()
|
||||
}
|
||||
));
|
||||
|
||||
// ACT
|
||||
await (reactComponent.instance().componentDidMount() as Promise<void>);
|
||||
const items = reactComponent.find("a");
|
||||
|
||||
// ASSERT
|
||||
expect(items.length).toEqual(2);
|
||||
});
|
||||
|
||||
it('should render description', async () => {
|
||||
// ARRANGE
|
||||
const webPartDesciption = "Web part desciption";
|
||||
reactComponent = shallow(React.createElement(
|
||||
ListOfLists,
|
||||
{
|
||||
description: webPartDesciption,
|
||||
listsService: new MockListsService([]),
|
||||
cacheProvider: new MockCacheProvider([]),
|
||||
logProvider: new MockLogProvider()
|
||||
}
|
||||
));
|
||||
|
||||
// ACT
|
||||
await (reactComponent.instance().componentDidMount() as Promise<void>);
|
||||
const items = reactComponent.find("a");
|
||||
|
||||
// ACT
|
||||
const element = reactComponent.first("div");
|
||||
|
||||
// ASSERT
|
||||
expect(element.length).toBeGreaterThan(0);
|
||||
expect(element.text().trim()).toEqual(webPartDesciption);
|
||||
});
|
||||
|
||||
it('should not render empty description', async () => {
|
||||
// ARRANGE
|
||||
reactComponent = shallow(React.createElement(
|
||||
ListOfLists,
|
||||
{
|
||||
description: null,
|
||||
listsService: new MockListsService([]),
|
||||
cacheProvider: new MockCacheProvider([]),
|
||||
logProvider: new MockLogProvider()
|
||||
}
|
||||
));
|
||||
|
||||
// ACT
|
||||
await (reactComponent.instance().componentDidMount() as Promise<void>);
|
||||
const items = reactComponent.find("a");
|
||||
|
||||
// ACT
|
||||
const element = reactComponent.first("div");
|
||||
|
||||
// ASSERT
|
||||
expect(element.length).toBeGreaterThan(0);
|
||||
expect(element.text().trim()).toEqual("");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// Usefull links:
|
||||
// https://reactjs.org/docs/test-renderer.html
|
||||
// https://github.com/airbnb/enzyme
|
|
@ -0,0 +1,75 @@
|
|||
import * as React from 'react';
|
||||
import styles from './ListOfLists.module.scss';
|
||||
import IListsService, { IList } from '../../../common/services/Lists/IListsService';
|
||||
import ICacheProvider, { CacheTimeout } from '../../../common/providers/Cache/ICacheProvider';
|
||||
import ILogProvider from '../../../common/providers/Log/ILogProvider';
|
||||
|
||||
export interface IListOfListsProps {
|
||||
description: string;
|
||||
cacheProvider: ICacheProvider;
|
||||
logProvider: ILogProvider;
|
||||
listsService: IListsService;
|
||||
}
|
||||
|
||||
export interface IListOfListsState {
|
||||
lists: IList[];
|
||||
isLoading: boolean;
|
||||
}
|
||||
|
||||
export default class ListOfLists extends React.Component<IListOfListsProps, IListOfListsState> {
|
||||
private className: string = "ListOfLists";
|
||||
|
||||
constructor(props: IListOfListsProps) {
|
||||
super(props);
|
||||
this.state = {
|
||||
lists: [],
|
||||
isLoading: true
|
||||
};
|
||||
}
|
||||
|
||||
public async componentDidMount(): Promise<void> {
|
||||
// LOG PROVIDER
|
||||
await this.props.logProvider.Debug(this.className, "componentDidMount", null);
|
||||
|
||||
// CACHE PROVIDER
|
||||
const cacheKey = "ListOfListsGetLists";
|
||||
let lists: IList[] = await this.props.cacheProvider.Get(cacheKey);
|
||||
if (!lists) {
|
||||
// LISTS SERVICE
|
||||
lists = await this.props.listsService.GetLists();
|
||||
|
||||
// CACHE PROVIDER
|
||||
await this.props.cacheProvider.Set(cacheKey, lists, CacheTimeout.default);
|
||||
}
|
||||
|
||||
this.setState({
|
||||
lists: lists,
|
||||
isLoading: false
|
||||
});
|
||||
}
|
||||
|
||||
public render(): React.ReactElement<IListOfListsProps> {
|
||||
this.props.logProvider.Debug(this.className, "render", null);
|
||||
|
||||
return (
|
||||
<div id={ styles.ListOfLists } className={ styles.ListOfLists }>
|
||||
<div className={ styles.container }>
|
||||
{ !!this.props.description &&
|
||||
<div>{this.props.description}</div>
|
||||
}
|
||||
{ !!this.state.isLoading &&
|
||||
<span> Loading... </span>
|
||||
}
|
||||
{ this.state.lists.map(l => {
|
||||
return (
|
||||
<div key={l.Title}>
|
||||
<a href={l.DefaultViewUrl} target={"_blank"}>{l.Title}</a>
|
||||
</div>
|
||||
);
|
||||
})
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
define([], function() {
|
||||
return {
|
||||
"PropertyPaneDescription": "Description",
|
||||
"BasicGroupName": "Group Name",
|
||||
"DescriptionFieldLabel": "Description Field"
|
||||
}
|
||||
});
|
|
@ -0,0 +1,10 @@
|
|||
declare interface IIocTestsWebPartStrings {
|
||||
PropertyPaneDescription: string;
|
||||
BasicGroupName: string;
|
||||
DescriptionFieldLabel: string;
|
||||
}
|
||||
|
||||
declare module 'IocTestsWebPartStrings' {
|
||||
const strings: IIocTestsWebPartStrings;
|
||||
export = strings;
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"extends": "./node_modules/@microsoft/rush-stack-compiler-3.3/includes/tsconfig-web.json",
|
||||
"compilerOptions": {
|
||||
"strict": true,
|
||||
"target": "es5",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"jsx": "react",
|
||||
"declaration": true,
|
||||
"sourceMap": true,
|
||||
"experimentalDecorators": true,
|
||||
"skipLibCheck": true,
|
||||
"outDir": "lib",
|
||||
"typeRoots": [
|
||||
"./node_modules/@types",
|
||||
"./node_modules/@microsoft"
|
||||
],
|
||||
"types": [
|
||||
"es6-promise",
|
||||
"webpack-env"
|
||||
],
|
||||
"lib": [
|
||||
"es5",
|
||||
"dom",
|
||||
"es2015.collection"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"lib"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"extends": "@microsoft/sp-tslint-rules/base-tslint.json",
|
||||
"rules": {
|
||||
"class-name": false,
|
||||
"export-name": false,
|
||||
"forin": false,
|
||||
"label-position": false,
|
||||
"member-access": true,
|
||||
"no-arg": false,
|
||||
"no-console": false,
|
||||
"no-construct": false,
|
||||
"no-duplicate-variable": true,
|
||||
"no-eval": false,
|
||||
"no-function-expression": true,
|
||||
"no-internal-module": true,
|
||||
"no-shadowed-variable": true,
|
||||
"no-switch-case-fall-through": true,
|
||||
"no-unnecessary-semicolons": true,
|
||||
"no-unused-expression": true,
|
||||
"no-use-before-declare": true,
|
||||
"no-with-statement": true,
|
||||
"semicolon": true,
|
||||
"trailing-comma": false,
|
||||
"typedef": false,
|
||||
"typedef-whitespace": false,
|
||||
"use-named-parameter": true,
|
||||
"variable-name": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
# vscode folder
|
||||
|
||||
## This folder contains Visual Studio Code settings files for expected desired local configuration
|
||||
|
||||
Copying the launch.json from this folder to the .vscode folder will enable debugging of unit tests
|
||||
|
||||
Copying the settings.json from this folder to the .vscode folder will hide folders from the solution explorer
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
{
|
||||
/**
|
||||
* Install Chrome Debugger Extension for Visual Studio Code to debug your components with the
|
||||
* Chrome browser: https://aka.ms/spfx-debugger-extensions
|
||||
*/
|
||||
"version": "0.2.0",
|
||||
"configurations": [{
|
||||
"name": "Local workbench",
|
||||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"url": "https://localhost:4321/temp/workbench.html",
|
||||
"webRoot": "${workspaceRoot}",
|
||||
"sourceMaps": true,
|
||||
"sourceMapPathOverrides": {
|
||||
"webpack:///.././src/*": "${webRoot}/src/*",
|
||||
"webpack:///../../../src/*": "${webRoot}/src/*",
|
||||
"webpack:///../../../../src/*": "${webRoot}/src/*",
|
||||
"webpack:///../../../../../src/*": "${webRoot}/src/*"
|
||||
},
|
||||
"runtimeArgs": [
|
||||
"--remote-debugging-port=9222"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Hosted workbench",
|
||||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"url": "https://enter-your-SharePoint-site/_layouts/workbench.aspx",
|
||||
"webRoot": "${workspaceRoot}",
|
||||
"sourceMaps": true,
|
||||
"sourceMapPathOverrides": {
|
||||
"webpack:///.././src/*": "${webRoot}/src/*",
|
||||
"webpack:///../../../src/*": "${webRoot}/src/*",
|
||||
"webpack:///../../../../src/*": "${webRoot}/src/*",
|
||||
"webpack:///../../../../../src/*": "${webRoot}/src/*"
|
||||
},
|
||||
"runtimeArgs": [
|
||||
"--remote-debugging-port=9222",
|
||||
"-incognito"
|
||||
]
|
||||
},
|
||||
//https://github.com/Microsoft/vscode-recipes/tree/master/debugging-jest-tests
|
||||
//https://github.com/facebook/jest/issues/1652
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Jest All",
|
||||
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
|
||||
"args": ["--runInBand"],
|
||||
"console": "integratedTerminal",
|
||||
"internalConsoleOptions": "neverOpen"
|
||||
},
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Jest Watch",
|
||||
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
|
||||
"args": ["--runInBand","--watch"], // jest --watch #runs jest -o by default
|
||||
"console": "integratedTerminal",
|
||||
"internalConsoleOptions": "neverOpen"
|
||||
},
|
||||
{
|
||||
//https://facebook.github.io/jest/docs/en/cli.html
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Jest Watch All",
|
||||
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
|
||||
"args": ["--runInBand","--watchAll"],
|
||||
"console": "integratedTerminal",
|
||||
"internalConsoleOptions": "neverOpen"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
// Place your settings in this file to overwrite default and user settings.
|
||||
{
|
||||
// Configure glob patterns for excluding files and folders in the file explorer.
|
||||
"files.exclude": {
|
||||
"**/.git": true,
|
||||
"**/.DS_Store": true,
|
||||
"**/bower_components": true,
|
||||
"**/coverage": true,
|
||||
"**/lib-amd": true,
|
||||
"src/**/*.scss.ts": true,
|
||||
"node_modules": true,
|
||||
"jest": true,
|
||||
"dist": true,
|
||||
"lib": true,
|
||||
"temp": true
|
||||
},
|
||||
"typescript.tsdk": ".\\node_modules\\typescript\\lib"
|
||||
}
|
Loading…
Reference in New Issue