Skip to content

Commit

Permalink
Added test cases to visibility-capability.pipe.spec.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyler committed Oct 24, 2024
1 parent 6d4f9f4 commit dab62c3
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,8 +1,45 @@
import { VisibilityCapabilityPipe } from './visibility-capability.pipe';
import {VisibilityCapabilityPipe} from './visibility-capability.pipe';

describe('VisibilityCapabilityPipe', () => {
it('create an instance', () => {
const pipe: VisibilityCapabilityPipe = new VisibilityCapabilityPipe();
expect(pipe).toBeTruthy();
});

let visibilityCapabilityPipe: VisibilityCapabilityPipe;

beforeEach(() => {
visibilityCapabilityPipe = new VisibilityCapabilityPipe();
})

it('should return correct message', () => {
let example1: { SHOW_RECIPIENT_NAME: boolean; SHOW_GIVER_NAME: boolean; SHOW_RESPONSE: boolean } = {
SHOW_RESPONSE: true,
SHOW_GIVER_NAME: true,
SHOW_RECIPIENT_NAME: true
};
expect(visibilityCapabilityPipe.transform(example1)).toBe("can see your response, the name of the recipient, and your name");

let example2: { SHOW_RECIPIENT_NAME: boolean; SHOW_GIVER_NAME: boolean; SHOW_RESPONSE: boolean } = {
SHOW_RESPONSE: true,
SHOW_GIVER_NAME: true,
SHOW_RECIPIENT_NAME: false
};
expect(visibilityCapabilityPipe.transform(example2)).toBe("can see your response, and your name, but not the name of the recipient");

let example3: { SHOW_RECIPIENT_NAME: boolean; SHOW_GIVER_NAME: boolean; SHOW_RESPONSE: boolean } = {
SHOW_RESPONSE: true,
SHOW_GIVER_NAME: false,
SHOW_RECIPIENT_NAME: true
};
expect(visibilityCapabilityPipe.transform(example3)).toBe("can see your response, the name of the recipient, but not your name");

let example4: { SHOW_RECIPIENT_NAME: boolean; SHOW_GIVER_NAME: boolean; SHOW_RESPONSE: boolean } = {
SHOW_RESPONSE: true,
SHOW_GIVER_NAME: false,
SHOW_RECIPIENT_NAME: false
};

expect(visibilityCapabilityPipe.transform(example4)).toBe("can see your response, but not the name of the recipient, or your name");
});
});

0 comments on commit dab62c3

Please sign in to comment.