Skip to content

Instantly share code, notes, and snippets.

View jsdecena's full-sized avatar
👑
Focusing

Jeff Decena jsdecena

👑
Focusing
View GitHub Profile
@jsdecena
jsdecena / simpletdd.php
Created October 9, 2021 04:04
Simple TDD config file
<?php
return [
'timezone' => env('APP_TIMEZONE', 'Asia/Manila')
];
@jsdecena
jsdecena / TestCase.php
Last active October 9, 2021 04:01
Simple TDD Base Testcase
<?php
namespace Jsdecena\Simpletdd\Tests;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Application;
abstract class TestCase extends \Orchestra\Testbench\TestCase
{
use DatabaseMigrations;
@jsdecena
jsdecena / ServiceProvider.php
Created October 9, 2021 03:54
Service Provider
<?php
namespace Jsdecena\SimpleTdd\Tests;
class ServiceProvider extends \Illuminate\Support\ServiceProvider
{
/**
* Perform post-registration booting of services.
*
* @return void
@jsdecena
jsdecena / inquire-balance.php
Created February 15, 2021 05:34
Laravel Rule
<?php
// ================================ Current METHOD ==================================== //
/**
* Balance inquiry
*
* @param Request $request
* @return array|JsonResponse
* @throws Exception
@jsdecena
jsdecena / adonis-test.js
Created July 5, 2020 07:41
Simple TDD in Nodejs
info: serving app on http://127.0.0.1:4000
Database migrated successfully in 118 ms
User unit test
✓ it can make a user (114ms)
PASSED
total : 1
passed : 1
@jsdecena
jsdecena / vowfile.js
Created July 5, 2020 07:37
Simple TDD in Nodejs
'use strict'
/*
|--------------------------------------------------------------------------
| Vow file
|--------------------------------------------------------------------------
|
| The vow file is loaded before running your tests. This is the best place
| to hook operations `before` and `after` running the tests.
|
@jsdecena
jsdecena / error.js
Created July 5, 2020 07:28
Simple TDD in NodeJS
info: serving app on http://127.0.0.1:4000
User unit test
✖ it can make a user (202ms)
ERRORS
1. it can make a user
Error: SQLITE_ERROR: no such table: users
@jsdecena
jsdecena / database.js
Created July 5, 2020 07:24
Simple TDD in Nodejs database.js
'use strict'
/** @type {import('@adonisjs/framework/src/Env')} */
const Env = use('Env')
/** @type {import('@adonisjs/ignitor/src/Helpers')} */
const Helpers = use('Helpers')
module.exports = {
/*
@jsdecena
jsdecena / error.js
Created July 5, 2020 07:23
Simple TDD in Nodejs error
Knex: run
$ npm install sqlite3 --save
Error: Cannot find module 'sqlite3'
Require stack:
- /home/jsdecena/codes/adonis/node_modules/knex/lib/dialects/sqlite3/index.js
- /home/jsdecena/codes/adonis/node_modules/knex/lib/index.js
@jsdecena
jsdecena / user.spec.js
Last active July 5, 2020 07:20
User create spec
'use strict'
const User = make('App/Models/User')
const { test } = use('Test/Suite')('User unit test')
test('it can make a user', async ({ assert }) => {
const data = {
username: 'johndoe',