Skip to content

Commit

Permalink
feat: add forceRender for outfits (#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
Julieta11 committed Jun 14, 2023
1 parent 14f408d commit d6b744a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions report/schemas.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1361,6 +1361,7 @@ export type Outfit = {
color: Color3;
};
wearables: WearableId[];
forceRender?: WearableCategory[];
};

// @alpha
Expand Down
7 changes: 7 additions & 0 deletions src/platform/outfits/outfits.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { WearableCategory } from '../../dapps/wearable-category'
import { Color3, WearableId } from '../../misc'
import { JSONSchema, ValidateFunction, generateLazyValidator } from '../../validation'

Expand All @@ -10,6 +11,7 @@ export type Outfit = {
hair: { color: Color3 }
skin: { color: Color3 }
wearables: WearableId[]
forceRender?: WearableCategory[]
}

/**
Expand Down Expand Up @@ -50,6 +52,11 @@ export namespace Outfit {
items: {
type: 'string'
}
},
forceRender: {
type: 'array',
nullable: true,
items: WearableCategory.schema
}
},
additionalProperties: true
Expand Down
8 changes: 7 additions & 1 deletion test/platform/item/outfits/outfits.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import expect from 'expect'
import { Outfits } from '../../../../src'
import { Outfits, WearableCategory } from '../../../../src'
import { testTypeSignature } from '../../../test-utils'

const OUTFITS: Outfits = {
Expand Down Expand Up @@ -32,6 +32,12 @@ it('outfits is valid', () => {
expect(Outfits.validate(OUTFITS)).toEqual(true)
})

it('outfits with forceRender is valid', () => {
OUTFITS.outfits[0].outfit.forceRender = [WearableCategory.EYEBROWS]
testTypeSignature(Outfits, OUTFITS)
expect(Outfits.validate(OUTFITS)).toEqual(true)
})

it('null outfits is invalid', () => {
expect(Outfits.validate(null)).toEqual(false)
})
Expand Down

0 comments on commit d6b744a

Please sign in to comment.