How to use the @fantasticfiasco/expect.toBeTrue function in @fantasticfiasco/expect

To help you get started, we’ve selected a few @fantasticfiasco/expect examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github FantasticFiasco / searchlight / src / main / analytics / analytics.ts View on Github external
constructor(clientId: string, userId: string) {
        expect.toBeTrue(Analytics.IdFormat.test(clientId));
        expect.toBeTrue(Analytics.IdFormat.test(userId));

        const trackingId: string = (config as any).analytics.trackingId;

        log.info('Analytics', 'tracking id', trackingId.slice(0, 7) + '*******');
        log.info('Analytics', 'client id', clientId);
        log.info('Analytics', 'user id', userId);

        const options: ua.VisitorOptions = {
            tid: trackingId,
            cid: clientId,
            uid: userId,
            https: true,
        };

        this.visitor = new ua.Visitor(options);
github FantasticFiasco / searchlight / src / main / application-updates / updaters / default-updater.ts View on Github external
public applyUpdates() {
        expect.toBeTrue(this.state === State.DownloadedUpdates, 'Cannot restart until updates are downloaded');

        log.info('DefaultUpdater', 'restart and apply updates');

        try {
            autoUpdater.quitAndInstall();
        } catch (error) {
            this.onError(error);
        }
    }
github FantasticFiasco / searchlight / src / common / analytics / page-view-event.ts View on Github external
constructor(public readonly path: string) {
        expect.toExist(path);
        expect.toBeTrue(path.startsWith('/'));
    }
}
github FantasticFiasco / searchlight / src / main / analytics / analytics.ts View on Github external
public reportPageView(path: string) {
        expect.toExist(path);
        expect.toBeTrue(path.startsWith('/'));

        log.info('Analytics', 'reportPageView', path);

        this.visitor.pageview(path, this.errorHandler);
    }
github FantasticFiasco / searchlight / src / main / application-updates / updaters / mac-os-updater.ts View on Github external
public applyUpdates() {
        expect.toBeTrue(this.state === State.UpdatesAvailable, 'Cannot download and restart until updates available');

        log.info('MacOSUpdater', 'download');

        try {
            shell.openExternal(this.downloadUrl);
        } catch (error) {
            this.onError(error);
        }
    }
github FantasticFiasco / searchlight / src / main / analytics / analytics.ts View on Github external
public reportDuration(category: string, variable: string, time: number) {
        expect.toExist(category);
        expect.toExist(variable);
        expect.toBeTrue(time >= 0);

        log.info('Analytics', 'reportDuration', category, variable, time);

        this.visitor.timing(category, variable, time, this.errorHandler);
    }
github FantasticFiasco / searchlight / src / main / application-updates / updaters / default-updater.ts View on Github external
public start() {
        expect.toBeTrue(this.state === State.Idle, 'Cannot start unless state is Idle');

        log.info('DefaultUpdater', 'start');

        autoUpdater.autoDownload = true;
        autoUpdater.logger = null;

        autoUpdater.on('checking-for-update', () => this.onCheckingForUpdates());
        autoUpdater.on('update-available', (version: UpdateInfo) => this.onUpdateAvailable(version));
        autoUpdater.on('update-not-available', (version: UpdateInfo) => this.onUpdateNotAvailable(version));
        autoUpdater.on('download-progress', (progress: ProgressInfo) => this.onDownloadProgress(progress));
        autoUpdater.on('update-downloaded', (version: UpdateInfo) => this.onUpdateDownloaded(version));
        autoUpdater.on('error', (error: Error) => this.onError(error));
    }
github FantasticFiasco / searchlight / src / main / application-updates / updaters / mac-os-updater.ts View on Github external
public start() {
        expect.toBeTrue(this.state === State.Idle, 'Cannot start unless state is Idle');

        log.info('MacOSUpdater', 'start');

        autoUpdater.autoDownload = false;
        autoUpdater.logger = null;

        autoUpdater.on('checking-for-update', () => this.onCheckingForUpdates());
        autoUpdater.on('update-available', async (version: UpdateInfo) => await this.onUpdateAvailable(version));
        autoUpdater.on('update-not-available', (version: UpdateInfo) => this.onUpdateNotAvailable(version));
        autoUpdater.on('error', (error: Error) => this.onError(error));
    }

@fantasticfiasco/expect

A Node.js library written in TypeScript providing argument validation.

Apache-2.0
Latest version published 4 years ago

Package Health Score

48 / 100
Full package analysis

Popular @fantasticfiasco/expect functions