cloudfunctions/SegmentPortraitPic/node_modules/@cloudbase/node-sdk/test/database/index.test.ts

(开头部分) 8KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

import * as assert from 'power-assert'
import tcb from '../../src/index'
import * as config from '../config.local'
import * as common from '../common/index'
import { ERROR } from '../../lib/const/code'

describe('test/index.test.ts', () => {
    const app = tcb.init({
        ...config,
        // env: Mock.env,
        // mpAppId: Mock.appId,
        sessionToken: undefined
    })

    let db = null

    try {
        db = app.database('env')
    } catch (err) {
        assert(err.code === ERROR.INVALID_PARAM.code)
    }

    db = app.database()

    const _ = db.command

    const collName = 'db-test-index'
    const collection = db.collection(collName)

    const initialData = {
        name: 'aaa',
        array: [1, 2, 3, [4, 5, 6], { a: 1, b: { c: 'fjasklfljkas', d: false } }],
        data: {
            a: 'a',
            b: 'b',
            c: 'c'
        },
        null: null,
        date: new Date(),
        // regex: new db.RegExp({
        //     regexp: '.*',
        //     options: 'i'
        // }),
        deepObject: {
            'l-02-01': {
                'l-03-01': {
                    'l-04-01': {
                        level: 1,
                        name: 'l-01',
                        flag: '0'
                    }
                }
            }
        }
    }

    beforeAll(async () => {
        await common.safeCollection(db, collName)
    })

后面还有 240 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。