Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
describe('over HTTP', () => {
// Fun fact: Before Cookie Monster ate his first cookie, he believed his name was Sid. You're welcome.
const Sid = Actor.named('Sid').whoCan(
BrowseTheWeb.using(protractor.browser),
ManageALocalServer.runningAHttpListener(cookieCutterApp),
);
beforeEach(() => Sid.attemptsTo(StartLocalServer.onRandomPort()));
afterEach(() => Sid.attemptsTo(StopLocalServer.ifRunning()));
afterEach(() => Sid.attemptsTo(DeleteCookies.all()));
describe('when working with the value', () => {
/** @test {Cookie} */
/** @test {Cookie#valueOf} */
it('allows the actor to retrieve it', () => Sid.attemptsTo(
Navigate.to(cookieCutterURLFor('/cookie?name=favourite&value=chocolate-chip')),
Ensure.that(Cookie.valueOf('favourite'), equals('chocolate-chip')),
));
/** @test {Cookie} */
prepare(actor: Actor): Actor {
return actor.whoCan(
ManageALocalServer.runningAHttpListener(requestHandler),
CallAnApi.at('http://localhost'),
);
}
}