Skip to content

Instantly share code, notes, and snippets.

View linuxsimba's full-sized avatar

Linux Simba linuxsimba

View GitHub Profile
@linuxsimba
linuxsimba / src_tests_setup.ts
Last active February 25, 2021 08:52
setup.ts file for karma testing NG10/NS7
/* eslint-disable @typescript-eslint/restrict-template-expressions */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable no-console */
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* PATH /src/tests/setup.ts */
@linuxsimba
linuxsimba / src_tests_test.component.spec.ts
Last active February 25, 2021 08:51
NG10/NG7 unit testing component unit test example
import { Component } from '@angular/core';
import { TestBed } from '@angular/core/testing';
import { customNsTestBedAfterEach, customNsTestBedBeforeEach } from './setup';
@Component({
selector: 'test-comp',
template: '' // template is blank, because code does not have NO_ERRORS_SCHEMA and also we don't care. only testing functions in component
})
class TestComponent{
hello(): string { return 'hello'; }
@linuxsimba
linuxsimba / karma.conf.js
Created February 25, 2021 08:34
NG10/NS7 unit test karma.conf.js
module.exports = function (config) {
const options = {
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: [ 'jasmine' ],
@linuxsimba
linuxsimba / _src_tests_test.service.spec.ts
Created February 25, 2021 08:47
NG10/NS7 Test Service unit test
import { customNsTestBedAfterEach, customNsTestBedBeforeEach } from './setup';
import { Injectable } from '@angular/core';
import { TestBed } from '@angular/core/testing';
@Injectable({
providedIn: 'root'
})
export class TestService {
hello(): string {
@linuxsimba
linuxsimba / appspace-user-consent.ps1
Last active June 28, 2021 23:57
user-consent-using-powershell.md (appspace)
@linuxsimba
linuxsimba / chocolatey.ps1
Last active December 1, 2022 03:38 — forked from mcasperson/chocolatey.ps1
Chocolatey install
Set-ExecutionPolicy Bypass -Scope Process -Force
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))