Skip to content

Commit

Permalink
Reorg tests
Browse files Browse the repository at this point in the history
  • Loading branch information
FiddlyDigital committed Jul 6, 2023
1 parent af93fb1 commit f370dd4
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Anonimizer, Feature, IAnonimizer } from "../src";
import { Anonimizer, Feature, IAnonimizer } from "../../src";
let anonimizer: IAnonimizer;

beforeAll(() => {
Expand Down
72 changes: 36 additions & 36 deletions tests/index.test.ts → tests/general/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
import { Anonimizer, Feature, IAnonimizer } from "../src";
let anonimizer: IAnonimizer;

beforeAll(() => {
anonimizer = new Anonimizer();
});

describe('Test Anomization and Rehydration', () => {
test('When using the same input, Anonomisation then rehydrations should produce the exact same text.', () => {
const originalInput = "Write an email to Jim, asking them to email Philip at [email protected] to call Maria about getting that PO sorted. Also ask about the progress of the #Acquisition Deal.";
const featuresToReplace = new Array(Feature.People, Feature.Emails, Feature.Urls, Feature.HashTags);
let [safeText, runValueMap] = anonimizer.anonimize(originalInput, featuresToReplace);
expect(safeText != originalInput);

let rehydratedText = anonimizer.reHydrate(safeText, runValueMap);
expect(safeText != rehydratedText);
expect(originalInput == rehydratedText);
});

test('PromptResponse Rehydration post prompt anonimisation', () => {
const originalInput = "Write an email to Jim, asking them to email Philip at [email protected] to call Maria about getting that PO sorted. Also ask about the progress of the #Acquisition Deal.";
const featuresToReplace = new Array(Feature.People, Feature.Emails, Feature.Urls, Feature.HashTags);
let [safeText, runValueMap] = anonimizer.anonimize(originalInput, featuresToReplace);
expect(safeText != originalInput);

const promptResponse = `Dear Ava,
I hope this email finds you well. I have an important request on behalf of Charlotte from our team. Charlotte would greatly appreciate it if you could reach out to Benjamin at [email protected] and ask him to call her regarding the Purchase Order (PO) that needs to be sorted urgently.
Additionally, Charlotte would like to inquire about the progress and any updates regarding the #Alligator Deal. She would like to stay informed and ensure everything is on track.
Best Regards,`
let rehydratedText = anonimizer.reHydrate(promptResponse, runValueMap);
expect(rehydratedText === `Dear Jim,
I hope this email finds you well. I have an important request on behalf of Maria from our team. Maria would greatly appreciate it if you could reach out to Philip at [email protected] and ask him to call her regarding the Purchase Order (PO) that needs to be sorted urgently.
Additionally, Maria would like to inquire about the progress and any updates regarding the #Acquisition Deal. She would like to stay informed and ensure everything is on track.
Best Regards,`);
})
});
import { Anonimizer, Feature, IAnonimizer } from "../../src";
let anonimizer: IAnonimizer;

beforeAll(() => {
anonimizer = new Anonimizer();
});

describe('Test Anomization and Rehydration', () => {
test('When using the same input, Anonomisation then rehydrations should produce the exact same text.', () => {
const originalInput = "Write an email to Jim, asking them to email Philip at [email protected] to call Maria about getting that PO sorted. Also ask about the progress of the #Acquisition Deal.";
const featuresToReplace = new Array(Feature.People, Feature.Emails, Feature.Urls, Feature.HashTags);
let [safeText, runValueMap] = anonimizer.anonimize(originalInput, featuresToReplace);
expect(safeText != originalInput);

let rehydratedText = anonimizer.reHydrate(safeText, runValueMap);
expect(safeText != rehydratedText);
expect(originalInput == rehydratedText);
});

test('PromptResponse Rehydration post prompt anonimisation', () => {
const originalInput = "Write an email to Jim, asking them to email Philip at [email protected] to call Maria about getting that PO sorted. Also ask about the progress of the #Acquisition Deal.";
const featuresToReplace = new Array(Feature.People, Feature.Emails, Feature.Urls, Feature.HashTags);
let [safeText, runValueMap] = anonimizer.anonimize(originalInput, featuresToReplace);
expect(safeText != originalInput);

const promptResponse = `Dear Ava,
I hope this email finds you well. I have an important request on behalf of Charlotte from our team. Charlotte would greatly appreciate it if you could reach out to Benjamin at [email protected] and ask him to call her regarding the Purchase Order (PO) that needs to be sorted urgently.
Additionally, Charlotte would like to inquire about the progress and any updates regarding the #Alligator Deal. She would like to stay informed and ensure everything is on track.
Best Regards,`
let rehydratedText = anonimizer.reHydrate(promptResponse, runValueMap);
expect(rehydratedText === `Dear Jim,
I hope this email finds you well. I have an important request on behalf of Maria from our team. Maria would greatly appreciate it if you could reach out to Philip at [email protected] and ask him to call her regarding the Purchase Order (PO) that needs to be sorted urgently.
Additionally, Maria would like to inquire about the progress and any updates regarding the #Acquisition Deal. She would like to stay informed and ensure everything is on track.
Best Regards,`);
})
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Anonimizer, Feature, IAnonimizer, RunValueMap } from "../src";
import { Anonimizer, Feature, IAnonimizer, RunValueMap } from "../../src";
let anonimizer: IAnonimizer;

beforeAll(() => {
Expand Down

0 comments on commit f370dd4

Please sign in to comment.