<commit_before>"use strict";

const parser = require( '../lib/EventParser' );

const test        = require( "ava" );
const pify        = require("pify");
const fs          = require("fs");

test("Parsing S3 event", t => {
    const s3EventSource = `${__dirname}/fixture/event_source.json`;
    const s3Event = JSON.parse( fs.readFileSync( s3EventSource ) );
    const record = parser( s3Event );

    t.is( record.object.key, "HappyFace.jpg" );
    t.is( record.object.size, 1024 );
    t.is( record.bucket.name, "sourcebucket" );
    t.is( record.bucket.arn, "arn:aws:s3:::mybucket" );
});

test("Parsing SNS event carrying S3 event", t => {
    const snsEventSource = `${__dirname}/fixture/sns_event_source.json`;
    const snsEvent = JSON.parse( fs.readFileSync( snsEventSource ) );
    const record = parser( snsEvent );

    t.is( record.object.key, "HappyFace.jpg" );
    t.is( record.object.size, 1024 );
    t.is( record.bucket.name, "sourcebucket" );
    t.is( record.bucket.arn, "arn:aws:s3:::mybucket" );
});<commit_msg>fixing indentations<commit_after>"use strict";

const parser = require( '../lib/EventParser' );
const test   = require( "ava" );
const pify   = require("pify");
const fs     = require("fs");

test("Parsing S3 event", t => {
    const s3EventSource = `${__dirname}/fixture/event_source.json`;
    const s3Event = JSON.parse( fs.readFileSync( s3EventSource ) );
    const record = parser( s3Event );

    t.is( record.object.key, "HappyFace.jpg" );
    t.is( record.object.size, 1024 );
    t.is( record.bucket.name, "sourcebucket" );
    t.is( record.bucket.arn, "arn:aws:s3:::mybucket" );
});

test("Parsing SNS event carrying S3 event", t => {
    const snsEventSource = `${__dirname}/fixture/sns_event_source.json`;
    const snsEvent = JSON.parse( fs.readFileSync( snsEventSource ) );
    const record = parser( snsEvent );

    t.is( record.object.key, "HappyFace.jpg" );
    t.is( record.object.size, 1024 );
    t.is( record.bucket.name, "sourcebucket" );
    t.is( record.bucket.arn, "arn:aws:s3:::mybucket" );
});
{'fraction_non_alphanumeric': 0.17348927875243664, 'fraction_numerical': 0.015594541910331383, 'mean_word_length': 3.5825892857142856, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '879328', 'n_tokens_mistral': 739, 'n_tokens_neox': 718, 'n_words': 151}