UNPKG

sql-code-generator

Version:

Generate code from your SQL schema and queries for type safety and development speed.

31 lines 1.7 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const getConfig_1 = require("./getConfig"); const readConfig_1 = require("./readConfig"); jest.mock('./readConfig'); const readConfigMock = readConfig_1.readConfig; describe('getConfig', () => { beforeEach(() => jest.clearAllMocks()); it('reads the config from a filepath', () => __awaiter(void 0, void 0, void 0, function* () { yield (0, getConfig_1.getConfig)({ configPath: '__CONFIG_PATH__' }); expect(readConfigMock).toHaveBeenCalledTimes(1); expect(readConfigMock).toHaveBeenCalledWith({ filePath: '__CONFIG_PATH__', }); })); it('returns the config', () => __awaiter(void 0, void 0, void 0, function* () { readConfigMock.mockResolvedValueOnce('__CONFIG_OBJECT__'); const result = yield (0, getConfig_1.getConfig)({ configPath: '__CONFIG_PATH__' }); expect(result).toEqual('__CONFIG_OBJECT__'); })); }); //# sourceMappingURL=getConfig.test.js.map