@ohos-ports/core 1.0.113-beta.0 → 1.16.33-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +13 -0
- package/README.md +3 -0
- package/lib/api/node.js +176 -0
- package/lib/api/team.js +1889 -0
- package/lib/blocklet/downloader/blocklet-downloader.js +246 -0
- package/lib/blocklet/downloader/bundle-downloader.js +316 -0
- package/lib/blocklet/downloader/constants.js +3 -0
- package/lib/blocklet/downloader/resolve-download.js +187 -0
- package/lib/blocklet/extras.js +177 -0
- package/lib/blocklet/hooks.js +89 -0
- package/lib/blocklet/manager/base.js +49 -0
- package/lib/blocklet/manager/config-synchronizer.js +128 -0
- package/lib/blocklet/manager/disk.js +5170 -0
- package/lib/blocklet/manager/engine.js +124 -0
- package/lib/blocklet/manager/helper/install-application-from-backup.js +285 -0
- package/lib/blocklet/manager/helper/install-application-from-dev.js +72 -0
- package/lib/blocklet/manager/helper/install-application-from-general.js +209 -0
- package/lib/blocklet/manager/helper/install-component-from-dev.js +128 -0
- package/lib/blocklet/manager/helper/install-component-from-upload.js +197 -0
- package/lib/blocklet/manager/helper/install-component-from-url.js +214 -0
- package/lib/blocklet/manager/helper/migrate-application-to-struct-v2.js +557 -0
- package/lib/blocklet/manager/helper/rollback-cache.js +41 -0
- package/lib/blocklet/manager/helper/upgrade-components.js +179 -0
- package/lib/blocklet/manager/pm2-events.js +50 -0
- package/lib/blocklet/migration-dist/migration.cjs +38605 -0
- package/lib/blocklet/migration-dist/run-script.cjs +29 -0
- package/lib/blocklet/migration.js +145 -0
- package/lib/blocklet/project/connect-by-studio.js +91 -0
- package/lib/blocklet/project/connect-to-store.js +64 -0
- package/lib/blocklet/project/create-pack-release.js +293 -0
- package/lib/blocklet/project/disconnect-from-store.js +13 -0
- package/lib/blocklet/project/get-is-multiple-tenant.js +8 -0
- package/lib/blocklet/project/index.js +545 -0
- package/lib/blocklet/project/logo.png +0 -0
- package/lib/blocklet/project/publish-to-store.js +108 -0
- package/lib/blocklet/project/util.js +194 -0
- package/lib/blocklet/security/access-policy.js +131 -0
- package/lib/blocklet/security/index.js +309 -0
- package/lib/blocklet/security/response-header-policy.js +178 -0
- package/lib/blocklet/security/security-rule.js +127 -0
- package/lib/blocklet/security/utils.js +35 -0
- package/lib/blocklet/security/validator.js +40 -0
- package/lib/blocklet/storage/backup/base.js +149 -0
- package/lib/blocklet/storage/backup/blocklet-extras.js +110 -0
- package/lib/blocklet/storage/backup/blocklet.js +159 -0
- package/lib/blocklet/storage/backup/blocklets.js +109 -0
- package/lib/blocklet/storage/backup/data.js +35 -0
- package/lib/blocklet/storage/backup/disk.js +131 -0
- package/lib/blocklet/storage/backup/logs.js +24 -0
- package/lib/blocklet/storage/backup/routing-rule.js +47 -0
- package/lib/blocklet/storage/backup/spaces.js +345 -0
- package/lib/blocklet/storage/restore/base.js +74 -0
- package/lib/blocklet/storage/restore/blocklet-extras.js +89 -0
- package/lib/blocklet/storage/restore/blocklet.js +56 -0
- package/lib/blocklet/storage/restore/blocklets.js +43 -0
- package/lib/blocklet/storage/restore/disk.js +104 -0
- package/lib/blocklet/storage/restore/logs.js +21 -0
- package/lib/blocklet/storage/restore/spaces.js +174 -0
- package/lib/blocklet/storage/utils/disk.js +178 -0
- package/lib/blocklet/storage/utils/hash.js +53 -0
- package/lib/blocklet/storage/utils/zip.js +43 -0
- package/lib/cert.js +221 -0
- package/lib/crons/check-new-version.js +68 -0
- package/lib/crons/monitor-disk-usage.js +46 -0
- package/lib/crons/rotate-pm2-logs/index.js +41 -0
- package/lib/crons/rotate-pm2-logs/script.js +56 -0
- package/lib/event/auto-backup-handler.js +48 -0
- package/lib/event/index.js +520 -0
- package/lib/index.js +768 -364
- package/lib/locales/ar.js +18 -0
- package/lib/locales/de.js +21 -0
- package/lib/locales/en.js +19 -0
- package/lib/locales/es.js +21 -0
- package/lib/locales/fr.js +21 -0
- package/lib/locales/hi.js +18 -0
- package/lib/locales/i18n.db +0 -0
- package/lib/locales/id.js +20 -0
- package/lib/locales/index.js +54 -0
- package/lib/locales/ja.js +19 -0
- package/lib/locales/ko.js +18 -0
- package/lib/locales/pt.js +20 -0
- package/lib/locales/ru.js +21 -0
- package/lib/locales/th.js +18 -0
- package/lib/locales/vi.js +18 -0
- package/lib/locales/zh-tw.js +17 -0
- package/lib/locales/zh.js +17 -0
- package/lib/migrations/1.0.21-update-config.js +34 -0
- package/lib/migrations/1.0.22-max-memory.js +40 -0
- package/lib/migrations/1.0.25.js +36 -0
- package/lib/migrations/1.0.32-update-config.js +30 -0
- package/lib/migrations/1.0.33-blocklets.js +33 -0
- package/lib/migrations/1.0.36-snapshot.js +10 -0
- package/lib/migrations/1.1.10-team.js +26 -0
- package/lib/migrations/1.1.9-snapshot.js +7 -0
- package/lib/migrations/1.16.11-component-status.js +22 -0
- package/lib/migrations/1.16.33-blocklet-security-rule.js +17 -0
- package/lib/migrations/1.16.6-chain-info.js +78 -0
- package/lib/migrations/1.16.8-component-title.js +66 -0
- package/lib/migrations/1.2.11-blocklet-registry.js +10 -0
- package/lib/migrations/1.2.2-blocklet-registry.js +10 -0
- package/lib/migrations/1.3.1-disk-alert-threshold.js +10 -0
- package/lib/migrations/1.4.5-access-key.js +18 -0
- package/lib/migrations/1.5.0-site.js +34 -0
- package/lib/migrations/1.5.15-site.js +184 -0
- package/lib/migrations/1.5.20-registry.js +15 -0
- package/lib/migrations/1.6.17-blocklet-children.js +48 -0
- package/lib/migrations/1.6.21-rename-ip-echo-domain.js +35 -0
- package/lib/migrations/1.6.4-security.js +59 -0
- package/lib/migrations/1.6.5-security.js +60 -0
- package/lib/migrations/1.6.9-update-node-info-and-certificate.js +39 -0
- package/lib/migrations/1.7.1-blocklet-setup.js +18 -0
- package/lib/migrations/1.7.12-blocklet-meta.js +51 -0
- package/lib/migrations/1.7.15-blocklet-bundle-source.js +42 -0
- package/lib/migrations/1.7.20-blocklet-component.js +41 -0
- package/lib/migrations/1.8.33-blocklet-mem-limit.js +20 -0
- package/lib/migrations/README.md +71 -0
- package/lib/migrations/index.js +215 -0
- package/lib/monitor/blocklet-runtime-monitor.js +204 -0
- package/lib/monitor/get-history-list.js +37 -0
- package/lib/monitor/node-monit-sender.js +99 -0
- package/lib/monitor/node-runtime-monitor.js +205 -0
- package/lib/processes/updater.js +186 -0
- package/lib/router/helper.js +1653 -0
- package/lib/router/index.js +341 -0
- package/lib/router/manager.js +806 -0
- package/lib/states/README.md +38 -0
- package/lib/states/access-key.js +124 -0
- package/lib/states/access-policy.js +29 -0
- package/lib/states/audit-log.js +734 -0
- package/lib/states/backup.js +165 -0
- package/lib/states/base.js +25 -0
- package/lib/states/blocklet-extras.js +257 -0
- package/lib/states/blocklet.js +755 -0
- package/lib/states/cache.js +23 -0
- package/lib/states/connect-account.js +8 -0
- package/lib/states/index.js +76 -0
- package/lib/states/job.js +8 -0
- package/lib/states/migration.js +34 -0
- package/lib/states/node.js +324 -0
- package/lib/states/notification.js +81 -0
- package/lib/states/passport.js +8 -0
- package/lib/states/project.js +119 -0
- package/lib/states/release.js +50 -0
- package/lib/states/response-header-policy.js +30 -0
- package/lib/states/routing-snapshot.js +146 -0
- package/lib/states/runtime-insight.js +25 -0
- package/lib/states/security-rule.js +30 -0
- package/lib/states/session.js +53 -0
- package/lib/states/site.js +102 -0
- package/lib/states/tag.js +8 -0
- package/lib/states/traffic-insight.js +25 -0
- package/lib/states/user-session.js +8 -0
- package/lib/states/user.js +717 -0
- package/lib/states/verify-code.js +152 -0
- package/lib/states/webhook.js +66 -0
- package/lib/team/manager.js +508 -0
- package/lib/util/blocklet.js +2182 -0
- package/lib/util/cache.js +63 -0
- package/lib/util/chain.js +29 -0
- package/lib/util/default-node-config.js +46 -0
- package/lib/util/docker/blocklet-custom-dockerfile.js +92 -0
- package/lib/util/docker/check-docker-has-image.js +23 -0
- package/lib/util/docker/check-docker-installed.js +32 -0
- package/lib/util/docker/check-docker-run-history.js +18 -0
- package/lib/util/docker/check-need-run-docker.js +32 -0
- package/lib/util/docker/create-docker-image.js +65 -0
- package/lib/util/docker/debian-dockerfile.js +50 -0
- package/lib/util/docker/docker-container-prune.js +75 -0
- package/lib/util/docker/docker-exec-chown.js +39 -0
- package/lib/util/docker/docker-exec.js +68 -0
- package/lib/util/docker/docker-remove-by-name.js +20 -0
- package/lib/util/docker/get-docker-runtime-info.js +39 -0
- package/lib/util/docker/parse-docker-name.js +10 -0
- package/lib/util/docker/parse-docker-options-from-pm2.js +295 -0
- package/lib/util/docker/shard-network.js +10 -0
- package/lib/util/domain-status.js +118 -0
- package/lib/util/get-accessible-external-node-ip.js +92 -0
- package/lib/util/get-dynamic-components.js +47 -0
- package/lib/util/get-meta-from-url.js +30 -0
- package/lib/util/get-migration-scripts.js +36 -0
- package/lib/util/get-safe-env.js +12 -0
- package/lib/util/index.js +522 -0
- package/lib/util/install-external-dependencies.js +67 -0
- package/lib/util/ip.js +53 -0
- package/lib/util/launcher.js +475 -0
- package/lib/util/log.js +431 -0
- package/lib/util/maintain.js +178 -0
- package/lib/util/promise-debounce.js +29 -0
- package/lib/util/promise-once.js +14 -0
- package/lib/util/promise-spawn.js +93 -0
- package/lib/util/queue.js +44 -0
- package/lib/util/ready.js +89 -0
- package/lib/util/request.js +10 -0
- package/lib/util/requirement.js +61 -0
- package/lib/util/reset-node.js +166 -0
- package/lib/util/rotator.js +194 -0
- package/lib/util/router.js +122 -0
- package/lib/util/rpc.js +78 -0
- package/lib/util/spaces.js +102 -0
- package/lib/util/store.js +184 -0
- package/lib/util/sysinfo.js +46 -0
- package/lib/util/ua.js +54 -0
- package/lib/validators/backup.js +34 -0
- package/lib/validators/blocklet-extra.js +18 -0
- package/lib/validators/node.js +73 -0
- package/lib/validators/permission.js +38 -0
- package/lib/validators/project.js +39 -0
- package/lib/validators/role.js +64 -0
- package/lib/validators/router.js +192 -0
- package/lib/validators/space-gateway.js +33 -0
- package/lib/validators/trusted-factory.js +28 -0
- package/lib/validators/trusted-passport.js +32 -0
- package/lib/validators/user.js +62 -0
- package/lib/validators/util.js +92 -0
- package/lib/validators/webhook.js +42 -0
- package/lib/webhook/index.js +216 -0
- package/lib/webhook/reduce-queue.js +12 -0
- package/lib/webhook/sender/api/index.js +67 -0
- package/lib/webhook/sender/base.js +11 -0
- package/lib/webhook/sender/index.js +44 -0
- package/lib/webhook/sender/slack/index.js +167 -0
- package/lib/webhook/sender/wallet/index.js +62 -0
- package/package.json +107 -34
- package/examples/BatchClient.js +0 -61
- package/examples/compressor/example.js +0 -7
- package/examples/jsonrpcserver/rpcmethod.js +0 -21
- package/examples/jsonrpcserver/rpcrequest.js +0 -20
- package/examples/jsonrpcserver/rpctest.js +0 -6
- package/examples/loader-pipes/test-mc.js +0 -52
- package/examples/loader-pipes/test.js +0 -51
- package/examples/mc-test.js +0 -44
- package/examples/redisdebug.js +0 -80
- package/lib/cache/CFMemcache.js +0 -57
- package/lib/cache/CacheLoader.js +0 -217
- package/lib/cache/Memcache.js +0 -406
- package/lib/class/Class.js +0 -54
- package/lib/client/MemcacheAdapter.js +0 -139
- package/lib/client/Memcached.js +0 -142
- package/lib/client/MemcachedSocket.js +0 -570
- package/lib/client/MySQLPool.js +0 -153
- package/lib/client/PGPool.js +0 -296
- package/lib/client/Redis.js +0 -787
- package/lib/client/S3.js +0 -103
- package/lib/client/S3Client.js +0 -392
- package/lib/client/pg/CursorQueryWorker.js +0 -160
- package/lib/client/rabbitmq/RbmqChannel.js +0 -61
- package/lib/client/rabbitmq/RbmqConfig.js +0 -144
- package/lib/client/rabbitmq/RbmqConnection.js +0 -259
- package/lib/client/rabbitmq/RbmqExchange.js +0 -112
- package/lib/client/rabbitmq/RbmqIncomingMessage.js +0 -53
- package/lib/client/rabbitmq/RbmqMessage.js +0 -120
- package/lib/client/rabbitmq/RbmqOutcomingMessage.js +0 -47
- package/lib/client/rabbitmq/RbmqQueue.js +0 -87
- package/lib/client/rabbitmq/index.js +0 -8
- package/lib/common/Assertions.js +0 -184
- package/lib/common/Merge.js +0 -32
- package/lib/common/Net.js +0 -56
- package/lib/common/Process.js +0 -20
- package/lib/common/Random.js +0 -53
- package/lib/common/Sort.js +0 -19
- package/lib/common/Types.js +0 -163
- package/lib/credentials/CredentialsProvider.js +0 -45
- package/lib/credentials/Manager.js +0 -101
- package/lib/crypto/Crypto.js +0 -66
- package/lib/data/BinaryData.js +0 -363
- package/lib/data/Compressor.js +0 -83
- package/lib/data/FormData.js +0 -144
- package/lib/data/Mime.js +0 -45
- package/lib/event/ErrorEvent.js +0 -71
- package/lib/event/Event.js +0 -20
- package/lib/event/EventDispatcher.js +0 -157
- package/lib/http/ConnectionPool.js +0 -82
- package/lib/http/ExpressServer.js +0 -19
- package/lib/http/Headers.js +0 -165
- package/lib/http/Loader.js +0 -584
- package/lib/http/Message.js +0 -189
- package/lib/http/Request.js +0 -848
- package/lib/http/RequestProcessor.js +0 -150
- package/lib/http/Response.js +0 -850
- package/lib/http/Server.js +0 -267
- package/lib/http/Socket.js +0 -157
- package/lib/http/Url.js +0 -2
- package/lib/jsonrpc/JsonRpcAbstract.js +0 -109
- package/lib/jsonrpc/JsonRpcBatchRequest.js +0 -54
- package/lib/jsonrpc/JsonRpcBatchResponse.js +0 -73
- package/lib/jsonrpc/JsonRpcError.js +0 -191
- package/lib/jsonrpc/JsonRpcMethod.js +0 -67
- package/lib/jsonrpc/JsonRpcRequest.js +0 -224
- package/lib/jsonrpc/JsonRpcRequestProcessor.js +0 -366
- package/lib/jsonrpc/JsonRpcResponse.js +0 -175
- package/lib/jsonrpc/JsonRpcServer.js +0 -81
- package/lib/logger/EmptyLogger.js +0 -15
- package/lib/logger/LoggerFactory.js +0 -20
- package/lib/logger/WildFireLogger.js +0 -267
- package/lib/pattern/Pool.js +0 -187
- package/lib/pattern/decorator/AbstractDecorator.js +0 -49
- package/lib/pattern/decorator/DecoratorChain.js +0 -285
- package/lib/util/DeviceDetector.js +0 -153
- package/lib/yaml/YAML.js +0 -46
- package/patterns.conf +0 -6
- package/tests/cache/CacheLoaderSpec.js +0 -7
- package/tests/class/ClassSpec.js +0 -106
- package/tests/client/MemcachedSocketSpec.js +0 -1228
- package/tests/client/MemcachedSpec.js +0 -77
- package/tests/client/MySQLPoolSpec.js +0 -231
- package/tests/client/PGPoolSpec.js +0 -479
- package/tests/client/RedisSpec.js +0 -471
- package/tests/client/S3ClientSpec.js +0 -26
- package/tests/client/S3Spec.js +0 -129
- package/tests/client/rabbitmq/RbmqConnectionSpec.js +0 -71
- package/tests/common/AssertionsSpec.js +0 -278
- package/tests/common/NetSpec.js +0 -6
- package/tests/common/RandomSpec.js +0 -35
- package/tests/common/TypesSpec.js +0 -7
- package/tests/credentials/CredentialsProviderSpec.js +0 -46
- package/tests/crypto/CryptoSpec.js +0 -33
- package/tests/data/BinaryDataSpec.js +0 -50
- package/tests/data/CompressorSpec.js +0 -7
- package/tests/data/FormDataSpec.js +0 -7
- package/tests/data/MimeSpec.js +0 -7
- package/tests/event/ErrorEventSpec.js +0 -20
- package/tests/event/EventDispatcherSpec.js +0 -319
- package/tests/event/EventSpec.js +0 -17
- package/tests/http/ConnectionPoolSpec.js +0 -7
- package/tests/http/HeadersSpec.js +0 -79
- package/tests/http/LoaderSpec.js +0 -43
- package/tests/http/MessageSpec.js +0 -251
- package/tests/http/RequestProcessorSpec.js +0 -124
- package/tests/http/RequestSpec.js +0 -651
- package/tests/http/ResponseSpec.js +0 -491
- package/tests/http/ServerSpec.js +0 -7
- package/tests/http/SocketSpec.js +0 -7
- package/tests/http/UrlSpec.js +0 -14
- package/tests/jsonrpc/JsonRpcAbstractSpec.js +0 -20
- package/tests/jsonrpc/JsonRpcBatchRequestSpec.js +0 -31
- package/tests/jsonrpc/JsonRpcBatchResponseSpec.js +0 -38
- package/tests/jsonrpc/JsonRpcErrorSpec.js +0 -58
- package/tests/jsonrpc/JsonRpcMethodSpec.js +0 -7
- package/tests/jsonrpc/JsonRpcRequestProcessorSpec.js +0 -271
- package/tests/jsonrpc/JsonRpcRequestSpec.js +0 -70
- package/tests/jsonrpc/JsonRpcResponseSpec.js +0 -63
- package/tests/jsonrpc/JsonRpcServerSpec.js +0 -42
- package/tests/pattern/PoolSpec.js +0 -180
- package/tests/pattern/decorator/AbstractDecoratorSpec.js +0 -7
- package/tests/pattern/decorator/DecoratorChainSpec.js +0 -7
- package/tests/yaml/YAMLSpec.js +0 -132
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
describe('Assertions', function () {
|
|
2
|
-
var Assertions = require('../../lib/common/Assertions.js').Assertions;
|
|
3
|
-
it('require', function () {
|
|
4
|
-
expect(Assertions).toBeTruthy();
|
|
5
|
-
})
|
|
6
|
-
|
|
7
|
-
it('isArray', function () {
|
|
8
|
-
expect(function () {
|
|
9
|
-
Assertions.isArray(new Array());
|
|
10
|
-
}).not.toThrow();
|
|
11
|
-
|
|
12
|
-
expect(function () {
|
|
13
|
-
Assertions.isArray(true);
|
|
14
|
-
}).toThrow();
|
|
15
|
-
|
|
16
|
-
expect(function () {
|
|
17
|
-
Assertions.isArray(new Date());
|
|
18
|
-
}).toThrow();
|
|
19
|
-
|
|
20
|
-
expect(function () {
|
|
21
|
-
Assertions.isArray(function () {});
|
|
22
|
-
}).toThrow();
|
|
23
|
-
|
|
24
|
-
expect(function () {
|
|
25
|
-
Assertions.isArray(1);
|
|
26
|
-
}).toThrow();
|
|
27
|
-
|
|
28
|
-
expect(function () {
|
|
29
|
-
Assertions.isArray(new Object());
|
|
30
|
-
}).toThrow();
|
|
31
|
-
|
|
32
|
-
expect(function () {
|
|
33
|
-
Assertions.isArray(new RegExp('a'));
|
|
34
|
-
}).toThrow();
|
|
35
|
-
|
|
36
|
-
expect(function () {
|
|
37
|
-
Assertions.isArray('a');
|
|
38
|
-
}).toThrow();
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
it('isBoolean', function () {
|
|
42
|
-
expect(function () {
|
|
43
|
-
Assertions.isBoolean(new Array());
|
|
44
|
-
}).toThrow();
|
|
45
|
-
|
|
46
|
-
expect(function () {
|
|
47
|
-
Assertions.isBoolean(true);
|
|
48
|
-
}).not.toThrow();
|
|
49
|
-
|
|
50
|
-
expect(function () {
|
|
51
|
-
Assertions.isBoolean(new Date());
|
|
52
|
-
}).toThrow();
|
|
53
|
-
|
|
54
|
-
expect(function () {
|
|
55
|
-
Assertions.isBoolean(function () {});
|
|
56
|
-
}).toThrow();
|
|
57
|
-
|
|
58
|
-
expect(function () {
|
|
59
|
-
Assertions.isBoolean(1);
|
|
60
|
-
}).toThrow();
|
|
61
|
-
|
|
62
|
-
expect(function () {
|
|
63
|
-
Assertions.isBoolean(new Object());
|
|
64
|
-
}).toThrow();
|
|
65
|
-
|
|
66
|
-
expect(function () {
|
|
67
|
-
Assertions.isBoolean(new RegExp('a'));
|
|
68
|
-
}).toThrow();
|
|
69
|
-
|
|
70
|
-
expect(function () {
|
|
71
|
-
Assertions.isBoolean('a');
|
|
72
|
-
}).toThrow();
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('isDate', function () {
|
|
76
|
-
expect(function () {
|
|
77
|
-
Assertions.isDate(new Array());
|
|
78
|
-
}).toThrow();
|
|
79
|
-
|
|
80
|
-
expect(function () {
|
|
81
|
-
Assertions.isDate(true);
|
|
82
|
-
}).toThrow();
|
|
83
|
-
|
|
84
|
-
expect(function () {
|
|
85
|
-
Assertions.isDate(new Date());
|
|
86
|
-
}).not.toThrow();
|
|
87
|
-
|
|
88
|
-
expect(function () {
|
|
89
|
-
Assertions.isDate(function () {});
|
|
90
|
-
}).toThrow();
|
|
91
|
-
|
|
92
|
-
expect(function () {
|
|
93
|
-
Assertions.isDate(1);
|
|
94
|
-
}).toThrow();
|
|
95
|
-
|
|
96
|
-
expect(function () {
|
|
97
|
-
Assertions.isDate(new Object());
|
|
98
|
-
}).toThrow();
|
|
99
|
-
|
|
100
|
-
expect(function () {
|
|
101
|
-
Assertions.isDate(new RegExp('a'));
|
|
102
|
-
}).toThrow();
|
|
103
|
-
|
|
104
|
-
expect(function () {
|
|
105
|
-
Assertions.isDate('a');
|
|
106
|
-
}).toThrow();
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
it('isFunction', function () {
|
|
110
|
-
expect(function () {
|
|
111
|
-
Assertions.isFunction(new Array());
|
|
112
|
-
}).toThrow();
|
|
113
|
-
|
|
114
|
-
expect(function () {
|
|
115
|
-
Assertions.isFunction(true);
|
|
116
|
-
}).toThrow();
|
|
117
|
-
|
|
118
|
-
expect(function () {
|
|
119
|
-
Assertions.isFunction(new Date());
|
|
120
|
-
}).toThrow();
|
|
121
|
-
|
|
122
|
-
expect(function () {
|
|
123
|
-
Assertions.isFunction(function () {});
|
|
124
|
-
}).not.toThrow();
|
|
125
|
-
|
|
126
|
-
expect(function () {
|
|
127
|
-
Assertions.isFunction(1);
|
|
128
|
-
}).toThrow();
|
|
129
|
-
|
|
130
|
-
expect(function () {
|
|
131
|
-
Assertions.isFunction(new Object());
|
|
132
|
-
}).toThrow();
|
|
133
|
-
|
|
134
|
-
expect(function () {
|
|
135
|
-
Assertions.isFunction(new RegExp('a'));
|
|
136
|
-
}).toThrow();
|
|
137
|
-
|
|
138
|
-
expect(function () {
|
|
139
|
-
Assertions.isFunction('a');
|
|
140
|
-
}).toThrow();
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
it('isObject', function () {
|
|
144
|
-
expect(function () {
|
|
145
|
-
Assertions.isObject(new Array());
|
|
146
|
-
}).toThrow();
|
|
147
|
-
|
|
148
|
-
expect(function () {
|
|
149
|
-
Assertions.isObject(true);
|
|
150
|
-
}).toThrow();
|
|
151
|
-
|
|
152
|
-
expect(function () {
|
|
153
|
-
Assertions.isObject(new Date());
|
|
154
|
-
}).toThrow();
|
|
155
|
-
|
|
156
|
-
expect(function () {
|
|
157
|
-
Assertions.isObject(function () {});
|
|
158
|
-
}).toThrow();
|
|
159
|
-
|
|
160
|
-
expect(function () {
|
|
161
|
-
Assertions.isObject(1);
|
|
162
|
-
}).toThrow();
|
|
163
|
-
|
|
164
|
-
expect(function () {
|
|
165
|
-
Assertions.isObject(new Object());
|
|
166
|
-
}).not.toThrow();
|
|
167
|
-
|
|
168
|
-
expect(function () {
|
|
169
|
-
Assertions.isObject(new RegExp('a'));
|
|
170
|
-
}).toThrow();
|
|
171
|
-
|
|
172
|
-
expect(function () {
|
|
173
|
-
Assertions.isObject('a');
|
|
174
|
-
}).toThrow();
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
it('isRegExp', function () {
|
|
178
|
-
expect(function () {
|
|
179
|
-
Assertions.isRegExp(new Array());
|
|
180
|
-
}).toThrow();
|
|
181
|
-
|
|
182
|
-
expect(function () {
|
|
183
|
-
Assertions.isRegExp(true);
|
|
184
|
-
}).toThrow();
|
|
185
|
-
|
|
186
|
-
expect(function () {
|
|
187
|
-
Assertions.isRegExp(new Date());
|
|
188
|
-
}).toThrow();
|
|
189
|
-
|
|
190
|
-
expect(function () {
|
|
191
|
-
Assertions.isRegExp(function () {});
|
|
192
|
-
}).toThrow();
|
|
193
|
-
|
|
194
|
-
expect(function () {
|
|
195
|
-
Assertions.isRegExp(1);
|
|
196
|
-
}).toThrow();
|
|
197
|
-
|
|
198
|
-
expect(function () {
|
|
199
|
-
Assertions.isRegExp(new Object());
|
|
200
|
-
}).toThrow();
|
|
201
|
-
|
|
202
|
-
expect(function () {
|
|
203
|
-
Assertions.isRegExp(new RegExp('a'));
|
|
204
|
-
}).not.toThrow();
|
|
205
|
-
|
|
206
|
-
expect(function () {
|
|
207
|
-
Assertions.isRegExp('a');
|
|
208
|
-
}).toThrow();
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
it('isNumber', function () {
|
|
212
|
-
expect(function () {
|
|
213
|
-
Assertions.isNumber(new Array());
|
|
214
|
-
}).toThrow();
|
|
215
|
-
|
|
216
|
-
expect(function () {
|
|
217
|
-
Assertions.isNumber(true);
|
|
218
|
-
}).toThrow();
|
|
219
|
-
|
|
220
|
-
expect(function () {
|
|
221
|
-
Assertions.isNumber(new Date());
|
|
222
|
-
}).toThrow();
|
|
223
|
-
|
|
224
|
-
expect(function () {
|
|
225
|
-
Assertions.isNumber(function () {});
|
|
226
|
-
}).toThrow();
|
|
227
|
-
|
|
228
|
-
expect(function () {
|
|
229
|
-
Assertions.isNumber(1);
|
|
230
|
-
}).not.toThrow();
|
|
231
|
-
|
|
232
|
-
expect(function () {
|
|
233
|
-
Assertions.isNumber(new Object());
|
|
234
|
-
}).toThrow();
|
|
235
|
-
|
|
236
|
-
expect(function () {
|
|
237
|
-
Assertions.isNumber(new RegExp('a'));
|
|
238
|
-
}).toThrow();
|
|
239
|
-
|
|
240
|
-
expect(function () {
|
|
241
|
-
Assertions.isNumber('a');
|
|
242
|
-
}).toThrow();
|
|
243
|
-
});
|
|
244
|
-
|
|
245
|
-
it('isString', function () {
|
|
246
|
-
expect(function () {
|
|
247
|
-
Assertions.isString(new Array());
|
|
248
|
-
}).toThrow();
|
|
249
|
-
|
|
250
|
-
expect(function () {
|
|
251
|
-
Assertions.isString(true);
|
|
252
|
-
}).toThrow();
|
|
253
|
-
|
|
254
|
-
expect(function () {
|
|
255
|
-
Assertions.isString(new Date());
|
|
256
|
-
}).toThrow();
|
|
257
|
-
|
|
258
|
-
expect(function () {
|
|
259
|
-
Assertions.isString(function () {});
|
|
260
|
-
}).toThrow();
|
|
261
|
-
|
|
262
|
-
expect(function () {
|
|
263
|
-
Assertions.isString(1);
|
|
264
|
-
}).toThrow();
|
|
265
|
-
|
|
266
|
-
expect(function () {
|
|
267
|
-
Assertions.isString(new Object());
|
|
268
|
-
}).toThrow();
|
|
269
|
-
|
|
270
|
-
expect(function () {
|
|
271
|
-
Assertions.isString(new RegExp('a'));
|
|
272
|
-
}).toThrow();
|
|
273
|
-
|
|
274
|
-
expect(function () {
|
|
275
|
-
Assertions.isString('a');
|
|
276
|
-
}).not.toThrow();
|
|
277
|
-
});
|
|
278
|
-
})
|
package/tests/common/NetSpec.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
describe('Random', function () {
|
|
2
|
-
var Random;
|
|
3
|
-
it('require', function () {
|
|
4
|
-
expect(function () {
|
|
5
|
-
Random = require('../../lib/common/Random.js').Random;
|
|
6
|
-
}).not.toThrow();
|
|
7
|
-
expect(Random).toBeTruthy();
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
it('random string', function () {
|
|
11
|
-
var s1 = Random.randomString();
|
|
12
|
-
expect(s1).toBeTruthy();
|
|
13
|
-
var s2 = Random.randomString(10);
|
|
14
|
-
expect(s2.length).toEqual(10);
|
|
15
|
-
var s3 = Random.randomString(20);
|
|
16
|
-
expect(s3.length).toEqual(20);
|
|
17
|
-
var s4 = Random.randomString(5, Random.digits);
|
|
18
|
-
expect(s4.length).toEqual(5);
|
|
19
|
-
expect(parseInt(s4)).not.toEqual(NaN);
|
|
20
|
-
var s5 = Random.randomString();
|
|
21
|
-
expect(parseInt(s5, 36)).not.toEqual(NaN);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('random integer', function () {
|
|
25
|
-
var i1 = Random.randomInt();
|
|
26
|
-
expect(i1).toBeLessThan(100000);
|
|
27
|
-
expect(i1).toBeGreaterThan(-1);
|
|
28
|
-
var i2 = Random.randomInt(100);
|
|
29
|
-
expect(i2).toBeLessThan(101);
|
|
30
|
-
expect(i2).toBeGreaterThan(-1);
|
|
31
|
-
var i3 = Random.randomInt(10, 5);
|
|
32
|
-
expect(i3).toBeLessThan(11);
|
|
33
|
-
expect(i3).toBeGreaterThan(4);
|
|
34
|
-
});
|
|
35
|
-
})
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
describe("CredentialsProvider", function () {
|
|
2
|
-
|
|
3
|
-
it("conceptual example usage", function () {
|
|
4
|
-
var CredentialsProvider = require('../../lib/credentials/CredentialsProvider.js').CredentialsProvider;
|
|
5
|
-
expect(CredentialsProvider).not.toBeNull();
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var done = false;
|
|
9
|
-
|
|
10
|
-
var ExampleCredentialClient = function (credentialsProvider) {
|
|
11
|
-
this.credentialsProvider = credentialsProvider;
|
|
12
|
-
//this.credentialsProvider.addEventListener(CredentialsProvider.Event.LOAD, this._onCredentialsLoad, this);
|
|
13
|
-
|
|
14
|
-
this._credentials = null;
|
|
15
|
-
}
|
|
16
|
-
ExampleCredentialClient.prototype._onCredentialsLoad = function (e) {
|
|
17
|
-
this._credentials = e.data;
|
|
18
|
-
//creating pool itd
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
ExampleCredentialClient.prototype.get = function (key, callback) {
|
|
22
|
-
//getting from pool itd
|
|
23
|
-
this.credentialsProvider.get(function (err, credentials) {
|
|
24
|
-
if (credentials) {
|
|
25
|
-
callback(credentials);
|
|
26
|
-
} else {
|
|
27
|
-
//have to wait
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
//test
|
|
33
|
-
var credentials = {host: "test.onet", port: 9090};
|
|
34
|
-
var provider = new CredentialsProvider(credentials);
|
|
35
|
-
var exampleClient = new ExampleCredentialClient(provider);
|
|
36
|
-
exampleClient.get("test", function (credentials2) {
|
|
37
|
-
expect(credentials2).toBe(credentials);
|
|
38
|
-
done = true;
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
waitsFor(function () {
|
|
42
|
-
return done == true;
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
});
|
|
46
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
var crypto = require('../../lib/crypto/Crypto.js').Crypto;
|
|
2
|
-
|
|
3
|
-
describe('Crypto', function () {
|
|
4
|
-
var Crypto;
|
|
5
|
-
|
|
6
|
-
it('should convert hex to base64 for md5', function () {
|
|
7
|
-
var md5 = crypto.md5('test');
|
|
8
|
-
var base64 = crypto.md5('test', 'base64');
|
|
9
|
-
expect(base64).toEqual(crypto.convertHexToBase64(md5));
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
it('should convert hex to base64 for sha1', function () {
|
|
13
|
-
var hex = crypto.sha1('test');
|
|
14
|
-
var base64 = crypto.sha1('test', 'base64');
|
|
15
|
-
expect(base64).toEqual(crypto.convertHexToBase64(hex));
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('should convert hex to base64 for sha256', function () {
|
|
19
|
-
var hex = crypto.sha256('test');
|
|
20
|
-
var base64 = crypto.sha256('test', 'base64');
|
|
21
|
-
expect(base64).toEqual(crypto.convertHexToBase64(hex));
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('should escape string to url-friendly base64', function () {
|
|
25
|
-
var base = crypto.escapeBase64('testw?>aaa?>a');
|
|
26
|
-
expect(base).toEqual('dGVzdHc_PmFhYT8-YQ');
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('should unescape url-friendly base64 correctly', function () {
|
|
30
|
-
var str = crypto.unescapeBase64('dGVzdHc_PmFhYT8-YQ');
|
|
31
|
-
expect(str).toEqual('testw?>aaa?>a');
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
describe('BinaryData', function(){
|
|
2
|
-
var BinaryData, Iconv;
|
|
3
|
-
it('requirements', function(){
|
|
4
|
-
BinaryData = require('../../lib/index.js').data.BinaryData;
|
|
5
|
-
expect(BinaryData).not.toBeNull();
|
|
6
|
-
|
|
7
|
-
Iconv = require('iconv').Iconv;
|
|
8
|
-
|
|
9
|
-
expect(Iconv).not.toBeNull();
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
it('creation', function(){
|
|
13
|
-
var data = new BinaryData("text data", BinaryData.Encoding.TEXT, BinaryData.CharacterEncoding.UTF8);
|
|
14
|
-
expect(data).not.toBeNull();
|
|
15
|
-
expect((data instanceof BinaryData)).toBeTruthy();
|
|
16
|
-
expect(data.getEncoding()).toEqual(BinaryData.Encoding.TEXT);
|
|
17
|
-
expect(data.getCharacterEncoding()).toEqual(BinaryData.CharacterEncoding.UTF8);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('convertion', function(){
|
|
21
|
-
//
|
|
22
|
-
var dataString = "Test data in UTF8 ąężźć";
|
|
23
|
-
var bdUTF8 = new BinaryData(dataString, BinaryData.Encoding.TEXT, BinaryData.CharacterEncoding.UTF8)
|
|
24
|
-
expect(bdUTF8.toUTF8String()).toEqual(dataString);
|
|
25
|
-
expect(bdUTF8.toString()).toEqual(dataString);
|
|
26
|
-
expect(bdUTF8.toBuffer().toString()).toEqual(dataString);
|
|
27
|
-
|
|
28
|
-
var buff = new Buffer(dataString);
|
|
29
|
-
|
|
30
|
-
var bdISO = new BinaryData("", BinaryData.Encoding.TEXT, BinaryData.CharacterEncoding.ISO_8859_2);
|
|
31
|
-
bdISO.setData(buff, BinaryData.Encoding.TEXT, BinaryData.CharacterEncoding.UTF8);
|
|
32
|
-
expect(bdISO.toUTF8String()).toEqual(dataString);
|
|
33
|
-
expect(function(){
|
|
34
|
-
bdISO.toBuffer()
|
|
35
|
-
}).toThrow(BinaryData.Exception.CONVERTION_ERROR);
|
|
36
|
-
expect(function(){
|
|
37
|
-
bdISO.toString()
|
|
38
|
-
}).toThrow(BinaryData.Exception.CONVERTION_ERROR);
|
|
39
|
-
|
|
40
|
-
bdISO = new BinaryData("", BinaryData.Encoding.BINARY, BinaryData.CharacterEncoding.ISO_8859_2);
|
|
41
|
-
bdISO.setData(buff, BinaryData.Encoding.TEXT, BinaryData.CharacterEncoding.UTF8);
|
|
42
|
-
expect(bdISO.toUTF8String()).toEqual(dataString)
|
|
43
|
-
|
|
44
|
-
var expectation = new Buffer((new Iconv(BinaryData.CharacterEncoding.UTF8, BinaryData.CharacterEncoding.ISO_8859_2).convert(buff))).toString('base64');
|
|
45
|
-
expect(bdISO.toString()).toEqual(expectation);
|
|
46
|
-
|
|
47
|
-
expectation = (new Iconv(BinaryData.CharacterEncoding.UTF8, BinaryData.CharacterEncoding.ISO_8859_2).convert(buff));
|
|
48
|
-
expect(bdISO.toBuffer().toString()).toEqual(expectation.toString());
|
|
49
|
-
});
|
|
50
|
-
});
|
package/tests/data/MimeSpec.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
describe('ErrorEvent', function(){
|
|
2
|
-
var ErrorEvent = null
|
|
3
|
-
it('require ErrorEvent', function(){
|
|
4
|
-
ErrorEvent = require('../../lib/event/ErrorEvent.js').ErrorEvent;
|
|
5
|
-
expect(ErrorEvent).not.toBeNull();
|
|
6
|
-
});
|
|
7
|
-
var ee, msg = "error ocured";
|
|
8
|
-
it('ErrorEvent - creation', function(){
|
|
9
|
-
ee = new ErrorEvent('test', 'data', 13, msg);
|
|
10
|
-
expect(ee.type).toEqual('test');
|
|
11
|
-
expect(ee.data).toEqual('data');
|
|
12
|
-
expect(ee.code).toEqual(13);
|
|
13
|
-
expect(ee.message).toEqual(msg);
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('ErrorEvent - toHtmlString', function(){
|
|
17
|
-
expect(ee.toHtmlString()).toEqual("<pre>\ttype: test\n\tdata: data\n\ttarget: undefined\n\tcode: 13\n\tmessage: error ocured\n</pre>");
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
});
|