Skip to content

Instantly share code, notes, and snippets.

@zt4ff
zt4ff / Table.tsx
Created August 31, 2024 01:10
Rows Selection for ka-table - single selection or multi
import "ka-table/style.css";
import React, { useState } from "react";
import { ITableProps, kaReducer, Table as KaTable } from "ka-table";
import { DataType, EditingMode, SortingMode } from "ka-table/enums";
import { DispatchFunc } from "ka-table/types";
import {
selectRow,
deselectRow,

Software testing is an integral part of software development and quality assurance. Testing can help us write better and quality code, spot ambiguities early, catch regression, refactor with confidence and also deploy to production while enjoying a cup of coffee .

https://media.giphy.com/media/dGhlifOCTtSdW/giphy.gif

We need to have a structured test with test cases that verify different behaviours of our application. Mocha is a JavaScript framework that organizes our test cases and runs them for us. Although Mocha will not verify our tests behaviours, we are going to make use of Nodejs assert library to verify our test behaviours.

Introduction to NodeJS Module

NodeJS is a runtime environment built on Chrome’s V8 engine that enables us to write and run JavaScript outside a web browser. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run a

// index.js
let counter = 0;
const generateId = () => {/* */};
class StudentManagement {
constructor() {}
add(...students) {
students.forEach((student) => {
// index.js
let counter = 0
const generateId = () => {/* */}
class StudentManagement {
constructor(students) {/* */}
add(student) {
this.#students.push({
$ npm init -y
// index.js
let counter = 0;
const generateId = () => {
counter++;
return counter;
};
class StudentManagement {
#students = []
$ cd students-manager
$ mkdir students-manager
const path = require("path")
const extension = path.extname(process.argv[1])
console.log(extension)
npm test