fix(core): update
This commit is contained in:
111
test/test.nonci.ts
Normal file
111
test/test.nonci.ts
Normal file
@ -0,0 +1,111 @@
|
||||
import { expect, tap } from '@pushrocks/tapbundle';
|
||||
import * as letterxpress from '../ts/index.js';
|
||||
import * as tsclass from '@tsclass/tsclass';
|
||||
|
||||
import { Qenv } from '@pushrocks/qenv';
|
||||
let testQenv = new Qenv('./', './.nogit/');
|
||||
|
||||
let testAccount: letterxpress.LetterXpressAccount;
|
||||
let testLetter: tsclass.business.ILetter;
|
||||
|
||||
tap.test('should create a valid account', async () => {
|
||||
testAccount = await letterxpress.LetterXpressAccount.createAndInit({
|
||||
apiKey: testQenv.getEnvVarOnDemand('API_TOKEN'),
|
||||
username: testQenv.getEnvVarOnDemand('API_USERNAME'),
|
||||
});
|
||||
expect(testAccount).toBeInstanceOf(letterxpress.LetterXpressAccount);
|
||||
});
|
||||
|
||||
tap.test('should send an actual letter', async () => {
|
||||
testLetter = {
|
||||
from: {
|
||||
name: 'Lossless GmbH',
|
||||
type: 'company',
|
||||
description: 'a company',
|
||||
sepaConnection: {
|
||||
iban: 'NL83 BUNQ 2035 5639 41',
|
||||
bic: 'BUNQNL2AXXX',
|
||||
},
|
||||
address: {
|
||||
name: 'default',
|
||||
city: 'Bremen',
|
||||
country: 'Germany',
|
||||
postalCode: '28359',
|
||||
houseNumber: '5',
|
||||
streetName: 'Karl-Ferdinand-Braun-Str.',
|
||||
},
|
||||
},
|
||||
to: {
|
||||
name: 'Lossless GmbH',
|
||||
type: 'company',
|
||||
description: 'a company',
|
||||
address: {
|
||||
city: 'Bremen',
|
||||
country: 'Germany',
|
||||
postalCode: '28359',
|
||||
streetName: 'Karl-Ferdinand-Braun-Str.',
|
||||
houseNumber: '5',
|
||||
},
|
||||
},
|
||||
incidenceId: 'abc123',
|
||||
legalContact: {
|
||||
type: 'company',
|
||||
salutation: null,
|
||||
surname: null,
|
||||
title: null,
|
||||
address: {
|
||||
city: 'Bremen',
|
||||
country: 'Germany',
|
||||
name: 'Lossless GmbH',
|
||||
postalCode: '28359',
|
||||
streetName: 'Karl-Ferdinand-Braun-Str.',
|
||||
houseNumber: '5',
|
||||
},
|
||||
sepaConnection: {
|
||||
iban: 'NL83 BUNQ 2035 5639 41',
|
||||
bic: 'BUNQNL2AXXX',
|
||||
},
|
||||
customerNumber: null,
|
||||
description: null,
|
||||
email: 'hello@lossless.com',
|
||||
fax: '+49 421 408951 46',
|
||||
phone: '+49 421 16767 548',
|
||||
legalEntity: 'Lossless GmbH',
|
||||
name: 'Lossless GmbH',
|
||||
vatId: 'DE293580420',
|
||||
},
|
||||
subject: 'General Terms - Update',
|
||||
text: [
|
||||
`
|
||||
To whome it may concern,
|
||||
|
||||
**this is a testmessage.** we write to inform you about a change in our General Terms.
|
||||
As of December 1st 2019 we will start storing IPs that connect to our app for a period of 3 month.
|
||||
|
||||
Regards
|
||||
Lossless GmbH - Legal Department
|
||||
|
||||
`,
|
||||
],
|
||||
date: Date.now(),
|
||||
language: 'DE',
|
||||
logoUrl: '',
|
||||
needsCoverSheet: true,
|
||||
objectActions: [],
|
||||
pdfAttachments: [],
|
||||
timesheetData: null,
|
||||
};
|
||||
await testAccount.sendLetter(testLetter);
|
||||
});
|
||||
|
||||
tap.test('should be able to delete the sending job', async (toolsArg) => {
|
||||
await toolsArg.delayFor(3000);
|
||||
await testAccount.cancelLetter(testLetter);
|
||||
});
|
||||
|
||||
tap.test('should wrap things up', async () => {
|
||||
await testAccount.stop();
|
||||
console.log(testLetter);
|
||||
});
|
||||
|
||||
tap.start();
|
95
test/test.ts
95
test/test.ts
@ -1,95 +0,0 @@
|
||||
import { expect, tap } from '@pushrocks/tapbundle';
|
||||
import * as letterxpress from '../ts/index';
|
||||
|
||||
import * as smartletter from '@pushrocks/smartletter';
|
||||
const smartletterInstance = new smartletter.Smartletter();
|
||||
let testletter: smartletter.Letter;
|
||||
|
||||
|
||||
import { Qenv } from '@pushrocks/qenv';
|
||||
let testQenv = new Qenv('./', './.nogit/');
|
||||
|
||||
let testAccount: letterxpress.LetterXpressAccount;
|
||||
|
||||
tap.test('start things', async () => {
|
||||
await smartletterInstance.start();
|
||||
});
|
||||
|
||||
tap.test('should create a valid account', async () => {
|
||||
testAccount = new letterxpress.LetterXpressAccount({
|
||||
apiKey: testQenv.getEnvVarOnDemand('API_TOKEN'),
|
||||
username: testQenv.getEnvVarOnDemand('API_USERNAME')
|
||||
});
|
||||
expect(testAccount).to.be.instanceOf(letterxpress.LetterXpressAccount);
|
||||
});
|
||||
|
||||
tap.test('should send an actual letter', async () => {
|
||||
testletter = await smartletterInstance.createLetter({
|
||||
from: {
|
||||
name: 'Lossless GmbH',
|
||||
city: 'Bremen',
|
||||
country: 'Germany',
|
||||
postalCode: '28213',
|
||||
houseNumber: '16',
|
||||
streetName: 'Ottilie-Hoffmann-Str.'
|
||||
},
|
||||
to: {
|
||||
name: 'Lossless GmbH',
|
||||
city: 'Berlin',
|
||||
country: 'Germany',
|
||||
postalCode: '10245',
|
||||
houseNumber: '16a, Scanbox #06320',
|
||||
streetName: 'Ehrenbergstr.'
|
||||
},
|
||||
incidenceId: 'abc123',
|
||||
legalInfo: {
|
||||
name: 'Lossless GmbH',
|
||||
status: 'active',
|
||||
contact: {
|
||||
type: 'company',
|
||||
salutation: null,
|
||||
surname: null,
|
||||
title: null,
|
||||
address: {
|
||||
city: 'Bremen',
|
||||
country: 'Germany',
|
||||
houseNumber: '16',
|
||||
name: 'Lossless GmbH',
|
||||
postalCode: '28213',
|
||||
streetName: 'Ottilie-Hoffmann Str.'
|
||||
},
|
||||
bankAccountNumber: 'NL83 BUNQ 2035 5639 41',
|
||||
customerNumber: null,
|
||||
description: null,
|
||||
email: 'hello@lossless.com',
|
||||
fax: '+49 421 408951 46',
|
||||
phone: '+49 421 16767 548',
|
||||
legalEntity: 'Lossless GmbH',
|
||||
name: 'Lossless GmbH',
|
||||
vatId: 'DE293580420'
|
||||
},
|
||||
closedDate: null,
|
||||
foundedDate: null
|
||||
},
|
||||
subject: 'General Terms - Update',
|
||||
text: `<p>To whome it may concern,</p>
|
||||
<p>
|
||||
<strong>this is a testmessage.</strong> we write to inform you about a change in our General Terms.
|
||||
As of December 1st 2019 we will start storing IPs that connect to our app for a period of 3 month.
|
||||
<p>
|
||||
|
||||
Regards<br>
|
||||
Lossless GmbH - Legal Department`
|
||||
});
|
||||
await testAccount.sendLetter(testletter);
|
||||
});
|
||||
|
||||
tap.test('should be able to delete the sending job', async () => {
|
||||
await testAccount.cancelLetter(testletter);
|
||||
});
|
||||
|
||||
tap.test('should wrap things up', async () => {
|
||||
await smartletterInstance.stop();
|
||||
})
|
||||
|
||||
tap.start();
|
Reference in New Issue
Block a user