- 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
53 lines
1.8 KiB
JavaScript
53 lines
1.8 KiB
JavaScript
'use strict';
|
|
|
|
var test = require('tape');
|
|
var parse = require('../').parse;
|
|
|
|
test('expand environment variables', function (t) {
|
|
t.same(parse('a $XYZ c', { XYZ: 'b' }), ['a', 'b', 'c']);
|
|
t.same(parse('a${XYZ}c', { XYZ: 'b' }), ['abc']);
|
|
t.same(parse('a${XYZ}c $XYZ', { XYZ: 'b' }), ['abc', 'b']);
|
|
t.same(parse('"-$X-$Y-"', { X: 'a', Y: 'b' }), ['-a-b-']);
|
|
t.same(parse("'-$X-$Y-'", { X: 'a', Y: 'b' }), ['-$X-$Y-']);
|
|
t.same(parse('qrs"$zzz"wxy', { zzz: 'tuv' }), ['qrstuvwxy']);
|
|
t.same(parse("qrs'$zzz'wxy", { zzz: 'tuv' }), ['qrs$zzzwxy']);
|
|
t.same(parse('qrs${zzz}wxy'), ['qrswxy']);
|
|
t.same(parse('qrs$wxy $'), ['qrs', '$']);
|
|
t.same(parse('grep "xy$"'), ['grep', 'xy$']);
|
|
t.same(parse('ab$x', { x: 'c' }), ['abc']);
|
|
t.same(parse('ab\\$x', { x: 'c' }), ['ab$x']);
|
|
t.same(parse('ab${x}def', { x: 'c' }), ['abcdef']);
|
|
t.same(parse('ab\\${x}def', { x: 'c' }), ['ab${x}def']);
|
|
t.same(parse('"ab\\${x}def"', { x: 'c' }), ['ab${x}def']);
|
|
|
|
t.end();
|
|
});
|
|
|
|
test('expand environment variables within here-strings', function (t) {
|
|
t.same(parse('a <<< $x', { x: 'Joe' }), ['a', { op: '<<<' }, 'Joe']);
|
|
t.same(parse('a <<< ${x}', { x: 'Joe' }), ['a', { op: '<<<' }, 'Joe']);
|
|
t.same(parse('a <<< "$x"', { x: 'Joe' }), ['a', { op: '<<<' }, 'Joe']);
|
|
t.same(parse('a <<< "${x}"', { x: 'Joe' }), ['a', { op: '<<<' }, 'Joe']);
|
|
|
|
t.end();
|
|
});
|
|
|
|
test('environment variables with metacharacters', function (t) {
|
|
t.same(parse('a $XYZ c', { XYZ: '"b"' }), ['a', '"b"', 'c']);
|
|
t.same(parse('a $XYZ c', { XYZ: '$X', X: 5 }), ['a', '$X', 'c']);
|
|
t.same(parse('a"$XYZ"c', { XYZ: "'xyz'" }), ["a'xyz'c"]);
|
|
|
|
t.end();
|
|
});
|
|
|
|
test('special shell parameters', function (t) {
|
|
var chars = '*@#?-$!0_'.split('');
|
|
t.plan(chars.length);
|
|
|
|
chars.forEach(function (c) {
|
|
var env = {};
|
|
env[c] = 'xxx';
|
|
t.same(parse('a $' + c + ' c', env), ['a', 'xxx', 'c']);
|
|
});
|
|
});
|