Skip to content

Commit

Permalink
modified tests for generateClientStreamCall
Browse files Browse the repository at this point in the history
  • Loading branch information
iangeckeler committed Aug 6, 2019
1 parent 2a183a3 commit a906a20
Showing 1 changed file with 30 additions and 38 deletions.
68 changes: 30 additions & 38 deletions __tests__/callFactories/generateClientStreamCall.js
Original file line number Diff line number Diff line change
@@ -1,45 +1,37 @@
const generateClientStreamCall = require('../../lib/callFactories/generateClientStreamCall')
const mockServerReadableStream = {on: () => {}};
const generateClientStreamCall = require("../../lib/callFactories/generateClientStreamCall");
const mockServerReadableStream = { on: () => {} };
const fakeCallback = (err, object, trailer) => {};
const mockServerReadable = generateClientStreamCall(mockServerReadableStream, fakeCallback);

describe('Unit tests for generating Client Stream Call', () => {

describe('Client Stream should have properties', () => {

test('Client Stream Call must have metaData property', () => {
expect(mockServerReadable.hasOwnProperty('metaData')).toBe(true);
})

test('Client Stream Call must have err property', () => {
expect(mockServerReadable.hasOwnProperty('err')).toBe(true);
})

test('Client Stream Call must have trailer property', () => {
expect(mockServerReadable.hasOwnProperty('trailer')).toBe(true);
})
const mockServerReadable = generateClientStreamCall(
mockServerReadableStream,
fakeCallback
);

describe("Unit tests for generating Client Stream Call", () => {
describe("Client Stream should have properties", () => {
test("Client Stream Call must have head property", () => {
expect(mockServerReadable.hasOwnProperty("head")).toBe(true);
});
});

describe('Client Stream should have methods', () => {

test('Client Stream Call must have throw method', () => {
expect(typeof mockServerReadable.throw === 'function').toBe(true);
})
describe("Client Stream should have methods", () => {
test("Client Stream Call must have throw method", () => {
expect(typeof mockServerReadable.throw === "function").toBe(true);
});

test('Client Stream Call must have setStatus method', () => {
expect(typeof mockServerReadable.setStatus === 'function').toBe(true);
})
test("Client Stream Call must have set method", () => {
expect(typeof mockServerReadable.set === "function").toBe(true);
});

test('Client Stream Call must have setMeta method', () => {
expect(typeof mockServerReadable.setMeta === 'function').toBe(true);
})
test("Client Stream Call must have catch method", () => {
expect(typeof mockServerReadable.catch === "function").toBe(true);
});

test('Client Stream Call must have send method', () => {
expect(typeof mockServerReadable.send === 'function').toBe(true);
})
test("Client Stream Call must have send method", () => {
expect(typeof mockServerReadable.send === "function").toBe(true);
});

test('Client Stream Call must have on method', () => {
expect(typeof mockServerReadable.on === 'function').toBe(true);
})
})
})
test("Client Stream Call must have on method", () => {
expect(typeof mockServerReadable.on === "function").toBe(true);
});
});
});

0 comments on commit a906a20

Please sign in to comment.