Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions packages/firestore/test/integration/api/database.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
toIds
} from '../util/helpers';
import { DEFAULT_SETTINGS, DEFAULT_PROJECT_ID } from '../util/settings';
import { AutoId } from '../../../src/util/misc';

Check failure on line 86 in packages/firestore/test/integration/api/database.test.ts

View workflow job for this annotation

GitHub Actions / Lint

`../../../src/util/misc` import should occur before import of `../util/events_accumulator`

use(chaiAsPromised);

Expand Down Expand Up @@ -2619,4 +2620,45 @@
}
);
});

const NIGHTLY_PROJECT_ID = 'firestore-sdk-nightly';
const settings = {
...DEFAULT_SETTINGS,
host: 'test-firestore.sandbox.googleapis.com'
};

it('can run transactions on documents against nightly configuration', async () => {
const testDocs = {
a: { key: 'a' },
b: { key: 'b' },
c: { key: 'c' }
};
return withTestDbsSettings(
persistence,
NIGHTLY_PROJECT_ID,
settings,
1,
async dbs => {
const coll = collection(dbs[0], AutoId.newId());
const docA = await addDoc(coll, testDocs['a']);
const docB = await addDoc(coll, { key: 'place holder' });
const docC = await addDoc(coll, testDocs['c']);

await runTransaction(dbs[0], async transaction => {
const docSnapshot = await transaction.get(docA);
expect(docSnapshot.data()).to.deep.equal(testDocs['a']);
transaction.set(docB, testDocs['b']);
transaction.delete(docC);
});

const orderedQuery = query(coll, orderBy('key', 'asc'));
const snapshot = await getDocs(orderedQuery);

expect(toDataArray(snapshot)).to.deep.equal([
testDocs['a'],
testDocs['b']
]);
}
);
});
});
Loading