Skip to content

Instantly share code, notes, and snippets.

node_modules
packageA
packageB (symlinked)
node_modules
typeorm x.y.z (1)
typeorm x.y.z (2)
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"
/**
* functions.auth.user().onCreate is triggered when
* 1. register via email/password
* 2. first logIn via 3rd party auth providers (Facebook, Google, etc)
* 3. developer creates new account via Firebase Admin SDK
* 4. first logIn as anonymousUser
*
* What this functions does is that when onCreate method is triggered,
* we create `newUser` with necessary information including uid or displayName from given user
* And then save it in our database
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"
};