Skip to content

Instantly share code, notes, and snippets.

View crookse's full-sized avatar

Eric Crooks crookse

View GitHub Profile
@crookse
crookse / ddd.md
Created September 21, 2018 19:24 — forked from zsup/ddd.md
Documentation-Driven Development (DDD)
View ddd.md

Documentation-Driven Development

The philosophy behind Documentation-Driven Development is a simple: from the perspective of a user, if a feature is not documented, then it doesn't exist, and if a feature is documented incorrectly, then it's broken.

  • Document the feature first. Figure out how you're going to describe the feature to users; if it's not documented, it doesn't exist. Documentation is the best way to define a feature in a user's eyes.
  • Whenever possible, documentation should be reviewed by users (community or Spark Elite) before any development begins.
  • Once documentation has been written, development should commence, and test-driven development is preferred.
  • Unit tests should be written that test the features as described by the documentation. If the functionality ever comes out of alignment with the documentation, tests should fail.
  • When a feature is being modified, it should be modified documentation-first.
  • When documentation is modified, so should be the tests.
@crookse
crookse / tester.ts
Last active November 22, 2019 11:18
Deno Unit Test Naming: tester.ts
View tester.ts
import { runTests, test } from "https://deno.land/std/testing/mod.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
export default {
assertEquals,
runTests,
test
}
@crookse
crookse / deno_std_test.ts
Created November 22, 2019 11:27
Deno Standard Modules - Testing: Basic Usage
View deno_std_test.ts
import { runTests, test } from "https://deno.land/std/testing/mod.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
// Write a named test where the "name" field's value is the name of the test
// (The name of this test is "testing example")
test({
name: "testing example",
fn(): void {
assertEquals("world", "world");
assertEquals({ hello: "world" }, { hello: "world" });
@crookse
crookse / deno_std_test_intuitive.ts
Created November 22, 2019 11:58
Deno Unit Testing - Named test without the name field
View deno_std_test_intuitive.ts
test("name of my test", () => {
let actual = new MyClass();
assertEquals(actual.hello(), "world");
});
@crookse
crookse / test.ts
Last active November 22, 2019 15:33
Deno Unit Testing - imports
View test.ts
import { runTests, test } from "https://deno.land/std/testing/mod.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
@crookse
crookse / test.ts
Last active November 23, 2019 01:18
Deno Unit Testing - imports, namedTest
View test.ts
import { runTests, test } from "https://deno.land/std/testing/mod.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
function namedTest(nameOfTest: string, testToRun: any): void {
return test({
name: nameOfTest,
fn(): void {
testToRun();
}
});
@crookse
crookse / test.ts
Created November 23, 2019 01:25
Deno Unit Testing - imports, namedTest as test
View test.ts
import * as testing from "https://deno.land/std/testing/mod.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
function test(nameOfTest: string, testToRun: any): void {
return testing.test({
name: nameOfTest,
fn(): void {
testToRun();
}
});
@crookse
crookse / test.ts
Created November 23, 2019 01:34
Deno Unit Testing - imports, test, test()
View test.ts
import * as testing from "https://deno.land/std/testing/mod.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
function test(nameOfTest: string, testToRun: any): void {
return testing.test({
name: nameOfTest,
fn(): void {
testToRun();
}
});
@crookse
crookse / test.ts
Created November 23, 2019 01:36
Deno Unit Testing - imports, test, test(), runTests
View test.ts
import * as testing from "https://deno.land/std/testing/mod.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
function test(nameOfTest: string, testToRun: any): void {
return testing.test({
name: nameOfTest,
fn(): void {
testToRun();
}
});
@crookse
crookse / webpack.config.js
Last active November 28, 2019 06:56
Vue: Automate Your Routing - webpack.config.js
View webpack.config.js
const webpack = require("webpack");
const path = require("path");
const VueLoaderPlugin = require("vue-loader/lib/plugin");
module.exports = {
entry: path.resolve(__dirname, "assets/bundle.js"),
mode: "development",
output: {
path: path.resolve(__dirname, "assets/"),
filename: "bundle.compiled.js"