How to use the @fantasticfiasco/expect.toExist 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 / renderer / services / heartbeat-service.ts View on Github external
constructor(discoveryService: DiscoveryService) {
        expect.toExist(discoveryService);

        this.discoveryService = discoveryService;
        this.discoveryService.onHello((device) => this.onResponse(device));
        this.discoveryService.onGoodbye((device) => this.onResponse(device));

        // Trigger the initial search
        this.discoveryService.search();

        // Trigger search every 10 seconds
        setInterval(() => this.discoveryService.search(), 10000);

        // Trigger check for unresponsive devices every 5 seconds
        setInterval(() => this.findAndUpdateUnresponsiveDevices(), 5000);
    }
github FantasticFiasco / searchlight / src / main / application-updates / application-updates.ts View on Github external
constructor(analytics: Analytics, window: Electron.BrowserWindow) {
        expect.toExist(analytics);
        expect.toExist(window);

        this.updater = this.createUpdater(analytics, window);

        // Register for messages sent from the renderer
        ipcMain.on(ApplicationUpdatesChannelName.Check, () => this.checkForUpdates());
        ipcMain.on(ApplicationUpdatesChannelName.Apply, () => this.applyUpdates());
    }
github FantasticFiasco / searchlight / src / renderer / store / heartbeats / mutations.ts View on Github external
export const addHeartbeat: Mutation = (state: State, mutation: Heartbeat) => {
    expect.toExist(state);
    expect.toExist(mutation);

    let heartbeats = state[mutation.macAddress];
    if (!heartbeats) {
        heartbeats = [];
        Vue.set(state, mutation.macAddress, heartbeats);
    }

    // Add heartbeat
    heartbeats.push(mutation.timestamp);

    // Remove heartbeats that are to old
    const now = new Date();
    while (heartbeats.length > 0 && now.getTime() - heartbeats[0].getTime() > historyDuration) {
        heartbeats.splice(0, 1);
    }
};
github FantasticFiasco / searchlight / src / renderer / store / heartbeats / mutations.ts View on Github external
export const addHeartbeat: Mutation = (state: State, mutation: Heartbeat) => {
    expect.toExist(state);
    expect.toExist(mutation);

    let heartbeats = state[mutation.macAddress];
    if (!heartbeats) {
        heartbeats = [];
        Vue.set(state, mutation.macAddress, heartbeats);
    }

    // Add heartbeat
    heartbeats.push(mutation.timestamp);

    // Remove heartbeats that are to old
    const now = new Date();
    while (heartbeats.length > 0 && now.getTime() - heartbeats[0].getTime() > historyDuration) {
        heartbeats.splice(0, 1);
    }
github FantasticFiasco / searchlight / src / main / application-updates / updaters / default-updater.ts View on Github external
constructor(analytics: Analytics, webContents: Electron.WebContents) {
        expect.toExist(analytics);
        expect.toExist(webContents);

        this.analytics = analytics;
        this.webContents = webContents;
        this.state = State.Idle;
    }
github FantasticFiasco / searchlight / src / main / analytics / analytics.ts View on Github external
public reportEventWithValue(category: string, action: string, label: string, value?: number) {
        expect.toExist(category);
        expect.toExist(action);
        expect.toExist(label);

        log.info('Analytics', 'reportEventWithValue', category, action, label, value);

        if (value) {
            this.visitor.event(category, action, label, value, this.errorHandler);
        } else {
            this.visitor.event(category, action, label, this.errorHandler);
        }
    }
github FantasticFiasco / searchlight / src / main / analytics / analytics.ts View on Github external
public reportEvent(category: string, action: string) {
        expect.toExist(category);
        expect.toExist(action);

        log.info('Analytics', 'reportEvent', category, action);

        this.visitor.event(category, action, this.errorHandler);
    }
github FantasticFiasco / searchlight / src / renderer / store / devices / mutations.ts View on Github external
export const disconnectDevice: Mutation = (state: State, mutation: Device) => {
    expect.toExist(state);
    expect.toExist(mutation);

    const index = indexOf(mutation, state);

    if (index > -1) {
        state[index].networkStatus.isResponsive = false;
    }
};
github FantasticFiasco / searchlight / src / main / application-updates / updaters / mac-os-updater.ts View on Github external
constructor(analytics: Analytics, webContents: Electron.WebContents) {
        expect.toExist(analytics);
        expect.toExist(webContents);

        this.analytics = analytics;
        this.webContents = webContents;
        this.gitHub = new GitHub();
        this.state = State.Idle;
    }

@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