How to use the @nativescript/core/application-settings.hasKey function in @nativescript/core

To help you get started, we’ve selected a few @nativescript/core 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 NativeScript / NativeScript / tests / app / application-settings / application-settings-tests.ts View on Github external
export var testInvalidKey = function () {
    try {
        appSettings.hasKey(undefined);
        TKUnit.assert(false, "There is a key undefined");
    }
    catch (e) {
        // we should receive an exception here
    }

    try {
        appSettings.hasKey(null);
        TKUnit.assert(false, "There is a key null");
    }
    catch (e) {
        // we should receive an exception here
    }

    try {
        appSettings.hasKey(123);
github NativeScript / NativeScript / tests / app / application-settings / application-settings-tests.ts View on Github external
TKUnit.assert(false, "There is a key undefined");
    }
    catch (e) {
        // we should receive an exception here
    }

    try {
        appSettings.hasKey(null);
        TKUnit.assert(false, "There is a key null");
    }
    catch (e) {
        // we should receive an exception here
    }

    try {
        appSettings.hasKey(123);
        TKUnit.assert(false, "There is a key number");
    }
    catch (e) {
        // we should receive an exception here
    }

    appSettings.hasKey("string");
};
github NativeScript / NativeScript / tests / app / application-settings / application-settings-tests.ts View on Github external
export var testInvalidKey = function () {
    try {
        appSettings.hasKey(undefined);
        TKUnit.assert(false, "There is a key undefined");
    }
    catch (e) {
        // we should receive an exception here
    }

    try {
        appSettings.hasKey(null);
        TKUnit.assert(false, "There is a key null");
    }
    catch (e) {
        // we should receive an exception here
    }

    try {
        appSettings.hasKey(123);
        TKUnit.assert(false, "There is a key number");
    }
    catch (e) {
        // we should receive an exception here
    }

    appSettings.hasKey("string");
};
github NativeScript / NativeScript / tests / app / application-settings / application-settings-tests.ts View on Github external
export var testHasKey = function () {
    var hasKey = appSettings.hasKey("noBoolKey");
    // will return false if there is no value for "noBoolKey"

    TKUnit.assert(!hasKey, "There is a key: " + noBoolKey);
    TKUnit.assert(!appSettings.hasKey(noStringKey), "There is a key: " + noStringKey);
    TKUnit.assert(!appSettings.hasKey(noNumberKey), "There is a key: " + noNumberKey);

    TKUnit.assert(appSettings.hasKey(boolKey), "There is no key: " + boolKey);
    TKUnit.assert(appSettings.hasKey(stringKey), "There is no key: " + stringKey);
    TKUnit.assert(appSettings.hasKey(numberKey), "There is no key: " + numberKey);
};
github NativeScript / NativeScript / tests / app / application-settings / application-settings-tests.ts View on Github external
export var testHasKey = function () {
    var hasKey = appSettings.hasKey("noBoolKey");
    // will return false if there is no value for "noBoolKey"

    TKUnit.assert(!hasKey, "There is a key: " + noBoolKey);
    TKUnit.assert(!appSettings.hasKey(noStringKey), "There is a key: " + noStringKey);
    TKUnit.assert(!appSettings.hasKey(noNumberKey), "There is a key: " + noNumberKey);

    TKUnit.assert(appSettings.hasKey(boolKey), "There is no key: " + boolKey);
    TKUnit.assert(appSettings.hasKey(stringKey), "There is no key: " + stringKey);
    TKUnit.assert(appSettings.hasKey(numberKey), "There is no key: " + numberKey);
};
github NativeScript / NativeScript / tests / app / application-settings / application-settings-tests.ts View on Github external
export var testHasKey = function () {
    var hasKey = appSettings.hasKey("noBoolKey");
    // will return false if there is no value for "noBoolKey"

    TKUnit.assert(!hasKey, "There is a key: " + noBoolKey);
    TKUnit.assert(!appSettings.hasKey(noStringKey), "There is a key: " + noStringKey);
    TKUnit.assert(!appSettings.hasKey(noNumberKey), "There is a key: " + noNumberKey);

    TKUnit.assert(appSettings.hasKey(boolKey), "There is no key: " + boolKey);
    TKUnit.assert(appSettings.hasKey(stringKey), "There is no key: " + stringKey);
    TKUnit.assert(appSettings.hasKey(numberKey), "There is no key: " + numberKey);
};
github NativeScript / NativeScript / tests / app / application-settings / application-settings-tests.ts View on Github external
export var testFlush = function () {
    appSettings.setString(stringKey, "String value");

    var flushed = appSettings.flush();
    // will return boolean indicating whether flush to disk was successful

    TKUnit.assert(flushed, "Flush failed: " + flushed);
    TKUnit.assert(appSettings.hasKey(stringKey), "There is no key: " + stringKey);
};
github NativeScript / NativeScript / tests / app / application-settings / application-settings-tests.ts View on Github external
export var testClear = function () {
    appSettings.clear();

    TKUnit.assert(!appSettings.hasKey(boolKey), "Failed to remove key: " + boolKey);
    TKUnit.assert(!appSettings.hasKey(stringKey), "Failed to remove key: " + stringKey);
    TKUnit.assert(!appSettings.hasKey(numberKey), "Failed to remove key: " + numberKey);
};
github NativeScript / NativeScript / tests / app / application-settings / application-settings-tests.ts View on Github external
export var testClear = function () {
    appSettings.clear();

    TKUnit.assert(!appSettings.hasKey(boolKey), "Failed to remove key: " + boolKey);
    TKUnit.assert(!appSettings.hasKey(stringKey), "Failed to remove key: " + stringKey);
    TKUnit.assert(!appSettings.hasKey(numberKey), "Failed to remove key: " + numberKey);
};
github NativeScript / NativeScript / tests / app / application-settings / application-settings-tests.ts View on Github external
export var testRemove = function () {
    appSettings.remove("boolKey");

    TKUnit.assert(!appSettings.hasKey(boolKey), "Failed to remove key: " + boolKey);

    appSettings.remove(stringKey);
    TKUnit.assert(!appSettings.hasKey(stringKey), "Failed to remove key: " + stringKey);

    appSettings.remove(numberKey);
    TKUnit.assert(!appSettings.hasKey(numberKey), "Failed to remove key: " + numberKey);
};