Skip to content

Instantly share code, notes, and snippets.

node_modules
packageA
packageB
typeorm x.y.z
packageA
peerDependency: typeorm >= x.y.z
packageB
dependency: typeorm x.y.z
@leejh3224
leejh3224 / main.go
Last active June 7, 2020 06:37
generate go struct from database and add json tag for each struct
package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"os/exec"
"path"
"path/filepath"
import sys
import os
import fnmatch
from PIL import Image
imageSource = os.path.join(
"C:\\", "Users", "stern", "Google 드라이브", "기타", "Goodnotes4Export"
)
outputPath = os.path.join(
"C:\\", "Users", "stern", "Google 드라이브", "기타", "output"
it("should test `onUserCreate`", async () => {
const wrapped = testEnv.wrap(api.onUserCreate);
const testUser = {
uid: "122",
displayName: "lee"
};
await wrapped(testUser);
// generate user returns newUser object below
import functions from "firebase-functions-test";
import * as admin from "firebase-admin";
import { generateNewUser } from "../lib";
const testEnv = functions();
/**
* mock setup
*/
const mockSet = jest.fn();
describe("my functions", () => {
let adminStub, api;
beforeAll(() => {
// you can use `sinon.stub` instead
adminStub = jest.spyOn(admin, "initializeApp");
// after initializeApp call, we load our functions
api = require("../index");
});
import functions from "firebase-functions-test";
import * as admin from "firebase-admin";
import * as path from "path";
// you can check all these information in firebase console/settings
const projectConfig = {
projectId: "projectId",
databaseURL: "databaseURL"
};
// this config includes typescript specific settings
// and if you're not using typescript, you should remove `transform` property
module.exports = {
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
testRegex: 'src(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$',
testPathIgnorePatterns: ['lib/', 'node_modules/'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
testEnvironment: 'node',