Web Developer

Author: zero2full

Angular Unit Test: not use mock data in configureTestingModule because of @Component.providers: [Service]

Agnular unit test (standalone component), mock service in configureTestingmodule is set up, however, when running unit test, the mock service is not used, but using the real service instantiation, and one of the possible reasons is that the service is injected in the component level, like:   Codes: @Component({ selector: ‘group-details’, standalone: true, imports: […],

Transloco (Angular)

Documentation: https://jsverse.gitbook.io/transloco Example to use nest function in json file

FATAL ERROR: Reached heap limit Allocation failed – JavaScript heap out of memory

When npm run build, this error happens, you can run this command to temporally fix this issue. Run command: export NODE_OPTIONS=”–max-old-space-size=8192″ Reference:

Unit test for signal output<T>()

Angular 16 introduces Signals, and this example is to show how to unit test Signal output<T>().

Python Leaning Notes #2

General functions String Methods in operatoer Math operators math module Condition statement Logic operators Comparison operators while loop

Python coding notes part one.

Expression : can multiply with * or divide with /   Variable : Any word the is not a key word and can be assigned an integer, float, string, and boolean and can store code to make it shorter. Tip : To be more efficient, make the variable meaningful or related to the code.

Python Leaning Notes #1

General Internal Functions Variable type String Manipulation

Node.JS Section 3: Module System

https://links.mead.io/nodecourse first import functions and assign it to an variable: const fs = require(‘fs’); functions: fs.writeFileSync(path, data) fs.appendFileSync(path, data) using npm packages: npm init : to initialize npm npm install packageName npm package: nodemon, which is like ng serve to monitor the changes of the code instantly.

Node.JS Section 1: Introduction

command: node -v: to check node.js version command: node, to set up one working place node.js doesn’t have window, document, however, it has global and process to exit the working place, run: process.exit()

SASS Section 9 – Function

you can create your own function in sass with @function funName(arg1, arg2, …) {}, if you want to call function, just funName(arg1, arg2, …); it looks like the same as @mixin(){}, @mixin seems focus on manipulate css properties, and also when you want to call them, you have to use @include mixinName(arg1, arg2,…)