Skip to content

Commit

Permalink
reproduce the issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
milaGGL committed Feb 7, 2025
1 parent 4e6a5c6 commit 557241f
Showing 1 changed file with 42 additions and 0 deletions.
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 @@ import {
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 @@ apiDescribe('Database', persistence => {
}
);
});

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

it.only('can run transactions on documents with bson types', async () => {

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

View workflow job for this annotation

GitHub Actions / Lint

'it.only' is restricted from being used
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']
]);
}
);
});
});

0 comments on commit 557241f

Please sign in to comment.