Rename writeAttachmentData to writeNewAttachmentData

This commit is contained in:
Daniel Gasienica 2018-04-03 21:06:29 -04:00
parent 36771a2dab
commit efd673083d
7 changed files with 28 additions and 25 deletions

View file

@ -13,7 +13,7 @@ const NAME_LENGTH = 64;
const PATH_LENGTH = PREFIX_LENGTH + NUM_SEPARATORS + NAME_LENGTH;
describe('Attachments', () => {
describe('createWriter', () => {
describe('createWriterForNew', () => {
let tempRootDirectory = null;
before(() => {
tempRootDirectory = tmp.dirSync().name;
@ -25,9 +25,12 @@ describe('Attachments', () => {
it('should write file to disk and return path', async () => {
const input = stringToArrayBuffer('test string');
const tempDirectory = path.join(tempRootDirectory, 'Attachments_createWriter');
const tempDirectory = path.join(
tempRootDirectory,
'Attachments_createWriterForNew'
);
const outputPath = await Attachments.createWriter(tempDirectory)(input);
const outputPath = await Attachments.createWriterForNew(tempDirectory)(input);
const output = await fse.readFile(path.join(tempDirectory, outputPath));
assert.lengthOf(outputPath, PATH_LENGTH);

View file

@ -120,14 +120,14 @@ describe('Attachment', () => {
};
const expectedAttachmentData = stringToArrayBuffer('Above us only sky');
const writeAttachmentData = async (attachmentData) => {
const writeNewAttachmentData = async (attachmentData) => {
assert.deepEqual(attachmentData, expectedAttachmentData);
return 'abc/abcdefgh123456789';
};
const actual = await Attachment.migrateDataToFileSystem(
input,
{ writeAttachmentData }
{ writeNewAttachmentData }
);
assert.deepEqual(actual, expected);
});
@ -145,12 +145,12 @@ describe('Attachment', () => {
size: 1111,
};
const writeAttachmentData = async () =>
const writeNewAttachmentData = async () =>
'abc/abcdefgh123456789';
const actual = await Attachment.migrateDataToFileSystem(
input,
{ writeAttachmentData }
{ writeNewAttachmentData }
);
assert.deepEqual(actual, expected);
});
@ -163,11 +163,11 @@ describe('Attachment', () => {
size: 1111,
};
const writeAttachmentData = async () =>
const writeNewAttachmentData = async () =>
'abc/abcdefgh123456789';
try {
await Attachment.migrateDataToFileSystem(input, { writeAttachmentData });
await Attachment.migrateDataToFileSystem(input, { writeNewAttachmentData });
} catch (error) {
assert.strictEqual(
error.message,

View file

@ -85,7 +85,7 @@ describe('Message', () => {
const expectedAttachmentData = stringToArrayBuffer('Its easy if you try');
const context = {
writeAttachmentData: async (attachmentData) => {
writeNewAttachmentData: async (attachmentData) => {
assert.deepEqual(attachmentData, expectedAttachmentData);
return 'abc/abcdefg';
},