@sprucelabs/spruce-cli
Version:
Command line interface for building Spruce skills.
62 lines (54 loc) • 2.05 kB
Plain Text
import { fake, seed } from '@sprucelabs/spruce-test-fixtures'
import { assert, test } from '@sprucelabs/test-utils'
import { HomeIntegration, PublicHomeIntegration } from '../../../google.types'
import AbstractGoogleTest from '../../support/AbstractGoogleTest'
.login()
export default class ListHomeIntegrationsLIstenerTest extends AbstractGoogleTest {
protected static async beforeEach(): Promise<void> {
await super.beforeEach()
await this.bootSkill()
}
protected static async afterEach(): Promise<void> {
}
()
protected static async skillIsListening() {
await this.emit()
}
()
('homeIntegrations', 1)
protected static async canReturnFirstHomeIntegration() {
const expected = await this.getFirstHomeIntegration()
const integrations = await this.emit()
assert.isLength(integrations, 1)
const first = integrations[0]
this.assertIntegrationEqualsExpected(first, expected)
}
()
('homeIntegrations', 2)
protected static async canReturnMultipleHomeIntegrations() {
const expected = await this.homeIntegrations.find(
{},
{},
{ shouldIncludePrivateFields: true }
)
const integrations = await this.emit()
assert.isLength(integrations, 2)
this.assertIntegrationEqualsExpected(integrations[0], expected[0])
this.assertIntegrationEqualsExpected(integrations[1], expected[1])
}
private static assertIntegrationEqualsExpected(
first: PublicHomeIntegration,
expected: HomeIntegration
) {
assert.isEqual(first.id, expected.id)
assert.isEqual(first.name, expected.name)
assert.isEqual(first.description, expected.description)
}
private static async emit() {
const [{ integrations }] =
await this.fakedClient.emitAndFlattenResponses(
'google.list-home-integrations::v2025_02_08'
)
return integrations
}
}