-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added test cases to visibility-capability.pipe.spec.ts
- Loading branch information
Tyler
committed
Oct 24, 2024
1 parent
6d4f9f4
commit dab62c3
Showing
2 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
39 changes: 38 additions & 1 deletion
39
src/web/app/components/visibility-messages/visibility-capability.pipe.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
}); | ||
}); |