- App.tsx: full navigation (Auth stack + Main tabs with 5 screens) - Auth: LoginScreen, RegisterScreen, ForgotPasswordScreen - HomeScreen: dashboard with IoT metrics, weather widget, alerts, quick actions, sensors - MapScreen: interactive map with layer toggles (6 layers) - MarketplaceScreen: categories (6), products (5), search - ChatScreen: AI chat with quick prompts (4), bot responses - ProfileScreen: user info, stats, menu (9 items), logout - AlertsScreen: alert list with severity, acknowledge - SensorsScreen: sensor list with type filters (6 types), search - ZonesScreen: zone cards with stats - SettingsScreen: language picker (FR/EN/ES/DE), privacy, about - Stores: iotStore (sensors, zones, alerts), notificationStore, uiStore + i18n - Hooks: useSensors, useAlerts, useNotifications, useLocation - Components: Card, Button, LoadingSpinner, ErrorBoundary, Header - Services: iotService, notificationService (with axios API client) - Utils: formatters (temp, AQI, noise, dates), validators (email, password, IBAN) - Theme: colors.ts with full design system (Blue Ocean palette) - Ditto: fixed MongoDB connection, new JWT secrets, official gateway image
56 lines
1.4 KiB
JavaScript
56 lines
1.4 KiB
JavaScript
"use strict";
|
|
|
|
var every = require("./prototypes/array").every;
|
|
|
|
/**
|
|
* @private
|
|
*/
|
|
function hasCallsLeft(callMap, spy) {
|
|
if (callMap[spy.id] === undefined) {
|
|
callMap[spy.id] = 0;
|
|
}
|
|
|
|
return callMap[spy.id] < spy.callCount;
|
|
}
|
|
|
|
/**
|
|
* @private
|
|
*/
|
|
function checkAdjacentCalls(callMap, spy, index, spies) {
|
|
var calledBeforeNext = true;
|
|
|
|
if (index !== spies.length - 1) {
|
|
calledBeforeNext = spy.calledBefore(spies[index + 1]);
|
|
}
|
|
|
|
if (hasCallsLeft(callMap, spy) && calledBeforeNext) {
|
|
callMap[spy.id] += 1;
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* A Sinon proxy object (fake, spy, stub)
|
|
* @typedef {object} SinonProxy
|
|
* @property {Function} calledBefore - A method that determines if this proxy was called before another one
|
|
* @property {string} id - Some id
|
|
* @property {number} callCount - Number of times this proxy has been called
|
|
*/
|
|
|
|
/**
|
|
* Returns true when the spies have been called in the order they were supplied in
|
|
* @param {SinonProxy[] | SinonProxy} spies An array of proxies, or several proxies as arguments
|
|
* @returns {boolean} true when spies are called in order, false otherwise
|
|
*/
|
|
function calledInOrder(spies) {
|
|
var callMap = {};
|
|
// eslint-disable-next-line no-underscore-dangle
|
|
var _spies = arguments.length > 1 ? arguments : spies;
|
|
|
|
return every(_spies, checkAdjacentCalls.bind(null, callMap));
|
|
}
|
|
|
|
module.exports = calledInOrder;
|