Skip to content

Instantly share code, notes, and snippets.

@ng-the-engineer
ng-the-engineer / header.css
Created April 22, 2021 07:23
Code snippet for CV
.cv-name {
color: #40739e;
font-family: "Tinos", serif;
font-size: 35px;
}
.grid-container {
display: grid;
padding: 0 0;
}
.container-column-2 {
grid-template-columns: 50% 50%;
}
@ng-the-engineer
ng-the-engineer / data.spec.ts
Created January 24, 2021 04:42
Code snippet - mocked response
const mockedResponse: AxiosResponse = {
data: {
name: "Henry",
},
status: 200,
statusText: "OK",
headers: {},
config: {},
};
@ng-the-engineer
ng-the-engineer / data.ts
Created January 19, 2021 21:43
Code snipper: replace data.ts
import axios from "axios";
export const fetch = async () =>
await axios.get("https://api.spacexdata.com/v4/launches/latest");
@ng-the-engineer
ng-the-engineer / data.ts
Created January 19, 2021 21:24
Code snipper: data.ts
export const fetch = async () => {
const result = '';
return result;
};
@ng-the-engineer
ng-the-engineer / data.test.ts
Last active January 19, 2021 21:42
Code snipper: data.test.ts
import { fetch } from "./data";
it("returns name successfully", async () => {
const actual = await fetch();
expect(actual.data.name).toBe("Turksat 5A");
});
@ng-the-engineer
ng-the-engineer / README.md
Created January 17, 2021 17:03
Code snippet: Jest with duplicated tests
PASS build/dummy.test.js
PASS source/dummy.test.ts
Test Suites: 2 passed, 2 total
Tests: 2 passed, 2 total
Snapshots: 0 total
Time: 2.009 s
Ran all test suites.
@ng-the-engineer
ng-the-engineer / jest.config.js
Created January 17, 2021 17:02
Code snippet: Jest config with modulePathIgnorePatterns
module.exports = {
// skipped other properties
modulePathIgnorePatterns: [
"<rootDir>/build/"
]
};
@ng-the-engineer
ng-the-engineer / jest.config.js
Created January 17, 2021 17:00
Code snippet: Jest config with roots
module.exports = {
// skipped other properties
roots: [
'<rootDir>/source/' // pointing to tests directory
]
};
@ng-the-engineer
ng-the-engineer / README.md
Last active January 17, 2021 16:58
Code snippet: Test passed
➜  jest-with-typescript git:(main) ✗ npx jest
 PASS  source/dummy.test.ts
  ✓ Dummy unit test (1 ms)
Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        0.526 s, estimated 2 s
Ran all test suites.