Skip to content

Instantly share code, notes, and snippets.

Avatar

Dawid Sibiński dsibinski

View GitHub Profile
View stryker.conf.json
{
"$schema": "./node_modules/@stryker-mutator/core/schema/stryker-schema.json",
"packageManager": "npm",
"reporters": [
"html",
"clear-text",
"progress"
],
"checkers": ["typescript"],
"tsconfigFile": "tsconfig.json",
View jest.config.js
module.exports = {
verbose: true,
preset: 'ts-jest',
testEnvironment: 'jsdom',
reporters: ["default"],
coverageReporters: ["text", "text-summary"],
collectCoverage: true
};
View jest.config_teamcity.js
module.exports = {
verbose: true,
preset: 'ts-jest',
testEnvironment: 'jsdom',
reporters: ["default", "jest-teamcity"]
};
View jest.config_init.js
module.exports = {
verbose: true,
preset: 'ts-jest',
testEnvironment: 'jsdom',
reporters: ["default"]
};
View jest_tests.ts
describe('FormIoJsonProcessor', () => {
describe('test getComponentsCount', () => {
it('should return correct components count for a form with 6 not nested components', () => {
let formIoJsonProcessor = new FormIoJsonProcessor();
expect(formIoJsonProcessor
.getRandomizableComponentsCount(formWith6NotNestedComponents))
.toBe(6);
})
it('should treat FieldSet and Columns as a single component when counting components', () => {
View services.ts
module.exports.StockService = function (rootUrl: string) {
this.rootUrl = rootUrl + "/Stock/";
};
module.exports.StockService.prototype.getStockInfo = function (articleId: Guid) {
let url = this.rootUrl + "Info";
return get(url, {
articleId: articleId
});
View services.js
module.exports.StockService = function (rootUrl) {
this.rootUrl = rootUrl + "/Stock/";
};
module.exports.StockService.prototype.getStockInfo = function (articleId) {
let url = this.rootUrl + "Info";
return get(url, {
articleId: articleId
});
View TypeScript_snippet.ts
import { Guid } from 'guid-typescript';
export interface PersonAvatarViewModel {
id: Guid;
name: string;
imageUrl: string;
}
View DiscountApplier.cs
public class DiscountApplier
{
public int GetDiscountPercentageValue(Product[] products)
{
var discountValue = 0;
if (products.Length == 1) {
return 0;
}
var allProductsQuantity = products.Sum(p => p.Quantity);