Skip to content

Commit

Permalink
add noop for global.gc when not available
Browse files Browse the repository at this point in the history
  • Loading branch information
corymickelson committed Jun 7, 2018
1 parent 12de427 commit 61dc7c0
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 9 deletions.
7 changes: 5 additions & 2 deletions spec/unit/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import {join} from 'path'
import * as tap from 'tape'
import {Test} from 'tape'
import {NPDFVersion, IDocument, npdf, NPDFPageMode} from '../../dist';

if(!global.gc) {
global.gc = () => {}
}
const filePath = join(__dirname, '../test-documents/test.pdf'),
pwdDoc = join(__dirname, '../test-documents/pwd.pdf')

Expand Down Expand Up @@ -57,7 +59,8 @@ tap('IDocument', (t: Test) => {
t.assert(docFont.getMetrics().fontSize > 0)
global.gc()
t.assert(doc.getPageCount() === 3)
let font = doc.createFont({italic: true, embed: false, fontName: 'serif'})
t.comment('create font')
let font = doc.createFont({italic: true, embed: false, fontName: 'Arial'})

global.gc()
t.assert(font.getMetrics().fontSize === 12, 'Default font size is 12')
Expand Down
4 changes: 3 additions & 1 deletion spec/unit/field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import {join} from 'path'
import * as tap from 'tape'
import {npdf, ICheckBox, IComboBox, IField, ITextField, NPDFFieldType} from '../../dist'
import {unlinkSync} from "fs";

if(!global.gc) {
global.gc = () => {}
}
const filePath = join(__dirname, '../test-documents/iss.16.checkbox-field-state-options.pdf')
tap('IField', t => {
const doc = new npdf.Document()
Expand Down
4 changes: 3 additions & 1 deletion spec/unit/form.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import {join} from 'path'
import * as tap from 'tape'
import { NPDFName as name, npdf, NPDFFontEncoding, IDictionary, IObj} from '../../dist';

if(!global.gc) {
global.gc = () => {}
}
const filePath = join(__dirname, '../test-documents/test.pdf')

tap('NPDF Form Accessors and Methods', standard => {
Expand Down
4 changes: 3 additions & 1 deletion spec/unit/object.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import {IDocument, npdf} from '../../dist'
import * as test from 'tape'
import {join} from 'path';

if(!global.gc) {
global.gc = () => {}
}
test('document objects instance of nopodofo.Obj', t => {
const filePath = join(__dirname, '../test-documents/test.pdf'),
doc = new npdf.Document()
Expand Down
4 changes: 3 additions & 1 deletion spec/unit/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { existsSync, unlinkSync, writeFile } from 'fs'
import { join } from 'path'
import * as test from 'tape'
import { IObj, IPage, npdf } from "../../dist";

if(!global.gc) {
global.gc = () => {}
}
const filePath = join(__dirname, '../test-documents/test.pdf'),
outFile = './test.out.pdf',
doc = new npdf.Document()
Expand Down
4 changes: 3 additions & 1 deletion spec/unit/painter.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import {npdf, CONVERSION, IPainter, NPDFFontEncoding, Cell, Table} from '../../dist'
import * as tap from 'tape'
import {join} from 'path';

if(!global.gc) {
global.gc = () => {}
}
const filePath = join(__dirname, '../test-documents/test.pdf'),
outFile = '/tmp/painter.out.pdf',
doc = new npdf.Document()
Expand Down
4 changes: 3 additions & 1 deletion spec/unit/parser.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import {join} from 'path';
import { npdf, IContentsTokenizer} from '../../dist';
import * as test from 'tape'

if(!global.gc) {
global.gc = () => {}
}
test('get contents as string, contents tokenizer', t => {

const filePath = join(__dirname, '../test-documents/test.pdf'),
Expand Down
4 changes: 3 additions & 1 deletion spec/unit/signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import * as tap from 'tape'
import {join} from 'path'
import {IField, signature, IForm, NPDFAnnotation, NPDFAnnotationFlag, npdf} from "../../dist";


if(!global.gc) {
global.gc = () => {}
}
tap('Signer', sub => {
const doc = new npdf.Document()
doc.load(join(__dirname, '../test-documents/test.pdf'), {forUpdate: true}, async e => {
Expand Down

0 comments on commit 61dc7c0

Please sign in to comment.