Skip to content
Permalink
Browse files
fix(core): Test reports no longer contain a duplicate entry for with …
…the contents of the report
  • Loading branch information
jan-molak committed Mar 2, 2019
1 parent 4b417f8 commit 2c369625a103432f9d16df5cdf21abcc7ee25e45
@@ -22,7 +22,7 @@ import {
ExecutionSuccessful,
ImplementationPending, JSONData,
Name,
ScenarioDetails,
ScenarioDetails, TestReport,
Timestamp,
} from '../../../../src/model';
import { SerenityBDDReporter, StageManager } from '../../../../src/stage';
@@ -85,8 +85,8 @@ describe('SerenityBDDReporter', () => {
* @test {ExecutionSuccessful}
* @test {TestRunFinished}
*/
it('is a JSONData', () => {
expect(artifact).to.be.instanceOf(JSONData);
it('is a valid artifact', () => {
expect(artifact).to.be.instanceOf(TestReport);
});
});

@@ -1,4 +1,4 @@
import { ensure, isDefined, isString, JSONObject, Predicate, Serialised, TinyType } from 'tiny-types';
import { ensure, isDefined, isString, JSONObject, Predicate, TinyType } from 'tiny-types';

import { LogicError } from '../errors';
import * as artifacts from './artifacts';
@@ -1,8 +1,13 @@
import { JSONObject } from 'tiny-types';
import { JSONData } from './JSONData';
import { Artifact } from '../Artifact';

export class TestReport extends Artifact {

export class TestReport extends JSONData {
static fromJSON(value: JSONObject) {
return new TestReport(Buffer.from(JSON.stringify(value, null, 0), 'utf8').toString('base64'));
}

map<O>(fn: (decodedValue: JSONObject) => O): O {
return fn(JSON.parse(Buffer.from(this.base64EncodedValue, 'base64').toString('utf8')));
}
}
@@ -0,0 +1,7 @@
import { JSONData } from './JSONData';

export class TextData extends JSONData {
static fromJSON(value: { contentType: string, data: string }) {
return new TextData(Buffer.from(JSON.stringify(value, null, 0), 'utf8').toString('base64'));
}
}
@@ -2,3 +2,4 @@ export * from './HTTPRequestResponse';
export * from './JSONData';
export * from './Photo';
export * from './TestReport';
export * from './TextData';

0 comments on commit 2c36962

Please sign in to comment.