/**
 * Check if a cookie with the given name exists
 * @param  {[type]}   name      The name of the cookie
 * @param  {[type]}   falseCase Whether or not to check if the cookie exists or
 *                              not
 */
import {CustomExpect} from "../../common-helpers/custom-expect";
import {browser, $, $$, expect} from '@wdio/globals'

export default async function (name: string, falseCase: boolean) {
    /**
     * The cookie as retrieved from the browser
     * @type {Object}
     */
    const cookie = await browser.getCookies(name);

    if (falseCase) {
        CustomExpect.expectToHaveLength(cookie, 0, `Cookie exists`)

    } else {
        CustomExpect.expectNotToHaveLength(cookie, 0, `Cookie does not exist`)
    }
};

