Skip to content

Instantly share code, notes, and snippets.

2024-02-19 14:58:43 OpenVPN 2.6.8 arm-apple-darwin [SSL (OpenSSL)] [LZO] [PKCS11] [MH/RECVDA] [AEAD]
2024-02-19 14:58:43 library versions: OpenSSL 3.2.0 23 Nov 2023, LZO 2.10
2024-02-19 14:58:43 NOTE: the current --script-security setting may allow this configuration to call user-defined scripts
2024-02-19 14:58:43 TCP/UDP: Preserving recently used remote address: [AF_INET]35.71.159.181:15790
2024-02-19 14:58:43 UDPv4 link local: (not bound)
2024-02-19 14:58:43 UDPv4 link remote: [AF_INET]35.71.159.181:15790
2024-02-19 14:58:47 Server poll timeout, restarting
2024-02-19 14:58:47 SIGUSR1[soft,server_poll] received, process restarting
2024-02-19 14:58:47 NOTE: the current --script-security setting may allow this configuration to call user-defined scripts
2024-02-19 14:58:47 TCP/UDP: Preserving recently used remote address: [AF_INET]52.223.29.195:15790
/* eslint-disable no-console */
/* eslint-disable prefer-arrow-callback */
import expect from 'expect';
import { createTestClient } from 'apollo-server-testing';
import ggl from 'graphql-tag';
import config from '../../../config';
import { createServer } from '../../../src/server';
describe('GET /v2/invoices/{id}.html specs', function () {
describe('de', function () {
before(function () {
// call API and store response..
});
it('should return correct html', function () {
expect(beautify(this.response.payload)).toMatchSnapshot(this);
});
});
export const makeTestTitle = test => {
let next = test;
const title = [];
for (;;) {
if (!next.parent) {
break;
}
title.push(next.title);
expect.extend({
toMatchSnapshot(ctx) {
if (!ctx || !ctx.test) {
throw new Error(
dedent(`missing \`ctx\` parameter for .toMatchSnapshot(),
did you forget to pass \`this\` expect().toMatchSnapshot(this)?`),
);
}
const { test } = ctx;
expect.extend({
toMatchSnapshot() {
// TODO: init testFile, testTitle
const result = toMatchSnapshot(this.actual, testFile, testTitle);
expect.assert(result.pass, !result.pass ? result.report() : '');
return this;
}
import { SnapshotState, toMatchSnapshot } from ‘jest-snapshot’;
export function toMatchSnapshot(actual, testFile, testTitle) {
// Intilize the SnapshotState, it’s responsible for actually matching
 // actual snapshot with expected one and storing results to `__snapshots__` folder
 const snapshotState = new SnapshotState(testFile, {
  updateSnapshot: process.env.SNAPSHOT_UPDATE ? ‘all’ : ‘new’,
 });
// Bind the `toMatchSnapshot` to the object with snapshotState and
expect(response).toMatchSnapshot();
expect(response.data.headline).toEqual(‘Document #12–1332–11’);
expect(response.data.address.city).toEqual(‘Berlin’);
expect(response.data[0].line[0].total).toEqual(101);
expect(response.data[0].line[1].total).toEqual(102);
expect(response.data[0].line[2].total).toEqual(103);
expect(response.data[0].line[3].total).toEqual(104);
expect(response.data[1].line[0].total).toEqual(105);
expect(response.data[1].line[1].total).toEqual(106);
expect(response.data[1].line[2].total).toEqual(107);
expect(response.data[1].line[3].total).toEqual(108);
@alexbeletsky
alexbeletsky / get_invoices_html.js
Created January 19, 2018 15:39
get_invoices_html.js
/* eslint prefer-arrow-callback: 0 */
import expect from 'expect';
import moment from 'moment';
import timekeeper from 'timekeeper';
import beautify from 'js-beautify';
import * as apiUtils from '../../../helpers/api';
import * as serverUtils from '../../../helpers/server';
import * as mongoUtils from '../../../helpers/mongo';