How to use the realm.deleteFile function in realm

To help you get started, we’ve selected a few realm 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 realm / realm-js / tests / js / session-tests.js View on Github external
return Realm.Sync.User.login('http://127.0.0.1:9080', credentials).then(user => {
            let config = {
                sync: {
                    user: user,
                    url: 'realm://127.0.0.1:9080/~/default',
                    fullSynchronization: true, // <---- calling subscribe should fail
                    error: (session, error) => console.log(error)
                },
                schema: [{ name: 'Dog', properties: { name: 'string' } }]
            };

            Realm.deleteFile(config);
            const realm = new Realm(config);
            TestCase.assertEqual(realm.objects('Dog').length, 0);
            TestCase.assertThrows(() => realm.objects('Dog').filtered("name == 'Lassy 1'").subscribe());
            realm.close();
        });
    },
github realm / realm-js / tests / js / permission-tests.js View on Github external
// Full sync shouldn't include the permission schema
            config = {
                schema: [],
                sync: {
                    user: user,
                    url: `realm://NO_SERVER/foo`,
                    fullSynchronization: true
                }
            };
            realm = new Realm(config);
            TestCase.assertTrue(realm.empty);
            TestCase.assertEqual(realm.schema.length, 0);

            realm.close();
            Realm.deleteFile(config);
        });
    },
github realm / realm-js / tests / js / permission-tests.js View on Github external
.then(realm => {
            const user = realm.syncSession.user;
            const config = user.createConfiguration();
            realm.close();
            Realm.deleteFile(config);
            // connecting with an empty schema should be possible, permission is added implicitly
            return Realm.open(config);
        })
        .then(realm => {
github realm / realm-js / tests / js / permission-tests.js View on Github external
fullSynchronization: false,
                }
            };

            let realm = new Realm(config);
            TestCase.assertTrue(realm.empty);

            TestCase.assertEqual(realm.schema.length, 5 + 1); // 5 = see below, 1 = __ResultSets
            TestCase.assertEqual(realm.schema.filter(schema => schema.name === '__Class').length, 1);
            TestCase.assertEqual(realm.schema.filter(schema => schema.name === '__Permission').length, 1);
            TestCase.assertEqual(realm.schema.filter(schema => schema.name === '__Realm').length, 1);
            TestCase.assertEqual(realm.schema.filter(schema => schema.name === '__Role').length, 1);
            TestCase.assertEqual(realm.schema.filter(schema => schema.name === '__User').length, 1);

            realm.close();
            Realm.deleteFile(config);

            // Full sync shouldn't include the permission schema
            config = {
                schema: [],
                sync: {
                    user: user,
                    url: `realm://NO_SERVER/foo`,
                    fullSynchronization: true
                }
            };
            realm = new Realm(config);
            TestCase.assertTrue(realm.empty);
            TestCase.assertEqual(realm.schema.length, 0);

            realm.close();
            Realm.deleteFile(config);
github realm / realm-js / tests / js / realm-tests.js View on Github external
.then(pathExistBeforeDelete => {
                        TestCase.assertTrue(pathExistBeforeDelete);
                        Realm.deleteFile(config);

                        return fs.exists(path)
                    })
                    .then(pathExistAfterDelete => {
github realm / realm-js / tests / js / user-tests.js View on Github external
let callback = (transferred, total) => {
              if (transferred >= total) {
                  session.removeProgressNotification(callback);
                  realm.close();
                  Realm.deleteFile(userConfig);
                  resolve(user.serialize());
              }
          }
          session.addProgressNotification('upload', 'forCurrentlyOutstandingWork', callback);