diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
commit | 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /testing/web-platform/tests/IndexedDB/reading-autoincrement-store.any.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/IndexedDB/reading-autoincrement-store.any.js')
-rw-r--r-- | testing/web-platform/tests/IndexedDB/reading-autoincrement-store.any.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/testing/web-platform/tests/IndexedDB/reading-autoincrement-store.any.js b/testing/web-platform/tests/IndexedDB/reading-autoincrement-store.any.js new file mode 100644 index 0000000000..531d5417bb --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/reading-autoincrement-store.any.js @@ -0,0 +1,49 @@ +// META: global=window,dedicatedworker,sharedworker,serviceworker +// META: script=resources/support-promises.js +// META: script=resources/reading-autoincrement-common.js + +promise_test(async testCase => { + const database = await setupAutoincrementDatabase(testCase); + + const transaction = database.transaction(['store'], 'readonly'); + const store = transaction.objectStore('store'); + const request = store.getAll(); + const result = await promiseForRequest(testCase, request); + assert_equals(result.length, 32); + for (let i = 1; i <= 32; ++i) { + assert_equals(result[i - 1].id, i, 'Autoincrement key'); + assert_equals(result[i - 1].name, nameForId(i), 'String property'); + } + + database.close(); +}, 'IDBObjectStore.getAll() for an autoincrement store'); + +promise_test(async testCase => { + const database = await setupAutoincrementDatabase(testCase); + + const transaction = database.transaction(['store'], 'readonly'); + const store = transaction.objectStore('store'); + const request = store.getAllKeys(); + const result = await promiseForRequest(testCase, request); + assert_equals(result.length, 32); + for (let i = 1; i <= 32; ++i) + assert_equals(result[i - 1], i, 'Autoincrement key'); + + database.close(); +}, 'IDBObjectStore.getAllKeys() for an autoincrement store'); + +promise_test(async testCase => { + const database = await setupAutoincrementDatabase(testCase); + + const transaction = database.transaction(['store'], 'readonly'); + const store = transaction.objectStore('store'); + + for (let i = 1; i <= 32; ++i) { + const request = store.get(i); + const result = await promiseForRequest(testCase, request); + assert_equals(result.id, i, 'Autoincrement key'); + assert_equals(result.name, nameForId(i), 'String property'); + } + + database.close(); +}, 'IDBObjectStore.get() for an autoincrement store'); |