Skip to content

Commit

Permalink
fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jsnoble committed Nov 5, 2024
1 parent b4c321e commit 115fe89
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
6 changes: 4 additions & 2 deletions asset/src/sample_exact/processor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { BatchProcessor, Context, DataEntity, ExecutionConfig, random } from '@terascope/job-components';
import {
BatchProcessor, Context, DataEntity, ExecutionConfig
} from '@terascope/job-components';
import { SampleExactConfig } from './interfaces.js';

/* sample_exact.js - given an array of JSON documents will return an array containing
Expand Down Expand Up @@ -36,7 +38,7 @@ export default class SampleExact extends BatchProcessor<SampleExactConfig> {

async onBatch(dataArray: DataEntity[]) {
this._shuffleArray(dataArray);
const length = Math.floor(dataArray.length * this.percentage)
const length = Math.floor(dataArray.length * this.percentage);
return dataArray.slice(0, length);
}

Expand Down
11 changes: 3 additions & 8 deletions test/sample_exact/processor-spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { WorkerTestHarness } from 'teraslice-test-harness';
import { DataEntity } from '@terascope/job-components';
import { SampleExactConfig } from '../../asset/src/sample_exact/interfaces.js';

describe('sample_exact', () => {
Expand Down Expand Up @@ -36,16 +35,16 @@ describe('sample_exact', () => {
expect(results.length).toEqual(10);
});

it('it shuffles the data', async () => {
it('shuffles the data', async () => {
const data = makeData(10);
harness = await makeTest();
const results = await harness.runSlice(data);

const outOfOrder = results.some((record, index) => {
return record._key !== data[index]._key;
})
});

expect(outOfOrder).toBeTrue()
expect(outOfOrder).toBeTrue();
});

it('with 0%, should return none of the data', async () => {
Expand Down Expand Up @@ -103,10 +102,6 @@ interface FakeData {
age: string;
}

function getKeys(data: FakeData[] | DataEntity<FakeData>[]) {
return data.map((doc) => doc._key).join('');
}

function makeData(n: number): FakeData[] {
const bunchesOData = [];

Expand Down
5 changes: 0 additions & 5 deletions test/sample_random/processor-spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { WorkerTestHarness } from 'teraslice-test-harness';
import { DataEntity } from '@terascope/job-components';
import { SampleRandomConfig } from '../../asset/src/sample_random/interfaces.js';

describe('sample_random', () => {
Expand Down Expand Up @@ -86,10 +85,6 @@ interface FakeData {
age: string;
}

function getKeys(data: FakeData[] | DataEntity<FakeData>[]) {
return data.map((doc) => doc._key).join('');
}

function makeData(n: number): FakeData[] {
const bunchesOData = [];

Expand Down

0 comments on commit 115fe89

Please sign in to comment.